re: Writing Clean Code VIEW POST

FULL DISCUSSION
 

I think that example can be shorter too!
function canView($scope, $ownerId) {
return ($scope === 'public' ||
Auth::user()->hasRole('admin') ||
($scope === 'private' && Auth::user()->id === $ownerId));
}

 

As noted in other comments, it's not about shorter, it's about more readable.

code of conduct - report abuse