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


PHP Container\Container类代码示例

本文整理汇总了PHP中Illuminate\Container\Container的典型用法代码示例。如果您正苦于以下问题:PHP Container类的具体用法?PHP Container怎么用?PHP Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getContainer

 /**
  * Get the IoC Container
  *
  * @param string $make A dependency to fetch
  *
  * @return Container
  */
 public static function getContainer($make = null)
 {
     if ($make) {
         return static::$container->make($make);
     }
     return static::$container;
 }
开发者ID:julien-c,项目名称:mongovel,代码行数:14,代码来源:Mongovel.php

示例2: register

 /**
  * Bind additional classes to the Container
  *
  * @param Container $app
  *
  * @return void
  */
 public function register(Container $app)
 {
     $app->bind('newrelic', function ($app) {
         return new RocketeerNewrelicConfig($app['config']->get('rocketeer-newrelic::config'));
     });
     return $app;
 }
开发者ID:houseofdross,项目名称:rocketeer-newrelic,代码行数:14,代码来源:RocketeerNewrelic.php

示例3: make

 public function make(RequestContainer $requestContainer, Container $app)
 {
     if ($requestContainer->getId()) {
         return new InstanceQuery($app->make('query_builders'), $requestContainer);
     }
     return new CollectionQuery($app->make('query_builders'), $requestContainer);
 }
开发者ID:indatus,项目名称:ranger,代码行数:7,代码来源:QueryExecuterFactory.php

示例4: createApplicationContainer

 protected function createApplicationContainer()
 {
     $this->app = new \TestContainer();
     $this->app->singleton('config', function () {
         return new \Illuminate\Config\Repository();
     });
     $this->registerConfigure();
     $eventServiceProvider = new \Illuminate\Encryption\EncryptionServiceProvider($this->app);
     $eventServiceProvider->register();
     $eventServiceProvider = new \Illuminate\Events\EventServiceProvider($this->app);
     $eventServiceProvider->register();
     $queueProvider = new \Illuminate\Queue\QueueServiceProvider($this->app);
     $queueProvider->register();
     $sessionProvider = new \Illuminate\Session\SessionServiceProvider($this->app);
     $sessionProvider->register();
     $this->registerDatabase();
     $this->registerCache();
     $couchbaseProvider = new \Ytake\LaravelCouchbase\CouchbaseServiceProvider($this->app);
     $couchbaseProvider->register();
     $couchbaseProvider->boot();
     $this->app->bind(\Illuminate\Container\Container::class, function () {
         return $this->app;
     });
     (new \Illuminate\Events\EventServiceProvider($this->app))->register();
     \Illuminate\Container\Container::setInstance($this->app);
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:26,代码来源:CouchbaseTestCase.php

示例5: register

 /**
  * Bind additional classes to the Container
  *
  * @param Container $app
  *
  * @return void
  */
 public function register(Container $app)
 {
     $app->bind('slack', function ($app) {
         return new Client($app['config']->get('rocketeer-slack::url'));
     });
     return $app;
 }
开发者ID:anahkiasen,项目名称:rocketeer-slack,代码行数:14,代码来源:RocketeerSlack.php

示例6: setupContainer

 /**
  * Setup the IoC container instance.
  *
  * @param  \Illuminate\Container\Container|null  $container
  * @return void
  */
 protected function setupContainer($container)
 {
     $this->container = $container ?: new Container();
     if (!$this->container->bound('config')) {
         $this->container->instance('config', new Fluent());
     }
 }
开发者ID:GeorgeBroadley,项目名称:caffeine-vendor,代码行数:13,代码来源:CapsuleManagerTrait.php

示例7: register

 /**
  * Bind additional classes to the Container
  *
  * @param Container $app
  *
  * @return void
  */
 public function register(Container $app)
 {
     $app->bind('campfire', function ($app) {
         return new Campfire($app['config']->get('rocketeer-campfire::config'));
     });
     return $app;
 }
开发者ID:anahkiasen,项目名称:rocketeer-campfire,代码行数:14,代码来源:RocketeerCampfire.php

示例8: setupServiceProvider

 /**
  * @param Container $app
  *
  * @return AwsServiceProvider
  */
 private function setupServiceProvider(Container $app)
 {
     // Create and register the provider.
     $provider = new AwsServiceProvider($app);
     $app->register($provider);
     $provider->boot();
     return $provider;
 }
开发者ID:nickfan,项目名称:aws-sdk-php-laravel,代码行数:13,代码来源:AwsServiceProviderTest.php

示例9: getContainer

 /**
  * @return \Illuminate\Container\Container
  */
 public static function getContainer()
 {
     if (!self::$container) {
         self::$container = new \Illuminate\Container\Container();
         self::$container->bind('app', self::$container);
     }
     return self::$container;
 }
开发者ID:osotov,项目名称:illuminate-for-bitrix,代码行数:11,代码来源:Container.php

示例10: createContainer

 /**
  * @return ContainerInterface
  */
 private function createContainer(array $map = [])
 {
     $container = new Container();
     foreach ($map as $key => $value) {
         $container->bind($key, $value);
     }
     return new LaravelContainer($container);
 }
开发者ID:bweston92,项目名称:monii-container-interop-laravel,代码行数:11,代码来源:LaravelContainerTest.php

示例11: register

 public function register(Container $app)
 {
     $settings = ['username' => $app['config']->get('rocketeer-slack-unofficial::config')['url'], 'channel' => $app['config']->get('rocketeer-slack-unofficial::config')['channel'], 'link_names' => true, 'icon' => ':rocket:'];
     $app->bind('slack', function ($app) use($settings) {
         return new Client($app['config']->get('rocketeer-slack-unofficial::config')['hook-url'], $settings);
     });
     return $app;
 }
开发者ID:netoholic,项目名称:rocketeer-slack-unofficial,代码行数:8,代码来源:RocketeerSlack.php

示例12: __construct

 /**
  * 初始化,注入container
  *
  * @param Container $container
  */
 public function __construct(Container $container)
 {
     $this->container = $container;
     // 初始化 DB类 TODO 应该用 事件监听的方式来初始化 因为有可能在不需要db的情况下也初始化了
     $container->make('db');
     if (method_exists($this, '__init__')) {
         return call_user_func_array(array($this, '__init__'), array());
     }
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:14,代码来源:Controller.php

示例13: passesAuthorization

 /**
  * Deteremine if the request passes the authorization check.
  *
  * @return bool
  */
 protected function passesAuthorization()
 {
     if (method_exists($this, 'authorize')) {
         return $this->container->call([$this, 'authorize']);
     }
     return false;
 }
开发者ID:AlexCutts,项目名称:framework,代码行数:12,代码来源:FormRequest.php

示例14: driver

 /**
  * Changes the set SMS driver
  *
  * @param $driver
  */
 public function driver($driver)
 {
     $this->container['sms.sender'] = $this->container->share(function ($app) use($driver) {
         return (new DriverManager($app))->driver($driver);
     });
     $this->driver = $this->container['sms.sender'];
 }
开发者ID:Skintillion,项目名称:simple-sms,代码行数:12,代码来源:SMS.php

示例15: call

 /**
  * Call the given seeder.
  *
  * @param  \Closure|string  $seeder
  * @return void
  */
 protected function call($seeder)
 {
     if ($seeder instanceof Closure) {
         return $this->container->call($seeder);
     }
     $this->container->call($seeder, [], 'seed');
 }
开发者ID:coolcodemy,项目名称:bouncer,代码行数:13,代码来源:Seeder.php


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