當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ContainerInterface::leaveScope方法代碼示例

本文整理匯總了PHP中Symfony\Component\DependencyInjection\ContainerInterface::leaveScope方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContainerInterface::leaveScope方法的具體用法?PHP ContainerInterface::leaveScope怎麽用?PHP ContainerInterface::leaveScope使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\DependencyInjection\ContainerInterface的用法示例。


在下文中一共展示了ContainerInterface::leaveScope方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getReflectionMethod

 /**
  * Returns the ReflectionMethod for the given controller string.
  *
  * @param string $controller
  * @return \ReflectionMethod|null
  */
 public function getReflectionMethod($controller)
 {
     if (false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
         $controller = $this->controllerNameParser->parse($controller);
     }
     if (preg_match('#(.+)::([\\w]+)#', $controller, $matches)) {
         $class = $matches[1];
         $method = $matches[2];
     } elseif (preg_match('#(.+):([\\w]+)#', $controller, $matches)) {
         $controller = $matches[1];
         $method = $matches[2];
         if ($this->container->has($controller)) {
             $this->container->enterScope('request');
             $this->container->set('request', new Request(), 'request');
             $class = ClassUtils::getRealClass(get_class($this->container->get($controller)));
             $this->container->leaveScope('request');
         }
     }
     if (isset($class) && isset($method)) {
         try {
             return new \ReflectionMethod($class, $method);
         } catch (\ReflectionException $e) {
         }
     }
     return null;
 }
開發者ID:eliberty,項目名稱:api-bundle,代碼行數:32,代碼來源:DocumentationHelper.php

示例2: getReflectionMethod

 /**
  * Returns the ReflectionMethod for the given controller string.
  *
  * @param string $controller
  * @return \ReflectionMethod|null
  */
 public function getReflectionMethod($controller)
 {
     if (preg_match('#(.+)::([\\w]+)#', $controller, $matches)) {
         $class = $matches[1];
         $method = $matches[2];
     } elseif (preg_match('#(.+):([\\w]+)#', $controller, $matches)) {
         $controller = $matches[1];
         $method = $matches[2];
         if ($this->container->has($controller)) {
             $this->container->enterScope('request');
             $this->container->set('request', new Request(), 'request');
             $class = get_class($this->container->get($controller));
             $this->container->leaveScope('request');
         }
     }
     if (isset($class) && isset($method)) {
         try {
             return new \ReflectionMethod($class, $method);
         } catch (\ReflectionException $e) {
         }
     }
     return null;
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:29,代碼來源:ApiDocExtractor.php

示例3: leaveScope

 public function leaveScope()
 {
     if ($this->container->isScopeActive('scenario')) {
         $this->container->leaveScope('scenario');
     }
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:6,代碼來源:ScopeManipulator.php

示例4: leaveScope

 /**
  * {@inheritdoc}
  */
 public function leaveScope($name)
 {
     $this->container->leaveScope($name);
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:7,代碼來源:ContainerProxy.php

示例5: onKernelFinishRequest

 /**
  * Leaves the container scope when finishing the request.
  *
  * @param FinishRequestEvent $event The event object
  */
 public function onKernelFinishRequest(FinishRequestEvent $event)
 {
     if (null !== ($scope = $this->getScopeFromEvent($event))) {
         $this->container->leaveScope($scope);
     }
 }
開發者ID:bytehead,項目名稱:core-bundle,代碼行數:11,代碼來源:ContainerScopeListener.php


注:本文中的Symfony\Component\DependencyInjection\ContainerInterface::leaveScope方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。