Implement "AuthenticationManagerInterface" in "CheckResolver" class

This commit is contained in:
Dmitriy Simushev 2014-07-04 12:56:48 +00:00
parent 8dbc46145c
commit af112aa72b

View File

@ -21,7 +21,7 @@ use Mibew\Authentication\AuthenticationManagerAwareInterface;
use Mibew\Authentication\AuthenticationManagerInterface; use Mibew\Authentication\AuthenticationManagerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class CheckResolver class CheckResolver implements AuthenticationManagerAwareInterface
{ {
/** /**
* @var AuthenticationManagerInterface|null * @var AuthenticationManagerInterface|null
@ -39,6 +39,22 @@ class CheckResolver
$this->authenticationManager = $manager; $this->authenticationManager = $manager;
} }
/**
* {@inheritdoc}
*/
public function getAuthenticationManager()
{
return $this->authenticationManager;
}
/**
* {@inheritdoc}
*/
public function setAuthenticationManager(AuthenticationManagerInterface $manager)
{
$this->authenticationManager = $manager;
}
/** /**
* Resolves access check callable by request. * Resolves access check callable by request.
* *
@ -63,7 +79,7 @@ class CheckResolver
if (method_exists($access_check, '__invoke')) { if (method_exists($access_check, '__invoke')) {
$object = new $access_check(); $object = new $access_check();
if ($object instanceof AuthenticationManagerAwareInterface) { if ($object instanceof AuthenticationManagerAwareInterface) {
$object->setAuthenticationManager($this->authenticationManager); $object->setAuthenticationManager($this->getAuthenticationManager());
} }
return $object; return $object;
@ -115,7 +131,7 @@ class CheckResolver
$object = new $class(); $object = new $class();
if ($object instanceof AuthenticationManagerAwareInterface) { if ($object instanceof AuthenticationManagerAwareInterface) {
$object->setAuthenticationManager($this->authenticationManager); $object->setAuthenticationManager($this->getAuthenticationManager());
} }
return array($object, $method); return array($object, $method);