1 | <?php |
||
11 | class Broadcasting extends Base |
||
12 | { |
||
13 | use Routing, Database; |
||
14 | |||
15 | 1 | protected function bootRouter() |
|
21 | |||
22 | /** |
||
23 | * Check resource. |
||
24 | * |
||
25 | * @return Result |
||
26 | */ |
||
27 | 1 | public function check() |
|
41 | |||
42 | /** |
||
43 | * Dispatch event. |
||
44 | */ |
||
45 | 1 | protected function dispatchEvent() |
|
55 | |||
56 | /** |
||
57 | * Create and persist ping. |
||
58 | */ |
||
59 | 1 | protected function createPing() |
|
65 | |||
66 | /** |
||
67 | * Create ping row array. |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | 1 | protected function createPingRow() |
|
79 | |||
80 | /** |
||
81 | * Parse date. |
||
82 | * |
||
83 | * @param $date |
||
84 | * @return Carbon |
||
85 | */ |
||
86 | protected function parseDate($date) |
||
90 | |||
91 | /** |
||
92 | * Create and persist pong. |
||
93 | * |
||
94 | * @param $secret |
||
95 | */ |
||
96 | public function pong($secret) |
||
108 | |||
109 | /** |
||
110 | * Check if a ping timed out. |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | 1 | protected function pingTimedout() |
|
140 | } |
||
141 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: