当前位置: 首页>>代码示例>>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;未经允许,请勿转载。