public function checkRole(array $roles)
    {
        // Find a user which matches the required roles.
        $user = $this->getCustomerUser();

        if (! $this->hasRequiredRole($user, $roles)) {
            $user = $this->getAdminUser();

            if (! $this->hasRequiredRole($user, $roles)) {
                $user = null;
            }
        }

        return $user;
    }
public function checkRole(array $roles)
    {
        // Find a user which matches the required roles.
        $user = $this->getCustomerUser();

        if (! $this->hasRequiredRole($user, $roles)) {
            $user = $this->getAdminUser();

            if (! $this->hasRequiredRole($user, $roles)) {
                $user = null;
            }
        }

        return $user;
    }
public function checkRole ( array $ roles ) { // Find a user which matches the required roles. $ user = $ this -> getCustomerUser ( ) ; if ( ! $ this -> hasRequiredRole ( $ user , $ roles ) ) { $ user = $ this -> getAdminUser ( ) ; if ( ! $ this -> hasRequiredRole ( $ user , $ roles ) ) { $ user = null ; } } return $ user ; }
look if a user has the required role.

@param array $roles
@return null|UserInterface
look if a user has the required role .