1 | <?php |
||
24 | trait MonitorTrait |
||
25 | { |
||
26 | use EventEmitterTrait, |
||
27 | MakesPromisesTrait, |
||
28 | MakesDeferredPromisesTrait; |
||
29 | |||
30 | /** |
||
31 | * The monitor's WAMP client session. |
||
32 | * |
||
33 | * @var ClientSession |
||
34 | */ |
||
35 | protected $session; |
||
36 | |||
37 | /** |
||
38 | * if the monitor is running. |
||
39 | * |
||
40 | * @var bool |
||
41 | */ |
||
42 | protected $isRunning = false; |
||
43 | |||
44 | /** |
||
45 | * @var SubscriptionCollection collection for meta subscriptions |
||
46 | */ |
||
47 | protected $metaSubscriptionCollection; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $initialCallProcedure; |
||
53 | |||
54 | /** |
||
55 | * @var callable |
||
56 | */ |
||
57 | protected $initialCallCallback; |
||
58 | |||
59 | /** |
||
60 | * @var bool |
||
61 | */ |
||
62 | protected $initialCallDone = false; |
||
63 | |||
64 | /** |
||
65 | * @param ClientSession $session |
||
66 | */ |
||
67 | protected function setClientSession(ClientSession $session) |
||
71 | |||
72 | /** |
||
73 | * Start the monitor. |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | public function start() |
||
91 | |||
92 | /** |
||
93 | * Stop the monitor. |
||
94 | * Returns boolean if the monitor could be started. |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | public function stop() |
||
111 | |||
112 | protected function getList() |
||
116 | |||
117 | /** |
||
118 | * Get the monitor's WAMP client session. |
||
119 | * |
||
120 | * @return ClientSession |
||
121 | */ |
||
122 | public function getServerSession() |
||
126 | |||
127 | /** |
||
128 | * Get the monitor's running state. |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | public function isRunning() |
||
136 | |||
137 | /** |
||
138 | * @param \Tidal\WampWatch\Subscription\Collection $collection |
||
139 | */ |
||
140 | public function setMetaSubscriptionCollection(SubscriptionCollection $collection) |
||
144 | |||
145 | /** |
||
146 | * @return \Tidal\WampWatch\Subscription\Collection |
||
147 | */ |
||
148 | public function getMetaSubscriptionCollection() |
||
154 | |||
155 | protected function setInitialCall($procedure, callable $callback) |
||
160 | |||
161 | /** |
||
162 | * @return PromiseInterface |
||
163 | */ |
||
164 | protected function callInitialProcedure() |
||
184 | |||
185 | private function getErrorCallback() |
||
193 | |||
194 | private function retrieveCallData($procedure, callable $filter = null, $arguments = []) |
||
212 | |||
213 | /** |
||
214 | * @param $event |
||
215 | * |
||
216 | * @return \Closure |
||
217 | */ |
||
218 | private function getSubscriptionHandler($event) |
||
224 | |||
225 | protected function getSubscriptionIdRetrievalCallback() |
||
241 | |||
242 | abstract protected function setList($list); |
||
243 | } |
||
244 |
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: