ZfcRbac\Factory\AuthorizationServiceDelegatorFactory::createDelegatorWithName PHP Method

createDelegatorWithName() public method

public createDelegatorWithName ( Zend\ServiceManager\ServiceLocatorInterface $serviceLocator, string $name, string $requestedName, callable $callback ) : mixed
$serviceLocator Zend\ServiceManager\ServiceLocatorInterface
$name string
$requestedName string
$callback callable
return mixed
    public function createDelegatorWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName, $callback)
    {
        return $this($serviceLocator, $requestedName, $callback);
    }

Usage Example

 public function testDelegatorFactory()
 {
     $authServiceClassName = 'ZfcRbac\\Service\\AuthorizationService';
     $delegator = new AuthorizationServiceDelegatorFactory();
     $serviceLocator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface');
     $authorizationService = $this->getMock('ZfcRbac\\Service\\AuthorizationService', [], [], '', false);
     $callback = function () {
         return new AuthorizationAwareFake();
     };
     $serviceLocator->expects($this->once())->method('get')->with($authServiceClassName)->will($this->returnValue($authorizationService));
     $decoratedInstance = $delegator->createDelegatorWithName($serviceLocator, 'name', 'requestedName', $callback);
     $this->assertEquals($authorizationService, $decoratedInstance->getAuthorizationService());
 }
All Usage Examples Of ZfcRbac\Factory\AuthorizationServiceDelegatorFactory::createDelegatorWithName
AuthorizationServiceDelegatorFactory