1 | <?php |
||
9 | class PresenceChannel extends PrivateChannel |
||
10 | { |
||
11 | /** |
||
12 | * Subscribe to the channel. |
||
13 | * |
||
14 | * @see https://pusher.com/docs/pusher_protocol#presence-channel-events |
||
15 | * @param \Ratchet\ConnectionInterface $connection |
||
16 | * @param \stdClass $payload |
||
17 | * @return void |
||
18 | * @throws InvalidSignature |
||
19 | */ |
||
20 | public function subscribe(ConnectionInterface $connection, stdClass $payload) |
||
52 | |||
53 | /** |
||
54 | * Unsubscribe connection from the channel. |
||
55 | * |
||
56 | * @param \Ratchet\ConnectionInterface $connection |
||
57 | * @return void |
||
58 | */ |
||
59 | public function unsubscribe(ConnectionInterface $connection) |
||
90 | |||
91 | /** |
||
92 | * Get the Presence channel data. |
||
93 | * |
||
94 | * @param array $users |
||
95 | * @return array |
||
96 | */ |
||
97 | protected function getChannelData(array $users): array |
||
107 | |||
108 | /** |
||
109 | * Get the Presence Channel's users. |
||
110 | * |
||
111 | * @param array $users |
||
112 | * @return array |
||
113 | */ |
||
114 | protected function getUserIds(array $users): array |
||
122 | |||
123 | /** |
||
124 | * Compute the hash for the presence channel integrity. |
||
125 | * |
||
126 | * @param array $users |
||
127 | * @return array |
||
128 | */ |
||
129 | protected function getHash(array $users): array |
||
139 | } |
||
140 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: