@@ -44,8 +44,9 @@ |
||
| 44 | 44 | |
| 45 | 45 | function hasMember($client) |
| 46 | 46 | { |
| 47 | - if(array_key_exists($client->id,$this->members)) |
|
| 48 | - return true; |
|
| 47 | + if(array_key_exists($client->id,$this->members)) { |
|
| 48 | + return true; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | return false; |
| 51 | 52 | } |
@@ -49,16 +49,18 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | function sendToWebSocketUser(ConnectionInterface $conn,$data) |
| 51 | 51 | { |
| 52 | - if(!is_array($data)) |
|
| 53 | - $data = ['msg'=>$data,'event'=>'default']; |
|
| 52 | + if(!is_array($data)) { |
|
| 53 | + $data = ['msg'=>$data,'event'=>'default']; |
|
| 54 | + } |
|
| 54 | 55 | |
| 55 | 56 | if(!isset($data['event'])) |
| 56 | 57 | { |
| 57 | 58 | $data['event'] = 'default'; |
| 58 | 59 | } |
| 59 | 60 | |
| 60 | - if(isset($this->route) && !array_key_exists('sender',$data)) |
|
| 61 | - $data['sender'] = $this->getSenderData(); |
|
| 61 | + if(isset($this->route) && !array_key_exists('sender',$data)) { |
|
| 62 | + $data['sender'] = $this->getSenderData(); |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | $conn->send(json_encode($data)); |
| 64 | 66 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @param $request |
| 23 | 23 | * @param ConnectionInterface $from |
| 24 | - * @param $error |
|
| 24 | + * @param string $error |
|
| 25 | 25 | * @throws WebSocketException |
| 26 | 26 | */ |
| 27 | 27 | function error($request,ConnectionInterface $from, $error) |
@@ -101,6 +101,9 @@ discard block |
||
| 101 | 101 | ]; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | + /** |
|
| 105 | + * @param integer $user_id |
|
| 106 | + */ |
|
| 104 | 107 | function isOnline($user_id) |
| 105 | 108 | { |
| 106 | 109 | if(array_key_exists($user_id,$this->userAuthSocketMapper)) |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | /** |
| 40 | 40 | * Validate the given request with the given rules. |
| 41 | 41 | * |
| 42 | - * @param object $request |
|
| 42 | + * @param Collection $request |
|
| 43 | 43 | * @param array $rules |
| 44 | 44 | * @param array $messages |
| 45 | 45 | * @param array $customAttributes |
@@ -50,8 +50,9 @@ |
||
| 50 | 50 | public function validate($request, array $rules, |
| 51 | 51 | array $messages = [], array $customAttributes = []) |
| 52 | 52 | { |
| 53 | - if($request instanceof Collection) |
|
| 54 | - $request = $request->toArray(); |
|
| 53 | + if($request instanceof Collection) { |
|
| 54 | + $request = $request->toArray(); |
|
| 55 | + } |
|
| 55 | 56 | |
| 56 | 57 | return $this->getValidationFactory()->make( |
| 57 | 58 | (array) $request, $rules, $messages, $customAttributes |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function __get($property) |
| 16 | 16 | { |
| 17 | - if($this->has($property)) |
|
| 18 | - return $this->get($property); |
|
| 17 | + if($this->has($property)) { |
|
| 18 | + return $this->get($property); |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | return Parent::get($property); |
| 21 | 22 | } |
@@ -242,8 +242,7 @@ |
||
| 242 | 242 | $this->clients[$from->resourceId]->id = \Auth::id(); |
| 243 | 243 | $this->clients[$from->resourceId]->session = $msg['session']; |
| 244 | 244 | $this->userAuthSocketMapper[\Auth::id()] = $from->resourceId; |
| 245 | - } |
|
| 246 | - else |
|
| 245 | + } else |
|
| 247 | 246 | { |
| 248 | 247 | $this->error($msg, $from, 'Unauthenticated.'); |
| 249 | 248 | } |