private function getRole($identity = null)
    {
        if (is_object($identity)) {
            return $identity->getRole();
        }

        if (is_array($identity) && isset($identity['role'])) {
            return $identity['role'];
        }

        return 'guest';
    }
private function getRole($identity = null)
    {
        if (is_object($identity)) {
            return $identity->getRole();
        }

        if (is_array($identity) && isset($identity['role'])) {
            return $identity['role'];
        }

        return 'guest';
    }
private function getRole ( $ identity = null ) { if ( is_object ( $ identity ) ) { return $ identity -> getRole ( ) ; } if ( is_array ( $ identity ) && isset ( $ identity [ 'role' ] ) ) { return $ identity [ 'role' ] ; } return 'guest' ; }
Gets role from user's identity.

@param mixed $identity User's identity. If null, returns role 'guest'

@return string User's role
Gets role from user s identity .