/** * 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(); */ 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; }
/** * Queries whether or not the login module has the passed control flag or not. * * @param \AppserverIo\Lang\String $controlFlag TRUE if the login module has the control flag, else FALSE * * @return boolean TRUE if the passed control flag matches, else FALSE */ public function hasControlFlag(string $controlFlag) { return $this->controlFlag->equals($controlFlag); }