namespace illuminate\events;use exception;use reflectionclass;use illuminate\support\str; use illuminate\container\container;use illuminate\contracts\broadcasting\shouldbroadcast;use Illuminate\contracts\broadcasting\shouldbroadcastnow;use illuminate\contracts\events\dispatcher as dispatchercontract;use illuminate\contracts\container\container as containercontract;// use namespaceclass Dispatcher implements DispatcherContract{// a dispatcher implements dispatcher contract /** * The IoC container instance. * * @var \Illuminate\Contracts\Container\Container */ protected $container;// the ioc container instance. /** * the registered event listeners. * * @var array */ protected $ listeners = [];// listeners be registered /** * The wildcard listeners. * * @var array */ protected $ wildcards = [];// the wildcard listeners. like store /** * The sorted event listeners. * * @var array */ protected $sorted = [];// The sorted event listeners. /** * the event firing stack. * * @var array */ protected $firing = [];//The event firing stack. /** * The queue resolver instance. * * @var callable */ protected $ queueresolver;// the queue resolver instance. // at last , we find to instance ,some listeners /** * Create a new event dispatcher instance. * * @param \illuminate\contracts\container\container|null $container   &Nbsp; * @return void */ // dispathcer is use to make it like you want public Function __construct (containercontract $container = null) { $this->container = $container ?: new container; }// containercontract is $contanier
This article is from the "Focus on PHP" blog, please be sure to keep this source http://jingshanls.blog.51cto.com/3357095/1789766
[Li Jingshan php] every day laravel-20160901| Dispatcher-1