@@ -44,6 +44,9 @@ |
||
44 | 44 | return $this->{$name}; |
45 | 45 | } |
46 | 46 | |
47 | + /** |
|
48 | + * @param string $name |
|
49 | + */ |
|
47 | 50 | private function hasCollection($name) |
48 | 51 | { |
49 | 52 | return property_exists($this, $name) && is_a($this->{$name}, CollectionInterface::class); |
@@ -66,6 +66,6 @@ |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -Router::setConnectionFactory(function (Contract\RouterInterface $router, Contract\RealmInterface $realm) { |
|
69 | +Router::setConnectionFactory(function(Contract\RouterInterface $router, Contract\RealmInterface $realm) { |
|
70 | 70 | return new Connection($router, $realm); |
71 | 71 | }); |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) |
58 | 58 | { |
59 | - $this->adaptee->then(function () use ($onFulfilled) { |
|
59 | + $this->adaptee->then(function() use ($onFulfilled) { |
|
60 | 60 | if ($onFulfilled !== null) { |
61 | 61 | return call_user_func_array($onFulfilled, func_get_args()); |
62 | 62 | } |
63 | - }, function () use ($onRejected) { |
|
63 | + }, function() use ($onRejected) { |
|
64 | 64 | if ($onRejected !== null) { |
65 | 65 | return call_user_func_array($onRejected, func_get_args()); |
66 | 66 | } |
67 | - }, function () use ($onProgress) { |
|
67 | + }, function() use ($onProgress) { |
|
68 | 68 | if ($onProgress !== null) { |
69 | 69 | return call_user_func_array($onProgress, func_get_args()); |
70 | 70 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) |
84 | 84 | { |
85 | - $this->adaptee->done(function () use ($onFulfilled) { |
|
85 | + $this->adaptee->done(function() use ($onFulfilled) { |
|
86 | 86 | if ($onFulfilled !== null) { |
87 | 87 | return call_user_func_array($onFulfilled, func_get_args()); |
88 | 88 | } |
89 | - }, function () use ($onRejected) { |
|
89 | + }, function() use ($onRejected) { |
|
90 | 90 | if ($onRejected !== null) { |
91 | 91 | return call_user_func_array($onRejected, func_get_args()); |
92 | 92 | } |
93 | - }, function () use ($onProgress) { |
|
93 | + }, function() use ($onProgress) { |
|
94 | 94 | if ($onProgress !== null) { |
95 | 95 | return call_user_func_array($onProgress, func_get_args()); |
96 | 96 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function otherwise(callable $onRejected) |
108 | 108 | { |
109 | - $this->adaptee->otherwise(function () use ($onRejected) { |
|
109 | + $this->adaptee->otherwise(function() use ($onRejected) { |
|
110 | 110 | return call_user_func_array($onRejected, func_get_args()); |
111 | 111 | }); |
112 | 112 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function always(callable $onAlways) |
122 | 122 | { |
123 | - $this->adaptee->always(function () use ($onAlways) { |
|
123 | + $this->adaptee->always(function() use ($onAlways) { |
|
124 | 124 | return call_user_func_array($onAlways, func_get_args()); |
125 | 125 | }); |
126 | 126 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function progress(callable $onProgress) |
136 | 136 | { |
137 | - $this->adaptee->progress(function () use ($onProgress) { |
|
137 | + $this->adaptee->progress(function() use ($onProgress) { |
|
138 | 138 | return call_user_func_array($onProgress, func_get_args()); |
139 | 139 | }); |
140 | 140 |
@@ -26,8 +26,8 @@ |
||
26 | 26 | private $session; |
27 | 27 | |
28 | 28 | private function __construct(RouterInterface $router, |
29 | - RealmInterface $realm = null, |
|
30 | - SessionInterface $session = null |
|
29 | + RealmInterface $realm = null, |
|
30 | + SessionInterface $session = null |
|
31 | 31 | ) { |
32 | 32 | $this->router = $router; |
33 | 33 | $this->realm = $realm; |
@@ -152,6 +152,9 @@ discard block |
||
152 | 152 | : $this->metaSubscriptionCollection = new SubscriptionCollection($this->session); |
153 | 153 | } |
154 | 154 | |
155 | + /** |
|
156 | + * @param string $procedure |
|
157 | + */ |
|
155 | 158 | protected function setInitialCall($procedure, callable $callback) |
156 | 159 | { |
157 | 160 | $this->initialCallProcedure = (string) $procedure; |
@@ -191,6 +194,9 @@ discard block |
||
191 | 194 | }; |
192 | 195 | } |
193 | 196 | |
197 | + /** |
|
198 | + * @param string $procedure |
|
199 | + */ |
|
194 | 200 | private function retrieveCallData($procedure, callable $filter = null, $arguments = []) |
195 | 201 | { |
196 | 202 | $deferred = $this->createDeferred(); |
@@ -201,6 +207,10 @@ discard block |
||
201 | 207 | |
202 | 208 | $this->session->call($procedure, $arguments) |
203 | 209 | ->then( |
210 | + |
|
211 | + /** |
|
212 | + * @param string $res |
|
213 | + */ |
|
204 | 214 | function ($res) use ($deferred, $filter) { |
205 | 215 | $deferred->resolve($filter($res)); |
206 | 216 | }, |
@@ -211,7 +221,7 @@ discard block |
||
211 | 221 | } |
212 | 222 | |
213 | 223 | /** |
214 | - * @param $event |
|
224 | + * @param string $event |
|
215 | 225 | * |
216 | 226 | * @return \Closure |
217 | 227 | */ |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $this->callInitialProcedure(), |
82 | 82 | ]; |
83 | 83 | |
84 | - \React\Promise\all($promises)->done(function () { |
|
84 | + \React\Promise\all($promises)->done(function() { |
|
85 | 85 | $this->isRunning = true; |
86 | 86 | $this->emit('start', [$this->getList()]); |
87 | 87 | }); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | if (!isset($this->initialCallProcedure) || !isset($this->initialCallCallback)) { |
167 | 167 | $this->initialCallDone = true; |
168 | 168 | |
169 | - return $this->createPromise(function (callable $resolve) { |
|
169 | + return $this->createPromise(function(callable $resolve) { |
|
170 | 170 | $resolve(); |
171 | 171 | }); |
172 | 172 | } |
173 | 173 | |
174 | - return $this->session->call($this->initialCallProcedure, [])->then(function ($res) { |
|
174 | + return $this->session->call($this->initialCallProcedure, [])->then(function($res) { |
|
175 | 175 | $this->initialCallDone = true; |
176 | 176 | $cb = $this->initialCallCallback; |
177 | 177 | $cb($res); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | private function getErrorCallback() |
186 | 186 | { |
187 | - return function ($error) { |
|
187 | + return function($error) { |
|
188 | 188 | $this->emit('error', [$error]); |
189 | 189 | |
190 | 190 | return $error; |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | { |
196 | 196 | $deferred = $this->createDeferred(); |
197 | 197 | |
198 | - $filter = $filter ?: function ($res) { |
|
198 | + $filter = $filter ?: function($res) { |
|
199 | 199 | return $res; |
200 | 200 | }; |
201 | 201 | |
202 | 202 | $this->session->call($procedure, $arguments) |
203 | 203 | ->then( |
204 | - function ($res) use ($deferred, $filter) { |
|
204 | + function($res) use ($deferred, $filter) { |
|
205 | 205 | $deferred->resolve($filter($res)); |
206 | 206 | }, |
207 | 207 | $this->getErrorCallback() |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | */ |
218 | 218 | private function getSubscriptionHandler($event) |
219 | 219 | { |
220 | - return function ($res) use ($event) { |
|
220 | + return function($res) use ($event) { |
|
221 | 221 | $this->emit($event, $res); |
222 | 222 | }; |
223 | 223 | } |
224 | 224 | |
225 | 225 | protected function getSubscriptionIdRetrievalCallback() |
226 | 226 | { |
227 | - return function (\Thruway\CallResult $res) { |
|
227 | + return function(\Thruway\CallResult $res) { |
|
228 | 228 | /** @var \Thruway\Message\ResultMessage $message */ |
229 | 229 | $message = $res->getResultMessage(); |
230 | 230 | $list = $message->getArguments()[0]; |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | public function getSessionInfo($sessionId) |
68 | 68 | { |
69 | 69 | return $this->session->call(self::SESSION_INFO_TOPIC, [$sessionId])->then( |
70 | - function ($res) { |
|
70 | + function($res) { |
|
71 | 71 | $this->emit('info', [$res]); |
72 | 72 | |
73 | 73 | return $res; |
74 | 74 | }, |
75 | - function (ErrorMessage $error) use ($sessionId) { |
|
75 | + function(ErrorMessage $error) use ($sessionId) { |
|
76 | 76 | $this->emit('error', [$error, $sessionId]); |
77 | 77 | } |
78 | 78 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | return $this->createPromise( |
95 | - function (callable $resolve) { |
|
95 | + function(callable $resolve) { |
|
96 | 96 | $resolve($this->getList()); |
97 | 97 | } |
98 | 98 | ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // @var \Tidal\WampWatch\Subscription\Collection |
170 | 170 | $collection = $this->getMetaSubscriptionCollection(); |
171 | 171 | |
172 | - $collection->addSubscription(self::SESSION_JOIN_TOPIC, function (array $res) { |
|
172 | + $collection->addSubscription(self::SESSION_JOIN_TOPIC, function(array $res) { |
|
173 | 173 | $sessionInfo = $res[0]; |
174 | 174 | if (!$this->validateSessionInfo($sessionInfo) || $this->hasSession($sessionInfo)) { |
175 | 175 | return; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $this->addSession($sessionInfo); |
178 | 178 | }); |
179 | 179 | |
180 | - $collection->addSubscription(self::SESSION_LEAVE_TOPIC, function (array $res) { |
|
180 | + $collection->addSubscription(self::SESSION_LEAVE_TOPIC, function(array $res) { |
|
181 | 181 | // @bug : wamp.session.on_leave is bugged as of crossbar.io 0.11.0 |
182 | 182 | // will provide sessionID when Browser closes/reloads, |
183 | 183 | // but not when calling connection.close(); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function getSessionIdRetrievalCallback() |
209 | 209 | { |
210 | - return function ($res) { |
|
210 | + return function($res) { |
|
211 | 211 | $this->setList($res[0]); |
212 | 212 | $sessionIds = $this->getList(); |
213 | 213 | $this->emit('list', [$sessionIds]); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function getSubscriptionInfo($topic) |
59 | 59 | { |
60 | 60 | return $this->session->call(self::SUBSCRIPTION_GET_TOPIC, [$topic])->then( |
61 | - function ($res) { |
|
61 | + function($res) { |
|
62 | 62 | $this->emit('info', [$res]); |
63 | 63 | |
64 | 64 | return $res; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | return $this->retrieveSubscriptionIds(); |
74 | 74 | } |
75 | 75 | |
76 | - return $this->createPromise(function (callable $resolve) { |
|
76 | + return $this->createPromise(function(callable $resolve) { |
|
77 | 77 | $resolve($this->subscriptionIds); |
78 | 78 | }); |
79 | 79 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | protected function doSubscribe() |
105 | 105 | { |
106 | - \React\Promise\all($this->getSubscriptionPromises())->done(function () { |
|
106 | + \React\Promise\all($this->getSubscriptionPromises())->done(function() { |
|
107 | 107 | $this->isSubscribed = true; |
108 | 108 | $this->isSubscribing = false; |
109 | 109 | $this->subscriptionPromise->resolve($this->subscriptions); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | foreach (array_keys($this->subscriptions) as $topic) { |
121 | 121 | $promises[] = $this->session->subscribe($topic, $this->subscriptionCallbacks[$topic]) |
122 | - ->then(function (SubscribedMessage $msg) use ($topic) { |
|
122 | + ->then(function(SubscribedMessage $msg) use ($topic) { |
|
123 | 123 | $this->subscriptions[$topic] = $msg->getSubscriptionId(); |
124 | 124 | $this->subscriptionPromise->notify($topic); |
125 | 125 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function unsubscribe() |
137 | 137 | { |
138 | - $resolver = function (callable $resolve) { |
|
138 | + $resolver = function(callable $resolve) { |
|
139 | 139 | $resolve(); |
140 | 140 | }; |
141 | 141 | $promise = $this->createPromise($resolver); |
@@ -431,7 +431,7 @@ |
||
431 | 431 | */ |
432 | 432 | private function createDeferredAdapter(callable $canceller = null) |
433 | 433 | { |
434 | - $canceller = $canceller ?: function () { |
|
434 | + $canceller = $canceller ?: function() { |
|
435 | 435 | }; |
436 | 436 | |
437 | 437 | return $this->getDeferredFactory()->create($canceller); |