| @@ -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 | } |