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