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


PHP ServiceProvider::register方法代码示例

本文整理汇总了PHP中Illuminate\Support\ServiceProvider::register方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceProvider::register方法的具体用法?PHP ServiceProvider::register怎么用?PHP ServiceProvider::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\ServiceProvider的用法示例。


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

示例1: it_registers_the_purge_command_mock

 /**
  * @test
  * @group unit
  */
 public function it_registers_the_purge_command_mock()
 {
     $this->application_mock->shouldReceive('make')->once()->with(PurgeCommand::class)->andReturn($this->purge_command_mock);
     $this->application_mock->shouldReceive('singleton')->once()->withArgs(['command.garbageman.purge', Mockery::on(function ($closure) {
         $this->assertInstanceOf(PurgeCommand::class, $closure($this->application_mock));
         return true;
     })])->andReturnNull();
     $this->assertNull($this->service_provider->register());
 }
开发者ID:ifpingram,项目名称:laravel-garbage-man,代码行数:13,代码来源:GarbageManServiceProviderTest.php

示例2: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     // Configure any bindings that are version dependent
     $this->provider->register();
     // Let the IoC container be able to make a Symfony event dispatcher
     $this->app->bind('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', 'Symfony\\Component\\EventDispatcher\\EventDispatcher');
     // Setup default configurations for the GoogleMoviesClient Client
     $this->app->singleton('GoogleMoviesClient\\Client', function () {
         $config = $this->provider->config();
         $options = $config['options'];
         // Use an Event Dispatcher that uses the Laravel event dispatcher
         $options['event_dispatcher'] = $this->app->make('GoogleMoviesClient\\Laravel\\Adapters\\EventDispatcherAdapter');
         return new Client($options);
     });
 }
开发者ID:okaufmann,项目名称:google-movies-client-laravel,代码行数:20,代码来源:GoogleMoviesClientServiceProvider.php

示例3: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     // Configure any bindings that are version dependent
     $this->provider->register();
     // Let the IoC container be able to make a Symfony event dispatcher
     $this->app->bind('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', 'Symfony\\Component\\EventDispatcher\\EventDispatcher');
     // Setup default configurations for the Tmdb Client
     $this->app->singleton('Tmdb\\Client', function () {
         $config = $this->provider->config();
         $options = $config['options'];
         // Use an Event Dispatcher that uses the Laravel event dispatcher
         $options['event_dispatcher'] = $this->app->make('Tmdb\\Laravel\\Adapters\\EventDispatcherAdapter');
         // Register the client using the key and options from config
         $token = new ApiToken($config['api_key']);
         return new Client($token, $options);
     });
     // bind the configuration (used by the image helper)
     $this->app->bind('Tmdb\\Model\\Configuration', function () {
         $configuration = $this->app->make('Tmdb\\Repository\\ConfigurationRepository');
         return $configuration->load();
     });
 }
开发者ID:okaufmann,项目名称:laravel,代码行数:27,代码来源:TmdbServiceProvider.php

示例4: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     return $this->provider->register();
 }
开发者ID:jelovac,项目名称:bitly4laravel,代码行数:9,代码来源:Bitly4laravelServiceProvider.php

示例5: register

 /**
  * Register a service provider with the application.
  *
  * @param  Illuminate\Support\ServiceProvider  $provider
  * @param  array  $options
  * @return void
  */
 public function register(ServiceProvider $provider, $options = array())
 {
     $provider->register();
     // Once we have registered the service we will iterate through the options
     // and set each of them on the application so they will be available on
     // the actual loading of the service objects and for developer usage.
     foreach ($options as $key => $value) {
         $this[$key] = $value;
     }
     $this->serviceProviders[] = $provider;
     $this->loadedProviders[get_class($provider)] = true;
 }
开发者ID:defra91,项目名称:levecchiecredenze.it,代码行数:19,代码来源:Application.php

示例6: testItDoesNothingInTheRegisterMethod

 /**
  * @test
  */
 public function testItDoesNothingInTheRegisterMethod()
 {
     $this->assertNull($this->serviceProvider->register());
 }
开发者ID:neondigital,项目名称:laravel-view-presenter,代码行数:7,代码来源:ViewPresenterServiceProviderTest.php

示例7: register

 /**
  * Register a service provider with the application
  */
 public function register(ServiceProvider $service)
 {
     $this->services[] = $service;
     $service->register();
 }
开发者ID:efracuadras,项目名称:slimgeek,代码行数:8,代码来源:Application.php

示例8: testRegisterMethod

 /**
  * @test
  */
 public function testRegisterMethod()
 {
     $this->applicationMock->shouldReceive('singleton')->once()->andReturn([]);
     $this->applicationMock->shouldReceive('bind')->once()->andReturn([]);
     $this->serviceProvider->register();
 }
开发者ID:neondigital,项目名称:laravel-locale,代码行数:9,代码来源:LocaleServiceProviderTest.php


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