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


PHP Factory::setContainer方法代碼示例

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


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

示例1: __construct

 public function __construct()
 {
     $this->instance('container', $this);
     $this->singleton('events', function () {
         return new Dispatcher();
     });
     $this->singleton('files', function () {
         return new Filesystem();
     });
     $this->singleton('blade.compiler', function () {
         return new BladeCompiler($this['files'], $this['view.compiled']);
     });
     $this->singleton('view.engine.resolver', function () {
         $resolver = new EngineResolver();
         $resolver->register('blade', function () {
             return new CompilerEngine($this['blade.compiler'], $this['files']);
         });
         $resolver->register('php', function () {
             return new PhpEngine();
         });
         return $resolver;
     });
     $this->singleton('view.finder', function () {
         return new FileViewFinder($this['files'], $this['view.paths']);
     });
     $this->singleton('view', function () {
         $env = new Factory($this['view.engine.resolver'], $this['view.finder'], $this['events']);
         $env->setContainer($this['container']);
         return $env;
     });
 }
開發者ID:ngangchill,項目名稱:ronin-blade,代碼行數:31,代碼來源:Container.php

示例2: register

 public function register(Container $pimple)
 {
     $pimple['files'] = function () {
         return new Filesystem();
     };
     $pimple['view.engine.resolver'] = function () use($pimple) {
         $resolver = new EngineResolver();
         foreach (['php', 'blade'] as $engine) {
             $this->{'register' . ucfirst($engine) . 'Engine'}($resolver, $pimple);
         }
         return $resolver;
     };
     $pimple['view.finder'] = function () use($pimple) {
         $paths = $pimple['config']['view.paths'];
         return new FileViewFinder($pimple['files'], $paths);
     };
     $pimple['view'] = function () use($pimple) {
         // Next we need to grab the engine resolver instance that will be used by the
         // environment. The resolver will be used by an environment to get each of
         // the various engine implementations such as plain PHP or Blade engine.
         $resolver = $pimple['view.engine.resolver'];
         $finder = $pimple['view.finder'];
         $env = new Factory($resolver, $finder, $pimple['events']);
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $env->setContainer($pimple['container']);
         $env->share('app', $pimple);
         return $env;
     };
 }
開發者ID:skyguest,項目名稱:ecadapter,代碼行數:31,代碼來源:ViewServiceProvider.php

示例3: makeView

 protected function makeView()
 {
     $app = new Container();
     $resolver = new EngineResolver();
     $resolver->register('php', function () {
         return new PhpEngine();
     });
     $finder = new FileViewFinder(new Filesystem(), [realpath(__DIR__)]);
     $dispatcher = (new Dispatcher($app))->setQueueResolver(function () use($app) {
         return $app->make('Illuminate\\Contracts\\Queue\\Factory');
     });
     $env = new Factory($resolver, $finder, $dispatcher);
     $env->setContainer($app);
     $env->share('app', $app);
     return new Illuminate($env);
 }
開發者ID:michaeljennings,項目名稱:carpenter,代碼行數:16,代碼來源:IlluminateViewTest.php

示例4: registerFactory

 /**
  * Register the view environment.
  *
  * @return void
  */
 public function registerFactory()
 {
     $this->app->singleton('view', function ($app) {
         // Next we need to grab the engine resolver instance that will be used by the
         // environment. The resolver will be used by an environment to get each of
         // the various engine implementations such as plain PHP or Blade engine.
         $resolver = $app['view.engine.resolver'];
         $finder = $app['view.finder'];
         $env = new Factory($resolver, $finder, $app['events']);
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $env->setContainer($app);
         $env->share('app', $app);
         return $env;
     });
 }
開發者ID:betes-curieuses-design,項目名稱:ElieJosiePhotographie,代碼行數:22,代碼來源:ViewServiceProvider.php

