Passed
Branch master (9932c9)
by Timo
08:51
created
src/Tidal/WampWatch/SessionMonitor.php 4 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -100,8 +100,15 @@  discard block
 block discarded – undo
100 100
     }
101 101
     
102 102
     
103
+    /**
104
+     * @param callable $callback
105
+     */
103 106
     protected function retrieveSessionIds($callback = null) {
104 107
         $this->session->call(self::SESSION_LIST_TOPIC, [])->then(
108
+
109
+            /**
110
+             * @param callable $res
111
+             */
105 112
             function ($res)use($callback){
106 113
                 $this->sessionIds = $res[0];
107 114
                 $this->emit('list', [$this->sessionIds]);
@@ -109,6 +116,10 @@  discard block
 block discarded – undo
109 116
                     $callback($this->sessionIds);
110 117
                 }
111 118
             },
119
+
120
+            /**
121
+             * @param callable $error
122
+             */
112 123
             function ($error) {
113 124
                 $this->emit('error', [$error]);
114 125
             }
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,10 +7,8 @@
 block discarded – undo
7 7
  * For the full copyright and license information, please view the LICENSE file
8 8
  * that was distributed with this source code.
9 9
  */
10
-use Phaim\Server\Wamp\Util;
11
-use Thruway\ClientSession;
10
+use Phaim\Server\Wamp\Util;
12 11
 use Evenement\EventEmitterInterface;
13
-use Evenement\EventEmitterTrait;
14 12
 
15 13
 /**
16 14
  * Description of SessionMonitor
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     
40 40
     public function start() {
41
-        $this->once('list', function(){
41
+        $this->once('list', function() {
42 42
             $this->doStart();
43 43
         });     
44 44
         $this->startSubscriptions();
@@ -53,41 +53,41 @@  discard block
 block discarded – undo
53 53
     
54 54
     public function getSessionInfo($sessionId, callable $callback) {
55 55
         return $this->session->call(self::SESSION_INFO_TOPIC, [$sessionId])->then(
56
-            function ($res)use($callback){
56
+            function($res)use($callback){
57 57
                 $this->emit('info', [$res[0]]);
58 58
                 $callback($res[0]);
59 59
             },
60
-            function ($error) {
60
+            function($error) {
61 61
                 $this->emit('error', [$error]);
62 62
             }
63 63
         );    
64 64
     }
65 65
     
66 66
     public function getSessionIds(callable $callback) {
67
-        if(!count($this->sessionIds)){
67
+        if (!count($this->sessionIds)) {
68 68
             $this->retrieveSessionIds($callback);
69
-        }else{
69
+        }else {
70 70
             $callback($this->sessionIds);
71 71
         }
72 72
     }
73 73
     
74 74
     protected function startSubscriptions() { 
75
-        $this->session->subscribe(self::SESSION_JOIN_TOPIC, function($res){
75
+        $this->session->subscribe(self::SESSION_JOIN_TOPIC, function($res) {
76 76
             $sessionInfo = $res[0];
77 77
             $sessionId = $sessionInfo['session'];
78
-            if(($key = array_search($sessionId, $this->sessionIds)) === false) {
78
+            if (($key = array_search($sessionId, $this->sessionIds)) === false) {
79 79
                 $this->sessionIds[] = $sessionId;
80 80
                 $this->emit('join', [$sessionInfo]);
81 81
             }
82
-        })->then(function(){
82
+        })->then(function() {
83 83
             
84 84
         });
85
-        $this->session->subscribe(self::SESSION_LEAVE_TOPIC, function($res){
85
+        $this->session->subscribe(self::SESSION_LEAVE_TOPIC, function($res) {
86 86
             // @bug : wamp.session.on_leave is bugged as of crossbar.io 0.11.0
87 87
             // will provide sessionID when Browser closes/reloads,
88 88
             // but not when calling connection.close();
89 89
             $sessionId = $res[0];
90
-            if(($key = array_search($sessionId, $this->sessionIds)) !== false) {
90
+            if (($key = array_search($sessionId, $this->sessionIds)) !== false) {
91 91
                 unset($this->sessionIds[$key]);
92 92
                 $this->emit('leave', [$sessionId]);
93 93
             }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
     
103 103
     protected function retrieveSessionIds($callback = null) {
104 104
         $this->session->call(self::SESSION_LIST_TOPIC, [])->then(
105
-            function ($res)use($callback){
105
+            function($res)use($callback){
106 106
                 $this->sessionIds = $res[0];
107 107
                 $this->emit('list', [$this->sessionIds]);
108
-                if($callback){
108
+                if ($callback) {
109 109
                     $callback($this->sessionIds);
110 110
                 }
111 111
             },
112
-            function ($error) {
112
+            function($error) {
113 113
                 $this->emit('error', [$error]);
114 114
             }
115 115
         );  
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
     public function getSessionIds(callable $callback) {
67 67
         if(!count($this->sessionIds)){
68 68
             $this->retrieveSessionIds($callback);
69
-        }else{
69
+        } else{
70 70
             $callback($this->sessionIds);
71 71
         }
72 72
     }
Please login to merge, or discard this patch.
src/Tidal/WampWatch/Util.php 1 patch
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
  * that was distributed with this source code.
9 9
  */
10 10
 
11
-use Thruway\Common\Utils;
12
-use Thruway\ClientSession;
13
-use Thruway\Message\UnsubscribedMessage;
11
+use Thruway\Common\Utils;
12
+use Thruway\ClientSession;
13
+use Thruway\Message\UnsubscribedMessage;
14 14
 use React\Promise\Deferred;
15 15
 
16 16
 /**
Please login to merge, or discard this patch.
src/Tidal/WampWatch/MonitorTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @return boolean
63 63
      */ 
64 64
     public function stop() {
65
-        if(!$this->isRunning()){
65
+        if (!$this->isRunning()) {
66 66
             return false;
67 67
         }
68 68
         $this->isRunning = false;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         return true;
72 72
     }
73 73
     
74
-    protected function getList(){
74
+    protected function getList() {
75 75
         return [];
76 76
     }
77 77
  
Please login to merge, or discard this patch.