public function hasRoleForUser($name, $role)
    {
        $roles = $this->getRolesForUser($name);

        $hasRole = false;
        foreach ($roles as $r) {
            if ($r == $role) {
                $hasRole = true;

                break;
            }
        }

        return $hasRole;
    }
public function hasRoleForUser($name, $role)
    {
        $roles = $this->getRolesForUser($name);

        $hasRole = false;
        foreach ($roles as $r) {
            if ($r == $role) {
                $hasRole = true;

                break;
            }
        }

        return $hasRole;
    }
public function hasRoleForUser ( $ name , $ role ) { $ roles = $ this -> getRolesForUser ( $ name ) ; $ hasRole = false ; foreach ( $ roles as $ r ) { if ( $ r == $ role ) { $ hasRole = true ; break ; } } return $ hasRole ; }
determines whether a user has a role.

@param string $name
@param string $role

@return bool
determines whether a user has a role .