original_string: public function view(UserPolicy $user, Gallery $gallery)
      {
          if ($user->canDo('gallery.gallery.view') && $user->isAdmin()) {
              return true;
          }
  
          return $gallery->user_id == user_id() && $gallery->user_type == user_type();
      }
code: public function view(UserPolicy $user, Gallery $gallery)
      {
          if ($user->canDo('gallery.gallery.view') && $user->isAdmin()) {
              return true;
          }
  
          return $gallery->user_id == user_id() && $gallery->user_type == user_type();
      }
code_tokens: public function view ( UserPolicy $ user , Gallery $ gallery ) { if ( $ user -> canDo ( 'gallery.gallery.view' ) && $ user -> isAdmin ( ) ) { return true ; } return $ gallery -> user_id == user_id ( ) && $ gallery -> user_type == user_type ( ) ; }
docstring: Determine if the given user can view the gallery.
  
  @param UserPolicy $user
  @param Gallery $gallery
  
  @return bool
docstring_tokens: Determine if the given user can view the gallery .