示例5: setContainer

 /**
  * Set the IoC container instance.
  *
  * @param \Illuminate\Contracts\Container\Container $container
  * @return void 
  * @static 
  */
 public static function setContainer($container)
 {
     \Illuminate\View\Factory::setContainer($container);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:11,代碼來源:_ide_helper.php

示例6: registerFactory

 /**
  * Register the view factory.
  */
 public function registerFactory()
 {
     $resolver = $this->container['view.engine.resolver'];
     $finder = $this->container['view.finder'];
     $factory = new Factory($resolver, $finder, $this->container['events']);
     $factory->setContainer($this->container);
     $this->viewFactory = $factory;
 }
開發者ID:triangle-lab,項目名稱:bitrix-blade,代碼行數:11,代碼來源:Blade.php

示例7: register

 /**
  * @param Container $app
  */
 public function register(Container $app)
 {
     // we only need to do this if Blade views are enabled.
     if ($app['config']['view.blade.enabled']) {
         $app['blade.settings'] = $app['config']['view.blade.defaults'];
         $app['blade.template.paths'] = $app['blade.settings']['template_paths'];
         $app['files'] = function () {
             return new Filesystem();
         };
         $app['view.finder'] = function ($app) {
             return new FileViewFinder(new Filesystem(), $app['blade.template.paths']);
         };
         // create the Blade compiler using Filesystem and cache directory
         $app['blade.compiler'] = function ($app) {
             return new BladeCompiler(new Filesystem(), $app['blade.settings']['cache']);
         };
         // get a blade compiler engine instance
         $app['blade.engine'] = function ($app) {
             return new CompilerEngine($app['blade.compiler']);
         };
         $app['view.engine.resolver'] = function ($app) {
             $resolver = new EngineResolver();
             $resolver->register('php', function () {
                 return new PhpEngine();
             });
             $resolver->register('blade', function () use($app) {
                 return new CompilerEngine($app['blade.compiler'], $app['files']);
             });
             return $resolver;
         };
         $app['blade.factory'] = function ($app) {
             $view_factory = new IlluminateViewFactory($app['view.engine.resolver'], $app['view.finder'], $app['illuminate.events']);
             $view_factory->setContainer($app['nine.container']);
             return $view_factory;
         };
     }
 }
開發者ID:formula9,項目名稱:framework,代碼行數:40,代碼來源:BladeViewServiceProvider.php

示例8: bindIlluminateView

 /**
  * bindIlluminateView
  *
  * @param  Container  $app
  * @param  array      $viewPaths
  * @param  string     $cachePath
  * @return Container
  */
 public function bindIlluminateView(Container $app = null, array $viewPaths = array(), $cachePath)
 {
     if (!$app) {
         $app = new Container();
     }
     $this->ensureIlluminateBase($app);
     $app->bindShared('view.engine.resolver', function (Container $app) {
         $resolver = new EngineResolver();
         $resolver->register('php', function () {
             return new PhpEngine();
         });
         $app->bindShared('blade.compiler', function (Container $app) {
             $cache = $this->illuminateCachePath;
             return new BladeCompiler($app['files'], $cache);
         });
         $resolver->register('blade', function () use($app) {
             return new CompilerEngine($app['blade.compiler'], $app['files']);
         });
         return $resolver;
     });
     $app->bindShared('view.finder', function (Container $app) {
         $paths = $this->illuminateViewPaths;
         return new FileViewFinder($app['files'], $paths);
     });
     $app->bindShared('view', function (Container $app) {
         $env = new ViewFactory($app['view.engine.resolver'], $app['view.finder'], $app['events']);
         $env->setContainer($app);
         return $env;
     });
     return $app;
 }
開發者ID:caffeinated,項目名稱:beverage,代碼行數:39,代碼來源:BindIlluminate.php

示例9: getViewFactory

 /**
  *
  * @return Factory
  */
 protected function getViewFactory()
 {
     $factory = new Factory($this->container['view.engine.resolver'], $this->container['view.finder'], $this->container['events']);
     $factory->setContainer($this->container);
     return $factory;
 }
開發者ID:theneiam,項目名稱:twade,代碼行數:10,代碼來源:Blade.php

示例10: registerViewFactory

 /**
  * Register the view factory. The factory is
  * available in all views.
  */
 protected function registerViewFactory()
 {
     // Register the View Finder first.
     $this->app->singleton('view.finder', function ($container) {
         return new ViewFinder($container['filesystem'], [], ['blade.php', 'scout.php', 'twig', 'php']);
     });
     $this->app->singleton('view', function ($container) {
         $factory = new Factory($container['view.engine.resolver'], $container['view.finder'], $container['events']);
         // Set the container.
         $factory->setContainer($container);
         // Tell the factory to also handle the scout template for backwards compatibility.
         $factory->addExtension('scout.php', 'blade');
         // Tell the factory to handle twig extension files and assign them to the twig engine.
         $factory->addExtension('twig', 'twig');
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $factory->setContainer($container);
         $factory->share('app', $container);
         return $factory;
     });
 }
開發者ID:themosis,項目名稱:framework,代碼行數:26,代碼來源:ViewServiceProvider.php


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