original_string: public function userHasAccess(User $user)
      {
          if ($this->getWhitelisted() === false) {
              return true;
          }
  
          $criteria = Criteria::create()
                  ->where(Criteria::expr()->eq('user', $user))
                  ->setMaxResults(1);
  
          $serverUsers = $this->users->matching($criteria);
          if ($serverUsers->count() === 0) {
              return false;
          }
  
          $serverUser = $serverUsers->first();
  
          if ($serverUser->getBanned() === true) {
              return false;
          }
  
          if ($this->getRequiresApproval() === true && $serverUser->getApproved() === false) {
              return false;
          }
  
          return true;
      }
code: public function userHasAccess(User $user)
      {
          if ($this->getWhitelisted() === false) {
              return true;
          }
  
          $criteria = Criteria::create()
                  ->where(Criteria::expr()->eq('user', $user))
                  ->setMaxResults(1);
  
          $serverUsers = $this->users->matching($criteria);
          if ($serverUsers->count() === 0) {
              return false;
          }
  
          $serverUser = $serverUsers->first();
  
          if ($serverUser->getBanned() === true) {
              return false;
          }
  
          if ($this->getRequiresApproval() === true && $serverUser->getApproved() === false) {
              return false;
          }
  
          return true;
      }
code_tokens: public function userHasAccess ( User $ user ) { if ( $ this -> getWhitelisted ( ) === false ) { return true ; } $ criteria = Criteria :: create ( ) -> where ( Criteria :: expr ( ) -> eq ( 'user' , $ user ) ) -> setMaxResults ( 1 ) ; $ serverUsers = $ this -> users -> matching ( $ criteria ) ; if ( $ serverUsers -> count ( ) === 0 ) { return false ; } $ serverUser = $ serverUsers -> first ( ) ; if ( $ serverUser -> getBanned ( ) === true ) { return false ; } if ( $ this -> getRequiresApproval ( ) === true && $ serverUser -> getApproved ( ) === false ) { return false ; } return true ; }
docstring: Get whether the user has access
  
  @return boolean
docstring_tokens: Get whether the user has access