标签:listener return function events
/** * Setup a wildcard listener callback. * * @param string $event * @param mixed $listener * @return void */ protected function setupWildcardListen($event, $listener) { $this->wildcards[$event][] = $this->makeListener($listener); }// this is a wildcard be you life ! // this means is very good, setup the wildcard listener use the events as the key, // and use this function make Listener to wrap this listener /** * Determine if a given event has listeners. * * @param string $eventName * @return bool */ public function hasListeners($eventName) { return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]); }// Determine if a given event has listeners // check it is has listeners ,means to check it has listener or has wildcards /** * Register an event and payload to be fired later. * * @param string $event * @param array $payload * @return void */ public function push($event, $payload = [])// register like push,not like pop { $this->listen($event.‘_pushed‘, function () use ($event, $payload) { $this->fire($event, $payload); });// set the event ,use function listen and fire }// load is loading.... pay buy something for this // goods carried by a large vehicle // a large vehicle has the big goods carried /** * Register an event subscriber with the dispatcher. * * @param object|string $subscriber * @return void */ public function subscribe($subscriber) {// function name is subscribe $subscriber = $this->resolveSubscriber($subscriber);// get the resolve $subscriber->subscribe($this);// too much }// register a use about this event in the dispatcher rule.
本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1790923
[李景山php]每天laravel-20160903|Dispatcher-3
标签:listener return function events
原文地址:http://jingshanls.blog.51cto.com/3357095/1790923