Completed
Push — master ( 8af72d...6a45d4 )
by Timo
04:44 queued 01:52
created
src/Tidal/WampWatch/SubscriptionMonitor.php 2 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.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public function start()
43 43
     {
44
-        $this->once('list', function () {
44
+        $this->once('list', function() {
45 45
             $this->startSubscriptions();
46 46
             $this->doStart();
47 47
         });
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
     public function getSessionInfo($sessionId, callable $callback)
58 58
     {
59 59
         return $this->session->call(self::SUBSCRIPTION_INFO_TOPIC, $sessionId)->then(
60
-            function ($res) use ($callback) {
60
+            function($res) use ($callback) {
61 61
                 $this->emit('info', $res);
62 62
                 $callback($res[0]);
63 63
             },
64
-            function ($error) {
64
+            function($error) {
65 65
                 $this->emit('error', [$error]);
66 66
             }
67 67
         );
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
     {
72 72
         if (!count($this->subscriptionIds)) {
73 73
             $this->retrieveSubscriptionIds($callback);
74
-        } else {
74
+        }else {
75 75
             $callback($this->subscriptionIds);
76 76
         }
77 77
     }
78 78
 
79 79
     protected function startSubscriptions()
80 80
     {
81
-        $this->session->subscribe(self::SUBSCRIPTION_CREATE_TOPIC, function ($res) {
81
+        $this->session->subscribe(self::SUBSCRIPTION_CREATE_TOPIC, function($res) {
82 82
             return $this->createHandler($res);
83 83
         });
84
-        $this->session->subscribe(self::SUBSCRIPTION_DELETE_TOPIC, function ($res) {
84
+        $this->session->subscribe(self::SUBSCRIPTION_DELETE_TOPIC, function($res) {
85 85
             return $this->deleteHandler($res);
86 86
         });
87
-        $this->session->subscribe(self::SUBSCRIPTION_SUB_TOPIC, function ($res) {
87
+        $this->session->subscribe(self::SUBSCRIPTION_SUB_TOPIC, function($res) {
88 88
             return $this->subHandler($res);
89 89
         });
90 90
     }
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
         $sessionId = $res[0];
114 114
         $subId = $res[1];
115 115
         $this->getSubscriptionDetail($subId)->then(
116
-            function ($res) use ($sessionId,$subId) {
116
+            function($res) use ($sessionId, $subId) {
117 117
                 $this->emit('sub', [$sessionId, $subId, $res[0]]);
118 118
             },
119
-            function ($error) {
119
+            function($error) {
120 120
                 $this->emit('sub', [$sessionId, $subId, [
121 121
                     'id'        => $subId,
122 122
                     'created'   => null,
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
     public function getSubscriptionDetail($subId)
137 137
     {
138 138
         return $this->session->call(self::SUBSCRIPTION_GET_TOPIC, [$subId])->then(
139
-            function ($res) {
139
+            function($res) {
140 140
             },
141
-            function ($error) {
141
+            function($error) {
142 142
             }
143 143
         );
144 144
     }
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
     protected function retrieveSubscriptionIds($callback = null)
147 147
     {
148 148
         return $this->session->call(self::SUBSCRIPTION_LIST_TOPIC, [])->then(
149
-            function ($res) use ($callback) {
149
+            function($res) use ($callback) {
150 150
                 $this->subscriptionIds = $res[0];
151 151
                 $this->emit('list', [$this->subscriptionIds]);
152 152
                 if ($callback) {
153 153
                     $callback($this->subscriptionIds);
154 154
                 }
155 155
             },
156
-            function ($error) {
156
+            function($error) {
157 157
                 $this->emit('error', [$error]);
158 158
             }
159 159
         );
Please login to merge, or discard this patch.
src/Tidal/WampWatch/SessionMonitor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function start()
38 38
     {
39
-        $this->once('list', function () {
39
+        $this->once('list', function() {
40 40
             $this->doStart();
41 41
         });
42 42
         $this->startSubscriptions();
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
     public function getSessionInfo($sessionId, callable $callback)
55 55
     {
56 56
         return $this->session->call(self::SESSION_INFO_TOPIC, [$sessionId])->then(
57
-            function ($res) use ($callback) {
57
+            function($res) use ($callback) {
58 58
                 $this->emit('info', [$res[0]]);
59 59
                 $callback($res[0]);
60 60
             },
61
-            function ($error) {
61
+            function($error) {
62 62
                 $this->emit('error', [$error]);
63 63
             }
64 64
         );
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
     {
69 69
         if (!count($this->sessionIds)) {
70 70
             $this->retrieveSessionIds($callback);
71
-        } else {
71
+        }else {
72 72
             $callback($this->sessionIds);
73 73
         }
74 74
     }
75 75
 
76 76
     protected function startSubscriptions()
77 77
     {
78
-        $this->session->subscribe(self::SESSION_JOIN_TOPIC, function ($res) {
78
+        $this->session->subscribe(self::SESSION_JOIN_TOPIC, function($res) {
79 79
             $sessionInfo = $res[0];
80 80
             $sessionId = $sessionInfo['session'];
81 81
             if ((array_search($sessionId, $this->sessionIds)) === false) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 $this->emit('join', [$sessionInfo]);
84 84
             }
85 85
         });
86
-        $this->session->subscribe(self::SESSION_LEAVE_TOPIC, function ($res) {
86
+        $this->session->subscribe(self::SESSION_LEAVE_TOPIC, function($res) {
87 87
             // @bug : wamp.session.on_leave is bugged as of crossbar.io 0.11.0
88 88
             // will provide sessionID when Browser closes/reloads,
89 89
             // but not when calling connection.close();
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
     protected function retrieveSessionIds($callback = null)
105 105
     {
106 106
         $this->session->call(self::SESSION_LIST_TOPIC, [])->then(
107
-            function ($res) use ($callback) {
107
+            function($res) use ($callback) {
108 108
                 $this->sessionIds = $res[0];
109 109
                 $this->emit('list', [$this->sessionIds]);
110 110
                 if ($callback) {
111 111
                     $callback($this->sessionIds);
112 112
                 }
113 113
             },
114
-            function ($error) {
114
+            function($error) {
115 115
                 $this->emit('error', [$error]);
116 116
             }
117 117
         );
Please login to merge, or discard this patch.
examples/thruway_internal_session_monitor/InternalSessionMonitor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,22 +38,22 @@
 block discarded – undo
38 38
         $sessionMonitor = new SessionMonitor(new Adapter($session));
39 39
 
40 40
 
41
-        $sessionMonitor->on('list', function ($l) {
41
+        $sessionMonitor->on('list', function($l) {
42 42
             echo "\nLIST: \n";
43 43
             print_r($l);
44 44
         });
45 45
 
46
-        $sessionMonitor->on('join', function ($l) {
46
+        $sessionMonitor->on('join', function($l) {
47 47
             echo "\nJOIN: \n";
48 48
             print_r($l);
49 49
         });
50 50
 
51
-        $sessionMonitor->on('leave', function ($l) {
51
+        $sessionMonitor->on('leave', function($l) {
52 52
             echo "\nLEAVE: \n";
53 53
             print_r($l);
54 54
         });
55 55
 
56
-        $sessionMonitor->on('error', function ($l) {
56
+        $sessionMonitor->on('error', function($l) {
57 57
             echo "\nERROR: \n";
58 58
             print_r($l);
59 59
         });
Please login to merge, or discard this patch.
examples/thruway_internal_session_monitor/client.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,37 +18,37 @@
 block discarded – undo
18 18
 $client = new Client('realm1');
19 19
 $client->addTransportProvider(new PawlTransportProvider('ws://127.0.0.1:9999/'));
20 20
 
21
-$client->on('open', function (ClientSession $session) {
21
+$client->on('open', function(ClientSession $session) {
22 22
 
23 23
     // 1) subscribe to a topic
24
-    $onevent = function ($args) {
24
+    $onevent = function($args) {
25 25
         echo "Event {$args[0]}\n";
26 26
     };
27 27
     $session->subscribe('com.myapp.hello', $onevent);
28 28
 
29 29
     // 2) publish an event
30 30
     $session->publish('com.myapp.hello', ['Hello, world from PHP!!!'], [], ['acknowledge' => true])->then(
31
-        function () {
31
+        function() {
32 32
             echo "Publish Acknowledged!\n";
33 33
         },
34
-        function ($error) {
34
+        function($error) {
35 35
             // publish failed
36 36
             echo "Publish Error {$error}\n";
37 37
         }
38 38
     );
39 39
 
40 40
     // 3) register a procedure for remoting
41
-    $add2 = function ($args) {
41
+    $add2 = function($args) {
42 42
         return $args[0] + $args[1];
43 43
     };
44 44
     $session->register('com.myapp.add2', $add2);
45 45
 
46 46
     // 4) call a remote procedure
47 47
     $session->call('com.myapp.add2', [2, 3])->then(
48
-        function ($res) {
48
+        function($res) {
49 49
             echo "Result: {$res}\n";
50 50
         },
51
-        function ($error) {
51
+        function($error) {
52 52
             echo "Call Error: {$error}\n";
53 53
         }
54 54
     );
Please login to merge, or discard this patch.
examples/bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,6 +3,6 @@
 block discarded – undo
3 3
 ini_set('xdebug.max_nesting_level', '200');
4 4
 if (file_exists($file = realpath(__DIR__.'/..').'/vendor/autoload.php')) {
5 5
     $loader = require_once $file;
6
-} else {
6
+}else {
7 7
     throw new RuntimeException('autoload file not found in vendor path.');
8 8
 }
Please login to merge, or discard this patch.
examples/crossbar_session/monitor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
     ]
28 28
 );
29 29
 
30
-$connection->on('open', function (ClientSession $session) use ($connection, &$timer) {
30
+$connection->on('open', function(ClientSession $session) use ($connection, &$timer) {
31 31
     $sessionMonitor = new SessionMonitor(new Adapter($session));
32 32
 
33 33
 
34
-    $sessionMonitor->on('start', function ($l) {
34
+    $sessionMonitor->on('start', function($l) {
35 35
         echo "\n******** SESSION MONITOR STARTED ********\n";
36 36
         echo "\nSTART: \n";
37 37
         print_r($l);
38 38
     });
39 39
 
40
-    $sessionMonitor->on('list', function ($l) {
40
+    $sessionMonitor->on('list', function($l) {
41 41
         echo "\nLIST: \n";
42 42
         print_r($l);
43 43
     });
44 44
 
45
-    $sessionMonitor->on('join', function ($sessionData) {
45
+    $sessionMonitor->on('join', function($sessionData) {
46 46
         echo "\nJOIN: {$sessionData->session}\n";
47 47
     });
48 48
 
49
-    $sessionMonitor->on('leave', function ($sessionId) {
49
+    $sessionMonitor->on('leave', function($sessionId) {
50 50
         echo "\nLEAVE: $sessionId\n";
51 51
     });
52 52
 
53
-    $sessionMonitor->on('error', function ($l) {
53
+    $sessionMonitor->on('error', function($l) {
54 54
         echo "\nERROR: \n";
55 55
         print_r($l);
56 56
     });
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 }
60 60
 );
61 61
 
62
-$connection->on('close', function ($reason) use (&$timer) {
62
+$connection->on('close', function($reason) use (&$timer) {
63 63
     echo "The connected has closed with reason: {$reason}\n";
64 64
 });
65 65
 
66
-$connection->on('error', function ($reason) {
66
+$connection->on('error', function($reason) {
67 67
     echo "The connected has closed with error: {$reason}\n";
68 68
 });
69 69
 
Please login to merge, or discard this patch.
examples/crossbar_session/client.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@
 block discarded – undo
23 23
     $loop
24 24
 );
25 25
 
26
-$connection->on('open', function (ClientSession $session) use ($connection, $loop, &$timer) {
26
+$connection->on('open', function(ClientSession $session) use ($connection, $loop, &$timer) {
27 27
     echo "\nSession established: {$session->getSessionId()}\n";
28 28
 }
29 29
 );
30 30
 
31
-$connection->on('close', function ($reason) use ($loop, &$timer) {
31
+$connection->on('close', function($reason) use ($loop, &$timer) {
32 32
     if ($timer) {
33 33
         $loop->cancelTimer($timer);
34 34
     }
35 35
     echo "The connected has closed with reason: {$reason}\n";
36 36
 });
37 37
 
38
-$connection->on('error', function ($reason) {
38
+$connection->on('error', function($reason) {
39 39
     echo "The connected has closed with error: {$reason}\n";
40 40
 });
41 41
 
Please login to merge, or discard this patch.