public function getIdentity(): ?IdentityInterface
    {
        if (!$this->identity) {
            // check user agent
            if (Session::get('auth:agent') === Request::getServer('HTTP_USER_AGENT')) {
                $this->identity = Session::get('auth:identity');
            } else {
                $this->clearIdentity();
            }
        }
        return $this->identity;
    }
public function getIdentity(): ?IdentityInterface
    {
        if (!$this->identity) {
            // check user agent
            if (Session::get('auth:agent') === Request::getServer('HTTP_USER_AGENT')) {
                $this->identity = Session::get('auth:identity');
            } else {
                $this->clearIdentity();
            }
        }
        return $this->identity;
    }
public function getIdentity ( ) : ? IdentityInterface { if ( ! $ this -> identity ) { // check user agent if ( Session :: get ( 'auth:agent' ) === Request :: getServer ( 'HTTP_USER_AGENT' ) ) { $ this -> identity = Session :: get ( 'auth:identity' ) ; } else { $ this -> clearIdentity ( ) ; } } return $ this -> identity ; }
Return identity if user agent is correct

@return IdentityInterface|null
Return identity if user agent is correct