• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Container\Container类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Container类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: resolve

 /**
  * Resolve an instance of the given seeder class.
  *
  * @param  string  $class
  * @return \Illuminate\Database\Seeder
  */
 protected function resolve($class)
 {
     if (isset($this->container)) {
         $instance = $this->container->make($class);
         return $instance->setContainer($this->container)->setCommand($this->command);
     } else {
         return new $class();
     }
 }
开发者ID:homexxhh,项目名称:iot-rest,代码行数:15,代码来源:Seeder.php


示例14: createContainer

 protected function createContainer()
 {
     $container = new Container();
     $container->instance('array_iterator', new \ArrayIterator(range(1, 5)));
     $container->bind('error', function () {
         throw new \RuntimeException();
     });
     return new LaravelContainerAdapter($container);
 }
开发者ID:hoesler,项目名称:acclimate-container,代码行数:9,代码来源:LaravelContainerAdapterTest.php


示例15: bindWarkhamClasses

 /**
  * Bind the Warkham classes to the Container
  *
  * @param Container $app
  *
  * @return Container
  */
 public function bindWarkhamClasses(Container $app)
 {
     $app->singleton('warkham', function ($app) {
         $methodDispatcher = array('Warkham\\Fields\\', Warkham::FIELDSPACE);
         $methodDispatcher = new MethodDispatcher($app, $methodDispatcher);
         return new Warkham($app, $methodDispatcher);
     });
     return $app;
 }
开发者ID:dvlpp,项目名称:warkham,代码行数:16,代码来源:WarkhamServiceProvider.php


示例16: it_can_retrieve_dynamic_objects_from_the_container

 /** @test */
 public function it_can_retrieve_dynamic_objects_from_the_container()
 {
     $container = new Container();
     $container->bind('foo', function () {
         return 'bar';
     });
     $handler = new EventHandlerStub($container);
     $this->assertSame('bar', $handler->foo);
 }
开发者ID:mycrazydog,项目名称:mm-shibboleth,代码行数:10,代码来源:EventHandlerTest.php


示例17: bindings

 /**
  * @param Container $app
  * @param array     $providers
  */
 private function bindings(Container &$app, array $providers)
 {
     Collection::make($providers)->map(function ($provider) use($app) {
         return $app->make($provider, [$app]);
     })->filter(function ($object) {
         return is_a($object, ServiceProvider::class);
     })->each(function (ServiceProvider $provider) {
         $provider->register();
     });
 }
开发者ID:Zae,项目名称:wp-vulnerabilities,代码行数:14,代码来源:Scanner.php


示例18: __construct

 public function __construct(array $attributes)
 {
     $this->encrypter = new Encrypter('088409730f085dd15e8e3a7d429dd185', 'AES-256-CBC');
     $app = new Container();
     $app->singleton('app', 'Illuminate\\Container\\Container');
     $app->singleton('config', 'Illuminate\\Config\\Repository');
     $app['config']->set('elocrypt.prefix', '__ELOCRYPT__:');
     Facade::setFacadeApplication($app);
     parent::__construct($attributes);
 }
开发者ID:delatbabel,项目名称:elocryptfive,代码行数:10,代码来源:DummyModel.php


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Auth\Authenticatable类代码示例发布时间:2022-05-23
下一篇:
PHP Scheduling\Schedule类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap