Passed
Push — master ( 3266a4...47f014 )
by Mohammad
02:51
created
src/Commands/WebSocketService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
                     new Receiver()
54 54
                 )
55 55
             ),
56
-            env('CHAT_PORT',8080)
56
+            env('CHAT_PORT', 8080)
57 57
         );
58 58
 
59 59
         $server->run();
Please login to merge, or discard this patch.
src/Facades/WsRoute.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 
11 11
 class WsRoute extends \Illuminate\Support\Facades\Facade
12 12
 {
13
-    static function getFacadeAccessor(){
13
+    static function getFacadeAccessor() {
14 14
 
15 15
         return 'WsRoute';
16 16
     }
Please login to merge, or discard this patch.
src/LaravelRatchetServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $this->publishes([
29 29
             __DIR__.'/config' => realpath('config'),
30 30
             __DIR__.'/Routes/websocket' => realpath('routes'),
31
-        ],'laravel-ratchet');
31
+        ], 'laravel-ratchet');
32 32
 
33 33
         if ($this->app['config']->get('laravel-ratchet') === null) {
34 34
             $this->app['config']->set('laravel-ratchet', require __DIR__.'/config/laravel-ratchet.php');
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function register()
44 44
     {
45
-        $this->app->bind('WsRoute',function (){
45
+        $this->app->bind('WsRoute', function() {
46 46
             return new Routes();
47 47
         });
48 48
     }
Please login to merge, or discard this patch.
src/Traits/WebSocketMessagesManager.php 5 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     /**
23 23
      * @param $request
24 24
      * @param ConnectionInterface $from
25
-     * @param $error
25
+     * @param string $error
26 26
      * @throws WebSocketException
27 27
      */
28 28
     function error($request,ConnectionInterface $from, $error)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,6 @@
 block discarded – undo
11 11
 
12 12
 use Shamaseen\Laravel\Ratchet\Exceptions\WebSocketException;
13 13
 use Ratchet\ConnectionInterface;
14
-use Shamaseen\Laravel\Ratchet\Objects\Rooms\Room;
15 14
 
16 15
 /**
17 16
  * Trait WebSocketMessagesManager
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
      */
73 73
     function sendBack($data)
74 74
     {
75
-       $this->sendToWebSocketUser($this->conn,$data);
75
+        $this->sendToWebSocketUser($this->conn,$data);
76 76
     }
77 77
 
78 78
     /**
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
      * @param $error
26 26
      * @throws WebSocketException
27 27
      */
28
-    function error($request,ConnectionInterface $from, $error)
28
+    function error($request, ConnectionInterface $from, $error)
29 29
     {
30
-        if(env('APP_DEBUG'))
30
+        if (env('APP_DEBUG'))
31 31
         {
32 32
             echo 'User error: ';
33 33
             echo $error."\n";
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             'event'=>'error',
40 40
             'message'=>$error
41 41
         ];
42
-        $this->sendToWebSocketUser($from,$data);
42
+        $this->sendToWebSocketUser($from, $data);
43 43
         throw new WebSocketException();
44 44
     }
45 45
 
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
      * @param ConnectionInterface $conn
48 48
      * @param $data
49 49
      */
50
-    function sendToWebSocketUser(ConnectionInterface $conn,$data)
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
-        if(!isset($data['event']))
55
+        if (!isset($data['event']))
56 56
         {
57 57
             $data['event'] = 'default';
58 58
         }
59 59
 
60
-        if(isset($this->route) && $this->route->auth && !array_key_exists('sender',$data))
60
+        if (isset($this->route) && $this->route->auth && !array_key_exists('sender', $data))
61 61
             $data['sender'] = $this->getSenderData();
62 62
 
63 63
         $conn->send(json_encode($data));
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
      * @param int $user_id
68 68
      * @param array $data
69 69
      */
70
-    function sendToUser($user_id,$data)
70
+    function sendToUser($user_id, $data)
71 71
     {
72 72
         $resourceId = $this->userAuthSocketMapper[$user_id];
73 73
         /** @var ConnectionInterface $conn */
74 74
         $conn = $this->clients[$resourceId]->conn;
75
-        $this->sendToWebSocketUser($conn,$data);
75
+        $this->sendToWebSocketUser($conn, $data);
76 76
     }
77 77
 
78 78
     /**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     function sendBack($data)
82 82
     {
83
-       $this->sendToWebSocketUser($this->conn,$data);
83
+       $this->sendToWebSocketUser($this->conn, $data);
84 84
     }
85 85
 
86 86
     /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,16 +49,18 @@
 block discarded – undo
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) && $this->route->auth && !array_key_exists('sender',$data))
61
-            $data['sender'] = $this->getSenderData();
61
+        if(isset($this->route) && $this->route->auth && !array_key_exists('sender',$data)) {
62
+                    $data['sender'] = $this->getSenderData();
63
+        }
62 64
 
63 65
         $conn->send(json_encode($data));
64 66
     }
Please login to merge, or discard this patch.
src/Objects/Rooms/Room.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
     function hasMember($client)
46 46
     {
47
-        if(array_key_exists($client->id,$this->members))
47
+        if (array_key_exists($client->id, $this->members))
48 48
             return true;
49 49
 
50 50
         return false;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Routes/Routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @param $method
25 25
      * @param bool $authenticated
26 26
      */
27
-    function make($routeName, $controller, $method,$authenticated = true)
27
+    function make($routeName, $controller, $method, $authenticated = true)
28 28
     {
29 29
         $this->routes[$routeName] = (object) [
30 30
             'controller'=>$controller,
Please login to merge, or discard this patch.
src/Traits/Validation.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
      * @throws \Illuminate\Validation\ValidationException
48 48
      */
49 49
     public function validate($request, array $rules,
50
-                             array $messages = [], array $customAttributes = [])
50
+                                array $messages = [], array $customAttributes = [])
51 51
     {
52 52
         return $this->getValidationFactory()->make(
53 53
             (array) $request, $rules, $messages, $customAttributes
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@
 block discarded – undo
19 19
     {
20 20
         foreach ($required as $input)
21 21
         {
22
-            if(!in_array($input,(array)$this->request))
22
+            if (!in_array($input, (array) $this->request))
23 23
             {
24
-                $this->error($this->request,$this->conn,$this->requireErrorMessage($input));
24
+                $this->error($this->request, $this->conn, $this->requireErrorMessage($input));
25 25
             }
26 26
         }
27 27
     }
Please login to merge, or discard this patch.
src/Controllers/WebSocketController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  */
23 23
 class WebSocketController
24 24
 {
25
-    use WebSocketMessagesManager,Validation;
25
+    use WebSocketMessagesManager, Validation;
26 26
 
27 27
     /**
28 28
      * @var Client[]
Please login to merge, or discard this patch.
src/Receiver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         $this->userAuthSocketMapper = [];
47 47
 
48 48
         $this->mainRoutes();
49
-        include base_path() . '/routes/websocket.php';
49
+        include base_path().'/routes/websocket.php';
50 50
         $this->routes = WsRoute::getRoutes();
51 51
     }
52 52
 
Please login to merge, or discard this patch.