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


PHP static::container方法代碼示例

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


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

示例1: container

 /**
  * [container description]
  * @return [type] [description]
  */
 public static function container()
 {
     if (is_null(static::$container)) {
         static::$container = new Feed();
     }
     return static::$container;
 }
開發者ID:Webeleven,項目名稱:google-shopping-feed,代碼行數:11,代碼來源:GoogleShopping.php

示例2: init

 /**
  * @throws \Exception
  */
 protected function init()
 {
     $this->setEnvironment();
     // Load class aliases
     $aliases = Config::get('aliases');
     foreach ($aliases as $orig => $new) {
         class_alias($orig, $new, true);
     }
     static::$container = new Container();
     Session::init();
     Request::init();
     $this->initRouter();
     $databaseConfig = Config::get('database');
     if ($databaseConfig !== null && is_array($databaseConfig)) {
         $this->capsule = new Capsule();
         foreach ($databaseConfig as $name => $conf) {
             if (array_key_exists('name', $conf) && strlen($conf['name']) > 0) {
                 $name = $conf['name'];
                 unset($conf['name']);
             }
             $this->capsule->addConnection($conf, $name);
         }
         $this->capsule->bootEloquent();
     }
     $hookConfig = Config::get('hooks');
     if (is_array($hookConfig)) {
         foreach ($hookConfig as $event => $callable) {
             EventHandler::addListener($event, $callable);
         }
     }
     EventHandler::triggerEvent('whirlpool-initialized', $this);
 }
開發者ID:mirfan,項目名稱:Whirlpool,代碼行數:35,代碼來源:Whirlpool.php

示例3: __construct

 public function __construct(array $values = array())
 {
     parent::__construct($values);
     if (is_null(static::$container)) {
         static::$container = $this;
     }
 }
開發者ID:pokmot,項目名稱:pimple-singleton,代碼行數:7,代碼來源:Container.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     static::$client = static::createClient();
     static::$router = self::$client->getContainer()->get('router');
     static::$em = self::$client->getContainer()->get('doctrine.orm.entity_manager');
     static::$container = self::getContainer();
 }
開發者ID:bzis,項目名稱:zomba,代碼行數:7,代碼來源:TestCase.php

示例5: __construct

 /**
  * __construct function.
  * 
  * @access public
  * @param mixed $name (default: null)
  * @return void
  */
 public function __construct($name = null)
 {
     parent::__construct($name);
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$container = static::$kernel->getContainer();
 }
開發者ID:videni,項目名稱:MEFSocketBundle,代碼行數:14,代碼來源:ApplicationTestCase.php

