PHPソース共有:BusServiceProvider
1612 ワード
<?php
namespace Illuminate\Bus;
use Illuminate\Support\ServiceProvider;
// more namespace has the been used
class BusServiceProvider extends ServiceProvider
{// BusServiceProvider extends the big ServiceProvider
/**
* Indicates if loading of the provider is deferred.
* Indicates if loading of the provider is deferred.
* @var bool
*/
protected $defer = true;// a protected $defer
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton('Illuminate\Bus\Dispatcher', function ($app) {
return new Dispatcher($app, function ($connection = null) use ($app) {
return $app['Illuminate\Contracts\Queue\Factory']->connection($connection);
});
});// big register
$this->app->alias(
'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\Dispatcher'
);// set alias
$this->app->alias(
'Illuminate\Bus\Dispatcher', 'Illuminate\Contracts\Bus\QueueingDispatcher'
);// a set this it is
}
/**
* Get the services provided by the provider.
* get the services provided by the provider.
* @return array
*/
public function provides()
{
return [
'Illuminate\Bus\Dispatcher',
'Illuminate\Contracts\Bus\Dispatcher',
'Illuminate\Contracts\Bus\QueueingDispatcher',
];
}// back this is a return
}