We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 11 | class CentrifugeBroadcaster extends Broadcaster |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * The Centrifugo SDK instance. |
||
| 15 | * |
||
| 16 | * @var \denis660\Centrifuge\Contracts\Centrifuge |
||
| 17 | */ |
||
| 18 | protected $centrifugo; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Create a new broadcaster instance. |
||
| 22 | * |
||
| 23 | * @param \denis660\Centrifuge\Contracts\Centrifuge $centrifugo |
||
| 24 | */ |
||
| 25 | public function __construct(Centrifuge $centrifugo) |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Authenticate the incoming request for a given channel. |
||
| 32 | * |
||
| 33 | * @param \Illuminate\Http\Request $request |
||
| 34 | * @return mixed |
||
| 35 | */ |
||
| 36 | public function auth($request) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Return the valid authentication response. |
||
| 63 | * |
||
| 64 | * @param \Illuminate\Http\Request $request |
||
| 65 | * @param mixed $result |
||
| 66 | * @return mixed |
||
| 67 | */ |
||
| 68 | public function validAuthenticationResponse($request, $result) |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Broadcast the given event. |
||
| 75 | * |
||
| 76 | * @param array $channels |
||
| 77 | * @param string $event |
||
| 78 | * @param array $payload |
||
| 79 | * @return void |
||
| 80 | */ |
||
| 81 | public function broadcast(array $channels, $event, array $payload = []) |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Get client from request. |
||
| 98 | * |
||
| 99 | * @param \Illuminate\Http\Request $request |
||
| 100 | * @return string |
||
| 101 | */ |
||
| 102 | private function getClientFromRequest($request) |
||
| 106 | |||
| 107 | /** |
||
| 108 | * Get channels from request. |
||
| 109 | * |
||
| 110 | * @param \Illuminate\Http\Request $request |
||
| 111 | * @return array |
||
| 112 | */ |
||
| 113 | private function getChannelsFromRequest($request) |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Get channel name without $ symbol (if present). |
||
| 122 | * |
||
| 123 | * @param string $channel |
||
| 124 | * @return string |
||
| 125 | */ |
||
| 126 | private function getChannelName(string $channel) |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Make response for client, based on access rights. |
||
| 133 | * |
||
| 134 | * @param bool $access_granted |
||
| 135 | * @param string $client |
||
| 136 | * @return array |
||
| 137 | */ |
||
| 138 | private function makeResponseForClient(bool $access_granted, string $client) |
||
| 149 | } |
||
| 150 |
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare 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.phpHowever, as
OtherDir/Foo.phpdoes 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: