当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::setDeferredServices方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::setDeferredServices方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::setDeferredServices方法的具体用法?PHP Application::setDeferredServices怎么用?PHP Application::setDeferredServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Foundation\Application的用法示例。


在下文中一共展示了Application::setDeferredServices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Register the application service providers.
  *
  * @param  array  $providers
  * @return void
  */
 public function load(array $providers)
 {
     $manifest = $this->loadManifest();
     // First we will load the service manifest, which contains information on all
     // service providers registered with the application and which services it
     // provides. This is used to know which services are "deferred" loaders.
     if ($this->shouldRecompile($manifest, $providers)) {
         $manifest = $this->compileManifest($providers);
     }
     // If the application is running in the console, we will not lazy load any of
     // the service providers. This is mainly because it's not as necessary for
     // performance and also so any provided Artisan commands get registered.
     if ($this->app->runningInConsole()) {
         $manifest['eager'] = $manifest['providers'];
     }
     // Next, we will register events to load the providers for each of the events
     // that it has requested. This allows the service provider to defer itself
     // while still getting automatically loaded when a certain event occurs.
     foreach ($manifest['when'] as $provider => $events) {
         $this->registerLoadEvents($provider, $events);
     }
     // We will go ahead and register all of the eagerly loaded providers with the
     // application so their services can be registered with the application as
     // a provided service. Then we will set the deferred service list on it.
     foreach ($manifest['eager'] as $provider) {
         $this->app->register($this->createProvider($provider));
     }
     $this->app->setDeferredServices($manifest['deferred']);
 }
开发者ID:devonzara,项目名称:framework,代码行数:35,代码来源:ProviderRepository.php

示例2: load

 /**
  * Register the application service providers.
  *
  * @param  array  $providers
  * @return void
  */
 public function load(array $providers)
 {
     $manifest = $this->loadManifest();
     // First we will load the service manifest, which contains information on all
     // service providers registered with the application and which services it
     // provides. This is used to know which services are "deferred" loaders.
     if ($this->shouldRecompile($manifest, $providers)) {
         //需要重新编译
         $manifest = $this->compileManifest($providers);
     }
     // Next, we will register events to load the providers for each of the events
     // that it has requested. This allows the service provider to defer itself
     // while still getting automatically loaded when a certain event occurs.
     foreach ($manifest['when'] as $provider => $events) {
         $this->registerLoadEvents($provider, $events);
     }
     // We will go ahead and register all of the eagerly loaded providers with the
     // application so their services can be registered with the application as
     // a provided service. Then we will set the deferred service list on it.
     foreach ($manifest['eager'] as $provider) {
         $this->app->register($this->createProvider($provider));
     }
     $this->app->setDeferredServices($manifest['deferred']);
 }
开发者ID:jellycheng,项目名称:learnlaravel,代码行数:30,代码来源:ProviderRepository.php


注:本文中的Illuminate\Contracts\Foundation\Application::setDeferredServices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。