code: private function getRole($identity = null)
      {
          if (is_object($identity)) {
              return $identity->getRole();
          }
  
          if (is_array($identity) && isset($identity['role'])) {
              return $identity['role'];
          }
  
          return 'guest';
      }
docs: Gets role from user's identity.
  
  @param mixed $identity User's identity. If null, returns role 'guest'
  
  @return string User's role