當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。