| @@ -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 | |
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | public function getSubscriptionInfo($topic) | 
| 62 | 62 |      { | 
| 63 | 63 | return $this->session->call(self::SUBSCRIPTION_GET_TOPIC, [$topic])->then( | 
| 64 | -            function ($res) { | |
| 64 | +            function($res) { | |
| 65 | 65 |                  $this->emit('info', [$res]); | 
| 66 | 66 | |
| 67 | 67 | return $res; | 
| @@ -76,7 +76,7 @@ discard block | ||
| 76 | 76 | return $this->retrieveSubscriptionIds(); | 
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | -        return $this->createPromiseAdapter(function (callable $resolve) { | |
| 79 | +        return $this->createPromiseAdapter(function(callable $resolve) { | |
| 80 | 80 | $resolve($this->subscriptionIds); | 
| 81 | 81 | }); | 
| 82 | 82 | } | 
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 | |
| 100 | 100 | private function getCreateHandler() | 
| 101 | 101 |      { | 
| 102 | -        return function ($res) { | |
| 102 | +        return function($res) { | |
| 103 | 103 | $sessionId = $res[0]; | 
| 104 | 104 | $subscriptionInfo = $res[1]; | 
| 105 | 105 |              $this->emit('create', [$sessionId, $subscriptionInfo]); | 
| @@ -108,7 +108,7 @@ discard block | ||
| 108 | 108 | |
| 109 | 109 | private function getSubscriptionHandler($event) | 
| 110 | 110 |      { | 
| 111 | -        return function ($res) use ($event) { | |
| 111 | +        return function($res) use ($event) { | |
| 112 | 112 | $sessionId = $res[0]; | 
| 113 | 113 | $subscriptionId = $res[1]; | 
| 114 | 114 | $this->emit($event, [$sessionId, $subscriptionId]); | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | |
| 137 | 137 | protected function getSubscriptionIdRetrievalCallback() | 
| 138 | 138 |      { | 
| 139 | -        return function (\Thruway\CallResult $res) { | |
| 139 | +        return function(\Thruway\CallResult $res) { | |
| 140 | 140 | /** @var \Thruway\Message\ResultMessage $message */ | 
| 141 | 141 | $message = $res->getResultMessage(); | 
| 142 | 142 | $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 ($error) { | |
| 75 | +            function($error) { | |
| 76 | 76 |                  $this->emit('error', [$error]); | 
| 77 | 77 | } | 
| 78 | 78 | ); | 
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | 94 | return $this->createPromiseAdapter( | 
| 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]); | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 | $this->callInitialProcedure(), | 
| 83 | 83 | ]; | 
| 84 | 84 | |
| 85 | -        \React\Promise\all($promises)->done(function () { | |
| 85 | +        \React\Promise\all($promises)->done(function() { | |
| 86 | 86 | $this->isRunning = true; | 
| 87 | 87 |              $this->emit('start', [$this->getList()]); | 
| 88 | 88 | }); | 
| @@ -167,12 +167,12 @@ discard block | ||
| 167 | 167 |          if (!isset($this->initialCallProcedure) || !isset($this->initialCallCallback)) { | 
| 168 | 168 | $this->initialCallDone = true; | 
| 169 | 169 | |
| 170 | -            return new  Promise(function (callable $resolve) { | |
| 170 | +            return new  Promise(function(callable $resolve) { | |
| 171 | 171 | $resolve(); | 
| 172 | 172 | }); | 
| 173 | 173 | } | 
| 174 | 174 | |
| 175 | -        return $this->session->call($this->initialCallProcedure, [])->then(function ($res) { | |
| 175 | +        return $this->session->call($this->initialCallProcedure, [])->then(function($res) { | |
| 176 | 176 | $this->initialCallDone = true; | 
| 177 | 177 | $cb = $this->initialCallCallback; | 
| 178 | 178 | $cb($res); | 
| @@ -185,7 +185,7 @@ discard block | ||
| 185 | 185 | |
| 186 | 186 | private function getErrorCallback() | 
| 187 | 187 |      { | 
| 188 | -        return function ($error) { | |
| 188 | +        return function($error) { | |
| 189 | 189 |              $this->emit('error', [$error]); | 
| 190 | 190 | |
| 191 | 191 | return $error; | 
| @@ -198,13 +198,13 @@ discard block | ||
| 198 | 198 | new Deferred() | 
| 199 | 199 | ); | 
| 200 | 200 | |
| 201 | -        $filter = $filter ?: function ($res) { | |
| 201 | +        $filter = $filter ?: function($res) { | |
| 202 | 202 | return $res; | 
| 203 | 203 | }; | 
| 204 | 204 | |
| 205 | 205 | $this->session->call($procedure, $arguments) | 
| 206 | 206 | ->then( | 
| 207 | -                function ($res) use ($deferred, $filter) { | |
| 207 | +                function($res) use ($deferred, $filter) { | |
| 208 | 208 | $deferred->resolve($filter($res)); | 
| 209 | 209 | }, | 
| 210 | 210 | $this->getErrorCallback() | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | |
| 99 | 99 | protected function doSubscribe() | 
| 100 | 100 |      { | 
| 101 | -        \React\Promise\all($this->getSubscriptionPromises())->done(function () { | |
| 101 | +        \React\Promise\all($this->getSubscriptionPromises())->done(function() { | |
| 102 | 102 | $this->isSubscribed = true; | 
| 103 | 103 | $this->isSubscribing = false; | 
| 104 | 104 | $this->subscriptionPromise->resolve($this->subscriptions); | 
| @@ -114,7 +114,7 @@ discard block | ||
| 114 | 114 | |
| 115 | 115 |          foreach (array_keys($this->subscriptions) as $topic) { | 
| 116 | 116 | $promises[] = $this->session->subscribe($topic, $this->subscriptionCallbacks[$topic]) | 
| 117 | -                ->then(function (SubscribedMessage $msg) use ($topic) { | |
| 117 | +                ->then(function(SubscribedMessage $msg) use ($topic) { | |
| 118 | 118 | $this->subscriptions[$topic] = $msg->getSubscriptionId(); | 
| 119 | 119 | $this->subscriptionPromise->notify($topic); | 
| 120 | 120 | |
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 | */ | 
| 131 | 131 | public function unsubscribe() | 
| 132 | 132 |      { | 
| 133 | -        $resolver = function (callable $resolve) { | |
| 133 | +        $resolver = function(callable $resolve) { | |
| 134 | 134 | $resolve(); | 
| 135 | 135 | }; | 
| 136 | 136 | $promise = new Promise($resolver); |