示例6: forget

 public static function forget()
 {
     $cookie = Config::get('session.cookie');
     static::$container = [];
     setcookie(static::$name, '', time() - 3600, $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
     unset($_COOKIE[static::$name]);
 }
開發者ID:ramee,項目名稱:alien-framework,代碼行數:7,代碼來源:Session.php

示例7: register

 /**
  * Registers services to the container.
  *
  * @param ContainerBuilder $container
  *   The ContainerBuilder to register services to.
  */
 public function register(ContainerBuilder $container)
 {
     static::$container = $container;
     $class_map = $this->AutoloaderInit();
     $ns = [];
     foreach ($class_map as $name => $path) {
         $path = preg_replace("/\\.php\$/i", '', $path);
         $path = explode(DIRECTORY_SEPARATOR, $path);
         $name = explode('\\', $name);
         while (end($path) === end($name)) {
             array_pop($path);
             array_pop($name);
         }
         $path = implode(DIRECTORY_SEPARATOR, $path);
         $name = implode('\\', $name);
         if (is_dir($path)) {
             if (is_dir($path . '/Plugin') || is_dir($path . '/Entity') || is_dir($path . '/Element')) {
                 $ns[$name][] = $path;
             }
         }
     }
     foreach ($ns as $name => $path) {
         $path = array_unique($path);
         $ns[$name] = count($path) == 1 ? reset($path) : $path;
     }
     $ns += $container->getParameter('container.namespaces');
     $container->setParameter('container.namespaces', $ns);
     $yaml_loader = new YamlFileLoader($container);
     foreach (static::getFiles('/^.+\\.services\\.yml$/i') as $file) {
         $yaml_loader->load($file);
     }
 }
開發者ID:d-f-d,項目名稱:d_submodules,代碼行數:38,代碼來源:DSubmodulesServiceProvider.php

示例8: getContainer

 /**
  * Gets container instance
  * @return object
  */
 private static function getContainer()
 {
     if (!static::$container) {
         static::$container = Container::getInstance();
     }
     return static::$container;
 }
開發者ID:hungrylab,項目名稱:binocle-framework,代碼行數:11,代碼來源:Facade.php

示例9: foreach

 /**
  * @implement route_alter_variants
  * @fast
  */
 static function route_alter_variants()
 {
     $alters = [];
     static::$container = \Drupal::getContainer();
     foreach (static::getFiles('/^.+\\.routing\\.yml/i') as $file) {
         $info = static::yamlDecode($file)['alter_variants'] ?? [];
         $alters = NestedArray::mergeDeep($alters, $info);
     }
     foreach ($alters as $name => $variants) {
         foreach ($variants as $k => $variant) {
             if (isset($variant['cache'])) {
                 $variant['controller'] = new CacheController($variant['cache'], $variant['controller']);
                 unset($variant['cache']);
             }
             if (isset($variant['redirect'])) {
                 $variant['controller'] = new RedirectController($variant['redirect']);
                 unset($variant['redirect']);
             }
             if (isset($variant['error'])) {
                 $variant['controller'] = new ErrorController($variant['error']);
                 unset($variant['error']);
             }
             if (is_string($variant)) {
                 $variant = ['controller' => $variant];
             }
             if (isset($variant['controller']) && is_string($variant['controller']) && strpos($variant['controller'], '::') !== FALSE) {
                 $variant['controller'] = explode('::', $variant['controller']);
             }
             static::appliesRuleDetect($variant);
             $variants[$k] = $variant;
         }
         $alters[$name] = static::sortByPriority($variants);
     }
     return $alters;
 }
開發者ID:d-f-d,項目名稱:d_submodules,代碼行數:39,代碼來源:RouteAlterLoader.php

示例10: __construct

 private function __construct()
 {
     static::$instance = $this;
     static::$container = Forge::getInstance();
     $this->installErrorHandling();
     $this->detectEnvironment();
 }
開發者ID:formula9,項目名稱:framework,代碼行數:7,代碼來源:ConsoleFactory.php

示例11: submoduleLibraryInfo

 /**
  * @implement submodule_library_info
  * @fast
  */
 static function submoduleLibraryInfo()
 {
     static $libraries = [];
     if ($libraries) {
         return $libraries;
     }
     static::$container = Drupal::getContainer();
     foreach (static::getFiles('/^.+\\.libraries\\.yml/i') as $file) {
         $name_prefix = str_replace('.libraries.yml', '', basename($file));
         $path = dirname($file);
         $info = self::yamlDecode($file);
         foreach ($info as $name => $library) {
             $library += ['js' => [], 'css' => []];
             $src = [&$library['js']];
             foreach (array_keys($library['css']) as $key) {
                 $src[] =& $library['css'][$key];
             }
             foreach ($src as $src_index => $src_type) {
                 foreach ($src_type as $source => $data) {
                     if ($source[0] !== '/' && file_exists($path . '/' . $source)) {
                         $src[$src_index]['/' . $path . '/' . $source] = $data;
                         unset($src[$src_index][$source]);
                     }
                 }
             }
             $libraries[$name_prefix][$name] = $library;
         }
     }
     return $libraries;
 }
開發者ID:d-f-d,項目名稱:d_submodules,代碼行數:34,代碼來源:LibraryLoader.php

示例12: initKernel

 private static function initKernel()
 {
     static::$kernel = static::createKernel();
     static::$kernel->boot();
     static::$container = static::$kernel->getContainer();
     static::$doctrine = static::$container->get('doctrine');
     static::$om = static::$doctrine->getManager();
 }
開發者ID:eugene-matvejev,項目名稱:battleship-game-api,代碼行數:8,代碼來源:AbstractKernelTestSuite.php

示例13: instantiateServiceContainer

 /**
  * Instantiate service container if it's not instantiated yet.
  */
 protected static function instantiateServiceContainer()
 {
     $container = Container::getInstance();
     if (!$container) {
         $container = new Container();
         Container::setInstance($container);
     }
     static::$container = $container;
 }
開發者ID:triangle-lab,項目名稱:bitrix-blade,代碼行數:12,代碼來源:BladeProvider.php

示例14: tearDown

 /**
  * {@inheritdoc}
  */
 protected function tearDown()
 {
     $this->rollbackTransaction();
     BaseWebTestCase::tearDown();
     static::$client = null;
     static::$container = null;
     static::$kernel = null;
     $this->cleanFixtures();
 }
開發者ID:ruslan-polutsygan,項目名稱:dev-bundle,代碼行數:12,代碼來源:DatabaseTestCase.php

示例15: __construct

 /**
  * Forge is a final Singleton.
  *
  * The Forge requires the illuminate/container for compatibility.
  * Although the constructor exposes the dependency and auto-instantiates
  * the illuminate/container, the option is provided to instantiate the
  * illuminate/container outside of the Forge.
  *
  * @param IlluminateContainer $container
  */
 public function __construct(IlluminateContainer $container = NULL)
 {
     if (!static::$instance) {
         static::$container = $container ?: new IlluminateContainer();
         static::$instance = $this;
         $this->register_aliases();
     }
     return static::$instance;
 }
開發者ID:anctemarry27,項目名稱:cogs,代碼行數:19,代碼來源:Forge.php


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