![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/laminas/laminas-view/src/Helper/ |
<?php declare(strict_types=1); namespace Laminas\View\Helper; use Laminas\Authentication\AuthenticationServiceInterface; use Laminas\View\Exception\RuntimeException; /** * View helper plugin to fetch the authenticated identity. */ class Identity extends AbstractHelper { use DeprecatedAbstractHelperHierarchyTrait; /** @var AuthenticationServiceInterface|null */ protected $authenticationService; public function __construct(?AuthenticationServiceInterface $authenticationService = null) { $this->authenticationService = $authenticationService; } /** * Retrieve the current identity, if any. * * If none available, returns null. * * @return mixed|null */ public function __invoke() { $service = $this->authenticationService; if (! $service instanceof AuthenticationServiceInterface) { throw new RuntimeException('No AuthenticationServiceInterface instance provided'); } return $service->hasIdentity() ? $service->getIdentity() : null; } /** * Set AuthenticationService instance * * @deprecated since >= 2.20.0. The authentication service should be provided to the constructor. This method will * be removed in version 3.0 of this component * * @return $this */ public function setAuthenticationService(AuthenticationServiceInterface $authenticationService) { $this->authenticationService = $authenticationService; return $this; } /** * Get AuthenticationService instance * * @deprecated since >= 2.20.0. The authentication service should be provided to the constructor. This method will * be removed in version 3.0 of this component * * @return null|object */ public function getAuthenticationService() { return $this->authenticationService; } }