public function equals(PrincipalInterface $another)
    {

        // query whether or not another principal has been passed
        if ($another instanceof PrincipalInterface) {
            $anotherName = $another->getName();
            $equals = false;
            if ($this->name == null) {
                $equals = $anotherName == null;
            } else {
                $equals = $this->name->equals($anotherName);
            }

            // return the flag if the both are equal
            return $equals;
        }

        // return FALSE if they are not equal
        return false;
    }
public function equals(PrincipalInterface $another)
    {

        // query whether or not another principal has been passed
        if ($another instanceof PrincipalInterface) {
            $anotherName = $another->getName();
            $equals = false;
            if ($this->name == null) {
                $equals = $anotherName == null;
            } else {
                $equals = $this->name->equals($anotherName);
            }

            // return the flag if the both are equal
            return $equals;
        }

        // return FALSE if they are not equal
        return false;
    }
public function equals ( PrincipalInterface $ another ) { // query whether or not another principal has been passed if ( $ another instanceof PrincipalInterface ) { $ anotherName = $ another -> getName ( ) ; $ equals = false ; if ( $ this -> name == null ) { $ equals = $ anotherName == null ; } else { $ equals = $ this -> name -> equals ( $ anotherName ) ; } // return the flag if the both are equal return $ equals ; } // return FALSE if they are not equal return false ; }
Compare this SimplePrincipal's name against another Principal.

@param \AppserverIo\Psr\Security\PrincipalInterface $another The other principal to compare to

@return boolean TRUE if name equals $another->getName();
Compare this SimplePrincipal s name against another Principal .