當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。