[Li Jingshan php]daily laravel-20160906|Dispatcher-6
<code><span>/** * Broadcast the given event class. * *<span> @param</span> \Illuminate\Contracts\Broadcasting\ShouldBroadcast $event *<span> @return</span> void */</span><span>protected</span><span><span>function</span><span>broadcastEvent</span><span>(<span>$event</span>)</span> {</span><span>// why use this function name is broadcast</span><span>// event class means event instance</span><span>if</span> (<span>$this</span>->queueResolver) {<span>// use this queueResolver function</span><span>$connection</span> = <span>$event</span><span>instanceof</span> ShouldBroadcastNow ? <span>'sync'</span> : <span>null</span>;<span>// determine this instance about</span><span>$queue</span> = method_exists(<span>$event</span>, <span>'onQueue'</span>) ? <span>$event</span>->onQueue() : <span>null</span>;<span>// determine method_exits</span><span>$this</span>->resolveQueue()->connection(<span>$connection</span>)->pushOn(<span>$queue</span>, <span>'Illuminate\Broadcasting\BroadcastEvent'</span>, [ <span>'event'</span> => serialize(<span>clone</span><span>$event</span>), ]);<span>// good look bad use ,maybe</span> } } <span>/** * Get all of the listeners for a given event name. * *<span> @param</span> string $eventName *<span> @return</span> array */</span><span>public</span><span><span>function</span><span>getListeners</span><span>(<span>$eventName</span>)</span> {</span><span>// Get all of the listeners for a given event name.</span><span>$wildcards</span> = <span>$this</span>->getWildcardListeners(<span>$eventName</span>);<span>// get the wild card by eventsName use this function ,that name is cardlisters</span><span>// first use eventName</span><span>if</span> (! <span>isset</span>(<span>$this</span>->sorted[<span>$eventName</span>])) { <span>$this</span>->sortListeners(<span>$eventName</span>);<span>// use this sort Listeners</span> }<span>// if isset eventsName never be sort ,</span><span>return</span> array_merge(<span>$this</span>->sorted[<span>$eventName</span>], <span>$wildcards</span>);<span>// array_merge</span> } <span>/** * Get the wildcard listeners for the event. * *<span> @param</span> string $eventName *<span> @return</span> array */</span><span>protected</span><span><span>function</span><span>getWildcardListeners</span><span>(<span>$eventName</span>)</span> {</span><span>$wildcards</span> = [];<span>// getWildcardListeners() set the listener</span><span>foreach</span> (<span>$this</span>->wildcards <span>as</span><span>$key</span> => <span>$listeners</span>) {<span>// foreach $this->wildcards as key</span><span>if</span> (Str::is(<span>$key</span>, <span>$eventName</span>)) {<span>// determine is a str</span><span>$wildcards</span> = array_merge(<span>$wildcards</span>, <span>$listeners</span>); <span>// get the array_merge</span> } } <span>return</span><span>$wildcards</span>; } <span>// first get listener,second get the wildcard listener</span></code>
The above introduces [Li Jingshan php] laravel-20160906|Dispatcher-6 every day, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Event processing library in PHP8.0: Event With the continuous development of the Internet, PHP, as a popular back-end programming language, is widely used in the development of various Web applications. In this process, the event-driven mechanism has become a very important part. The event processing library Event in PHP8.0 will provide us with a more efficient and flexible event processing method. What is event handling? Event handling is a very important concept in the development of web applications. Events can be any kind of user row

Steam's Summer Sale has previously played host to some of the best game discounts, and this year seems to be stacking up for another home run by Valve. A trailer (watch below) teasing some of the Steam Summer Sale discounted games was just released i

This article will help you interpret the vue source code and introduce why you can use this to access properties in various options in Vue2. I hope it will be helpful to everyone!

A colleague got stuck due to a bug pointed by this. Vue2’s this pointing problem caused an arrow function to be used, resulting in the inability to get the corresponding props. He didn't know it when I introduced it to him, and then I deliberately looked at the front-end communication group. So far, at least 70% of front-end programmers still don't understand it. Today I will share with you this link. If everything is wrong If you haven’t learned it yet, please give me a big mouth.

Pygame's Event module Event (Event) is one of the important modules of Pygame. It is the core of building the entire game program, such as commonly used mouse clicks, keyboard taps, game window movement, window resizing, triggering specific plots, and exiting. Games, etc., these can be regarded as "events". Event type Pygame defines a structure specifically used to process events, namely the event queue. This structure follows the basic principle of "first come, first processed" in the queue. Through the event queue, we can process user operations in an orderly and one-by-one manner ( trigger event). The following table lists the commonly used game events in Pygame: Name Description QUIT The user presses the close button of the window ATIVEEVENTPy

Steam's Summer Sale has previously played host to some of the best game discounts, and this year seems to be stacking up for another home run by Valve. A trailer (watch below) teasing some of the Steam Summer Sale discounted games was just released i

Flexible use of this keyword in jQuery In jQuery, the this keyword is a very important and flexible concept. It is used to refer to the DOM element currently being manipulated. By rationally using this keyword, we can easily operate elements on the page and achieve various interactive effects and functions. This article will combine specific code examples to introduce the flexible use of this keyword in jQuery. Simple this example First, let's look at a simple this example. Suppose we have a

Use the window.outerWidth and window.outerHeight events to get the window size in JavaScript when the browser resizes. Example You can try running the following code to check the browser window size using events −<!DOCTYPEhtml><html> <head> <script>&am
