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


PHP ContainerInterface::initialized方法代碼示例

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


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

示例1: resetDynamicSettings

 /**
  * Ensure that dynamic settings are correctly reset,
  * so that services that rely on those are correctly updated.
  */
 private function resetDynamicSettings()
 {
     // Ensure to reset services that need to be.
     foreach ($this->resettableServiceIds as $serviceId) {
         if (!$this->container->initialized($serviceId)) {
             continue;
         }
         $this->container->set($serviceId, null);
     }
     // Update services that can be updated.
     foreach ($this->updatableServices as $serviceId => $methodCalls) {
         if (!$this->container->initialized($serviceId)) {
             continue;
         }
         $service = $this->container->get($serviceId);
         foreach ($methodCalls as $callConfig) {
             list($method, $expression) = $callConfig;
             $argument = $this->expressionLanguage->evaluate($expression, ['container' => $this->container]);
             call_user_func_array([$service, $method], [$argument]);
         }
     }
 }
開發者ID:emodric,項目名稱:ezpublish-kernel,代碼行數:26,代碼來源:DynamicSettingsListener.php

示例2: findRealTransport

 /**
  * Returns a real transport used to send mails by a mailer specified in the constructor of this class
  *
  * @return \Swift_Transport|null
  */
 protected function findRealTransport()
 {
     $realTransport = null;
     $mailers = array_keys($this->container->getParameter('swiftmailer.mailers'));
     foreach ($mailers as $name) {
         if ($this->container instanceof IntrospectableContainerInterface && !$this->container->initialized(sprintf('swiftmailer.mailer.%s', $name))) {
             continue;
         }
         $mailer = $this->container->get(sprintf('swiftmailer.mailer.%s', $name));
         if ($mailer === $this->baseMailer) {
             $realTransport = $this->container->get(sprintf('swiftmailer.mailer.%s.transport.real', $name));
             break;
         }
     }
     return $realTransport;
 }
開發者ID:ramunasd,項目名稱:platform,代碼行數:21,代碼來源:DirectMailer.php

示例3: persistServices

 /**
  * Moves persistent service instances into a new container.
  */
 protected function persistServices(ContainerInterface $container, array $persist)
 {
     foreach ($persist as $id => $object) {
         // Do not override services already set() on the new container, for
         // example 'service_container'.
         if (!$container->initialized($id)) {
             $container->set($id, $object);
         }
     }
 }
開發者ID:Nikola-xiii,項目名稱:d8intranet,代碼行數:13,代碼來源:DrupalKernel.php

示例4: testInitializedForAliases

 /**
  * Tests that Container::initialized works correctly for aliases.
  *
  * @covers ::initialized
  */
 public function testInitializedForAliases()
 {
     $this->assertFalse($this->container->initialized('late.service_alias'), 'Late service is not initialized.');
     $this->container->get('late.service');
     $this->assertTrue($this->container->initialized('late.service_alias'), 'Late service is initialized after it was retrieved once.');
 }
開發者ID:papillon-cendre,項目名稱:d8,代碼行數:11,代碼來源:ContainerTest.php


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