@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | /** |
128 | 128 | * @param $msg |
129 | - * @param $from |
|
129 | + * @param ConnectionInterface $from |
|
130 | 130 | * @throws WebSocketException |
131 | 131 | */ |
132 | 132 | function checkForRequiredInMessage($msg,$from) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * @param $clonedObject |
|
144 | + * @param Receiver $clonedObject |
|
145 | 145 | * @param $clone |
146 | 146 | */ |
147 | 147 | function cloneProperties($clonedObject, $clone) |
@@ -13,7 +13,6 @@ |
||
13 | 13 | use Shamaseen\Laravel\Ratchet\Exceptions\WebSocketException; |
14 | 14 | use Shamaseen\Laravel\Ratchet\Facades\WsRoute; |
15 | 15 | use Shamaseen\Laravel\Ratchet\Objects\Clients\Client; |
16 | -use Shamaseen\Laravel\Ratchet\Routes\Routes; |
|
17 | 16 | use Ratchet\ConnectionInterface; |
18 | 17 | use Ratchet\MessageComponentInterface; |
19 | 18 | use Shamaseen\Laravel\Ratchet\Traits\WebSocketMessagesManager; |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | { |
71 | 71 | $msg = json_decode($msg); |
72 | 72 | |
73 | - $this->checkForRequiredInMessage($msg,$from); |
|
73 | + $this->checkForRequiredInMessage($msg, $from); |
|
74 | 74 | |
75 | 75 | \Session::setId($msg->session); |
76 | 76 | |
77 | 77 | \Session::start(); |
78 | 78 | |
79 | - if($this->routes[$msg->route]->auth && !\Auth::check()) |
|
80 | - $this->error($msg,$from,'Unauthenticated.'); |
|
79 | + if ($this->routes[$msg->route]->auth && !\Auth::check()) |
|
80 | + $this->error($msg, $from, 'Unauthenticated.'); |
|
81 | 81 | else |
82 | 82 | $this->userAuthSocketMapper[\Auth::id()] = $from->resourceId; |
83 | 83 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | $method = $this->routes[$msg->route]->method; |
86 | 86 | $controller = new $class; |
87 | 87 | |
88 | - $this->cloneProperties($this,$controller); |
|
88 | + $this->cloneProperties($this, $controller); |
|
89 | 89 | |
90 | 90 | $controller->conn = $from; |
91 | 91 | |
92 | - if(!method_exists($controller,$method)) |
|
92 | + if (!method_exists($controller, $method)) |
|
93 | 93 | { |
94 | - $this->error($msg,$from,'Method doesnt\'t exist !'); |
|
94 | + $this->error($msg, $from, 'Method doesnt\'t exist !'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $controller->$method($msg); |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | * @param $from |
130 | 130 | * @throws WebSocketException |
131 | 131 | */ |
132 | - function checkForRequiredInMessage($msg,$from) |
|
132 | + function checkForRequiredInMessage($msg, $from) |
|
133 | 133 | { |
134 | - if(!isset($msg->route) || !isset($msg->session)) |
|
134 | + if (!isset($msg->route) || !isset($msg->session)) |
|
135 | 135 | { |
136 | - $this->error($msg,$from,'You can\'t send a request without the route and the session id !'); |
|
136 | + $this->error($msg, $from, 'You can\'t send a request without the route and the session id !'); |
|
137 | 137 | } |
138 | 138 | |
139 | - if(!isset($this->routes[$msg->route])) |
|
140 | - $this->error($msg,$from,'No such route !'); |
|
139 | + if (!isset($this->routes[$msg->route])) |
|
140 | + $this->error($msg, $from, 'No such route !'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -76,10 +76,11 @@ discard block |
||
76 | 76 | |
77 | 77 | \Session::start(); |
78 | 78 | |
79 | - if($this->routes[$msg->route]->auth && !\Auth::check()) |
|
80 | - $this->error($msg,$from,'Unauthenticated.'); |
|
81 | - else |
|
82 | - $this->userAuthSocketMapper[\Auth::id()] = $from->resourceId; |
|
79 | + if($this->routes[$msg->route]->auth && !\Auth::check()) { |
|
80 | + $this->error($msg,$from,'Unauthenticated.'); |
|
81 | + } else { |
|
82 | + $this->userAuthSocketMapper[\Auth::id()] = $from->resourceId; |
|
83 | + } |
|
83 | 84 | |
84 | 85 | $class = $this->routes[$msg->route]->controller; |
85 | 86 | $method = $this->routes[$msg->route]->method; |
@@ -95,8 +96,7 @@ discard block |
||
95 | 96 | } |
96 | 97 | |
97 | 98 | $controller->$method($msg); |
98 | - } |
|
99 | - catch (WebSocketException $exception) |
|
99 | + } catch (WebSocketException $exception) |
|
100 | 100 | { |
101 | 101 | |
102 | 102 | } |
@@ -136,8 +136,9 @@ discard block |
||
136 | 136 | $this->error($msg,$from,'You can\'t send a request without the route and the session id !'); |
137 | 137 | } |
138 | 138 | |
139 | - if(!isset($this->routes[$msg->route])) |
|
140 | - $this->error($msg,$from,'No such route !'); |
|
139 | + if(!isset($this->routes[$msg->route])) { |
|
140 | + $this->error($msg,$from,'No such route !'); |
|
141 | + } |
|
141 | 142 | } |
142 | 143 | |
143 | 144 | /** |