[李景山php]每天laravel-20160906|Dispatcher-6
2016-06-23 09:01
609 查看
/** * Broadcast the given event class. * * @param \Illuminate\Contracts\Broadcasting\ShouldBroadcast $event * @return void */ protected function broadcastEvent($event) {// why use this function name is broadcast // event class means event instance if ($this->queueResolver) {// use this queueResolver function $connection = $event instanceof ShouldBroadcastNow ? 'sync' : null;// determine this instance about $queue = method_exists($event, 'onQueue') ? $event->onQueue() : null;// determine method_exits $this->resolveQueue()->connection($connection)->pushOn($queue, 'Illuminate\Broadcasting\BroadcastEvent', [ 'event' => serialize(clone $event), ]);// good look bad use ,maybe } } /** * Get all of the listeners for a given event name. * * @param string $eventName * @return array */ public function getListeners($eventName) {// Get all of the listeners for a given event name. $wildcards = $this->getWildcardListeners($eventName);// get the wild card by eventsName use this function ,that name is cardlisters // first use eventName if (! isset($this->sorted[$eventName])) { $this->sortListeners($eventName);// use this sort Listeners }// if isset eventsName never be sort , return array_merge($this->sorted[$eventName], $wildcards);// array_merge } /** * Get the wildcard listeners for the event. * * @param string $eventName * @return array */ protected function getWildcardListeners($eventName) { $wildcards = [];// getWildcardListeners() set the listener foreach ($this->wildcards as $key => $listeners) {// foreach $this->wildcards as key if (Str::is($key, $eventName)) {// determine is a str $wildcards = array_merge($wildcards, $listeners); // get the array_merge } } return $wildcards; } // first get listener,second get the wildcard listener
相关文章推荐
- Android Native 绘图方法
- Ubuntu 下修改 Could not reliably determine the serve
- PHP中return 和 exit 、break和contiue 区别与用法
- javascript 面向对象编程 function是方法(函数)
- javascript 面向对象编程 function也是类
- ASP.NET MVC @Helper辅助方法和@functons自定义函数的使用方法
- IIS下PHP连接数据库提示mysql undefined function mysql_connect()
- 浅谈Javascript中Object与Function对象
- JavaScript通过function定义对象并给对象添加toString()方法实例分析
- IE 当eval遇上function的处理
- JavaScript中Object和Function的关系小结
- Javascript 使用function定义构造函数
- 浅析return false的正确使用
- 关于function类中定义变量this的简单说明
- javascript中return,return true,return false三者的用法及区别
- javascript Object与Function使用
- JavaScript中的Function函数
- 使用Function.apply()的参数数组化来提高 JavaScript程序性能的技巧
- javascript下function声明一些小结
- 常用的javascript function代码