/** * 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.
时间: 2024-11-06 07:41:46