当前位置: 首页>>代码示例>>PHP>>正文


PHP PluginManager::getServiceLocator方法代码示例

本文整理汇总了PHP中Zend\Mvc\Controller\PluginManager::getServiceLocator方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::getServiceLocator方法的具体用法?PHP PluginManager::getServiceLocator怎么用?PHP PluginManager::getServiceLocator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mvc\Controller\PluginManager的用法示例。


在下文中一共展示了PluginManager::getServiceLocator方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __invoke

 /**
  * __invoke
  *
  * Create the identity controller plugin.
  *
  * @param PluginManager  $controllerPluginManager  The controller plugin manager.
  * @param string         $name                     The name of the service being created.
  * @param string         $requestedName            The requested name of the service being created.
  *
  * @return Identity
  */
 public function __invoke(PluginManager $controllerPluginManager, $name, $requestedName)
 {
     /** @var ServiceManager $serviceManager */
     $serviceManager = $controllerPluginManager->getServiceLocator();
     $options = $this->getOptions($serviceManager, $requestedName);
     if (empty($options['auth_service'])) {
         throw new ServiceNotCreatedException(sprintf('The required \'auth_service\' configuration option for service \'%s\' could not be found in \'%s\'.', $requestedName, __METHOD__));
     }
     /** @var AuthenticationServiceInterface $authenticationService */
     $authenticationService = $serviceManager->get($options['auth_service']);
     return new Identity($authenticationService);
 }
开发者ID:alex-patterson-webdev,项目名称:arp-auth,代码行数:23,代码来源:IdentityFactory.php

示例2: testNonArrayListenerDoesNotRaiseErrorWhenPluginDispatchsRequestedController

 /**
  * @group 5432
  */
 public function testNonArrayListenerDoesNotRaiseErrorWhenPluginDispatchsRequestedController()
 {
     $services = $this->plugins->getServiceLocator();
     $events = $services->get('EventManager');
     $sharedEvents = $this->getMock('Zend\\EventManager\\SharedEventManagerInterface');
     $sharedEvents->expects($this->any())->method('getListeners')->will($this->returnValue(array(new CallbackHandler(function ($e) {
     }))));
     $events = $this->getMock('Zend\\EventManager\\EventManagerInterface');
     $events->expects($this->any())->method('getSharedManager')->will($this->returnValue($sharedEvents));
     $application = $this->getMock('Zend\\Mvc\\ApplicationInterface');
     $application->expects($this->any())->method('getEventManager')->will($this->returnValue($events));
     $event = $this->controller->getEvent();
     $event->setApplication($application);
     $result = $this->plugin->dispatch('forward');
     $this->assertInternalType('array', $result);
     $this->assertEquals(array('content' => 'ZendTest\\Mvc\\Controller\\TestAsset\\ForwardController::testAction'), $result);
 }
开发者ID:noopable,项目名称:zf2,代码行数:20,代码来源:ForwardTest.php

示例3: __construct

 public function __construct(PluginManager $pluginManager)
 {
     $this->serviceLocator = $pluginManager->getServiceLocator();
 }
开发者ID:CerebroVasconcelos,项目名称:zf2Plugin,代码行数:4,代码来源:ControllerPluginManager.php

示例4: factory

 /**
  * @param ControllerManager $controllerManager
  * @return Mailer
  */
 public static function factory(ControllerManager $controllerManager)
 {
     return new static($controllerManager->getServiceLocator());
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:8,代码来源:Mailer.php

示例5: factory

 /**
  * @param ControllerManager $controllerManager
  * @return \Auth\Controller\Plugin\LoginFilter
  */
 public static function factory(ControllerManager $controllerManager)
 {
     return new static($controllerManager->getServiceLocator()->get('Auth/LoginFilter'));
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:8,代码来源:LoginFilter.php

示例6: getServiceLocator

 /**
  * @return ServiceLocatorInterface
  */
 public function getServiceLocator()
 {
     return $this->serviceLocator->getServiceLocator();
 }
开发者ID:debranova,项目名称:project,代码行数:7,代码来源:CreateEvaluation.php

示例7: __invoke

 /**
  * @param PluginManager $pluginManager
  * @return GetEntity
  *
  * @throws \Interop\Container\Exception\ContainerException
  */
 public function __invoke(PluginManager $pluginManager) : GetEntity
 {
     /* @var ContainerInterface $container */
     $container = $pluginManager->getServiceLocator();
     return new GetEntity($container->get(EntityManager::class), $container->get(AuthorizationService::class));
 }
开发者ID:interactive-solutions,项目名称:zf-stdlib,代码行数:12,代码来源:GetEntityFactory.php

示例8: __invoke

 public function __invoke(PluginManager $pluginManager)
 {
     return new ValidateIncomingData($pluginManager->getServiceLocator()->get('inputFilterManager'));
 }
开发者ID:interactive-solutions,项目名称:zf-stdlib,代码行数:4,代码来源:ValidateIncomingDataFactory.php


注:本文中的Zend\Mvc\Controller\PluginManager::getServiceLocator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。