@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function start() |
55 | 55 | { |
56 | - $this->once('list', function () { |
|
56 | + $this->once('list', function() { |
|
57 | 57 | $this->doStart(); |
58 | 58 | }); |
59 | 59 | $this->startSubscriptions(); |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | public function getSessionInfo($sessionId, callable $callback) |
88 | 88 | { |
89 | 89 | return $this->session->call(self::SESSION_INFO_TOPIC, [$sessionId])->then( |
90 | - function ($res) use ($callback) { |
|
90 | + function($res) use ($callback) { |
|
91 | 91 | $this->emit('info', [$res[0]]); |
92 | 92 | $callback($res[0]); |
93 | 93 | }, |
94 | - function ($error) { |
|
94 | + function($error) { |
|
95 | 95 | $this->emit('error', [$error]); |
96 | 96 | } |
97 | 97 | ); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | if (!count($this->sessionIds)) { |
111 | 111 | $this->retrieveSessionIds($callback); |
112 | - } else { |
|
112 | + }else { |
|
113 | 113 | $callback($this->sessionIds); |
114 | 114 | } |
115 | 115 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function startSubscriptions() |
121 | 121 | { |
122 | - $this->session->subscribe(self::SESSION_JOIN_TOPIC, function ($res) { |
|
122 | + $this->session->subscribe(self::SESSION_JOIN_TOPIC, function($res) { |
|
123 | 123 | $sessionInfo = $res[0]; |
124 | 124 | $sessionId = $sessionInfo->session; |
125 | 125 | if ((array_search($sessionId, $this->sessionIds)) === false) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $this->emit('join', [$sessionInfo]); |
128 | 128 | } |
129 | 129 | }); |
130 | - $this->session->subscribe(self::SESSION_LEAVE_TOPIC, function ($res) { |
|
130 | + $this->session->subscribe(self::SESSION_LEAVE_TOPIC, function($res) { |
|
131 | 131 | // @bug : wamp.session.on_leave is bugged as of crossbar.io 0.11.0 |
132 | 132 | // will provide sessionID when Browser closes/reloads, |
133 | 133 | // but not when calling connection.close(); |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | protected function retrieveSessionIds(callable $callback = null) |
157 | 157 | { |
158 | 158 | $this->session->call(self::SESSION_LIST_TOPIC, [])->then( |
159 | - function ($res) use ($callback) { |
|
159 | + function($res) use ($callback) { |
|
160 | 160 | // remove our own sessionID from the tracked sessions |
161 | 161 | $sessionIds = $this->removeOwnSessionId($res[0]); |
162 | 162 | $this->setList($sessionIds); |
163 | 163 | $this->emit('list', [$this->getList()]); |
164 | - if($callback !== null){ |
|
164 | + if ($callback !== null) { |
|
165 | 165 | $callback($this->sessionIds); |
166 | 166 | } |
167 | 167 | }, |
168 | - function ($error) { |
|
168 | + function($error) { |
|
169 | 169 | $this->emit('error', [$error]); |
170 | 170 | } |
171 | 171 | ); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | protected function removeOwnSessionId(array $sessionsIds) |
191 | 191 | { |
192 | 192 | $key = array_search($this->session->getSessionId(), $sessionsIds); |
193 | - if($key >= 0){ |
|
193 | + if ($key >= 0) { |
|
194 | 194 | unset($sessionsIds[$key]); |
195 | 195 | } |
196 | 196 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once realpath(__DIR__ . "/..") . "/bootstrap.php"; |
|
3 | +require_once realpath(__DIR__."/..")."/bootstrap.php"; |
|
4 | 4 | |
5 | 5 | /* |
6 | 6 | * This file is part of the Tidal/WampWatch package. |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | $client = new Client("realm1"); |
21 | 21 | $client->addTransportProvider(new PawlTransportProvider("ws://127.0.0.1:9999/")); |
22 | 22 | |
23 | -$client->on('open', function (ClientSession $session) { |
|
23 | +$client->on('open', function(ClientSession $session) { |
|
24 | 24 | |
25 | 25 | // 1) subscribe to a topic |
26 | - $onevent = function ($args) { |
|
26 | + $onevent = function($args) { |
|
27 | 27 | echo "Event {$args[0]}\n"; |
28 | 28 | }; |
29 | 29 | $session->subscribe('com.myapp.hello', $onevent); |
30 | 30 | |
31 | 31 | // 2) publish an event |
32 | 32 | $session->publish('com.myapp.hello', ['Hello, world from PHP!!!'], [], ["acknowledge" => true])->then( |
33 | - function () { |
|
33 | + function() { |
|
34 | 34 | echo "Publish Acknowledged!\n"; |
35 | 35 | }, |
36 | - function ($error) { |
|
36 | + function($error) { |
|
37 | 37 | // publish failed |
38 | 38 | echo "Publish Error {$error}\n"; |
39 | 39 | } |
40 | 40 | ); |
41 | 41 | |
42 | 42 | // 3) register a procedure for remoting |
43 | - $add2 = function ($args) { |
|
43 | + $add2 = function($args) { |
|
44 | 44 | return $args[0] + $args[1]; |
45 | 45 | }; |
46 | 46 | $session->register('com.myapp.add2', $add2); |
47 | 47 | |
48 | 48 | // 4) call a remote procedure |
49 | 49 | $session->call('com.myapp.add2', [2, 3])->then( |
50 | - function ($res) { |
|
50 | + function($res) { |
|
51 | 51 | echo "Result: {$res}\n"; |
52 | 52 | }, |
53 | - function ($error) { |
|
53 | + function($error) { |
|
54 | 54 | echo "Call Error: {$error}\n"; |
55 | 55 | } |
56 | 56 | ); |
@@ -38,22 +38,22 @@ |
||
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 | }); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once realpath(__DIR__ . "/..") . "/bootstrap.php"; |
|
3 | +require_once realpath(__DIR__."/..")."/bootstrap.php"; |
|
4 | 4 | require_once 'InternalSessionMonitor.php'; |
5 | 5 | |
6 | 6 | /* |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once realpath(__DIR__ . "/..") . "/bootstrap.php"; |
|
3 | +require_once realpath(__DIR__."/..")."/bootstrap.php"; |
|
4 | 4 | |
5 | 5 | /* |
6 | 6 | * This file is part of the Tidal/WampWatch package. |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | $loop |
27 | 27 | ); |
28 | 28 | |
29 | -$connection->on('open', function (ClientSession $session) use ($connection, $loop, &$timer) { |
|
29 | +$connection->on('open', function(ClientSession $session) use ($connection, $loop, &$timer) { |
|
30 | 30 | |
31 | 31 | echo "\nSession established: {$session->getSessionId()}\n"; |
32 | 32 | |
33 | 33 | } |
34 | 34 | ); |
35 | 35 | |
36 | -$connection->on('close', function ($reason) use ($loop, &$timer) { |
|
36 | +$connection->on('close', function($reason) use ($loop, &$timer) { |
|
37 | 37 | if ($timer) { |
38 | 38 | $loop->cancelTimer($timer); |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | }); |
43 | 43 | |
44 | -$connection->on('error', function ($reason) { |
|
44 | +$connection->on('error', function($reason) { |
|
45 | 45 | echo "The connected has closed with error: {$reason}\n"; |
46 | 46 | }); |
47 | 47 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once realpath(__DIR__ . "/..") . "/bootstrap.php"; |
|
3 | +require_once realpath(__DIR__."/..")."/bootstrap.php"; |
|
4 | 4 | |
5 | 5 | /* |
6 | 6 | * This file is part of the Tidal/WampWatch package. |
@@ -31,32 +31,32 @@ discard block |
||
31 | 31 | ] |
32 | 32 | ); |
33 | 33 | |
34 | -$connection->on('open', function (ClientSession $session) use ($connection, &$timer) { |
|
34 | +$connection->on('open', function(ClientSession $session) use ($connection, &$timer) { |
|
35 | 35 | |
36 | 36 | |
37 | 37 | $sessionMonitor = new SessionMonitor(new Adapter($session)); |
38 | 38 | |
39 | 39 | |
40 | - $sessionMonitor->on('start', function ($l) { |
|
40 | + $sessionMonitor->on('start', function($l) { |
|
41 | 41 | echo "\n******** SESSION MONITOR STARTED ********\n"; |
42 | 42 | echo "\nSTART: \n"; |
43 | 43 | print_r($l); |
44 | 44 | }); |
45 | 45 | |
46 | - $sessionMonitor->on('list', function ($l) { |
|
46 | + $sessionMonitor->on('list', function($l) { |
|
47 | 47 | echo "\nLIST: \n"; |
48 | 48 | print_r($l); |
49 | 49 | }); |
50 | 50 | |
51 | - $sessionMonitor->on('join', function ($sessionData) { |
|
51 | + $sessionMonitor->on('join', function($sessionData) { |
|
52 | 52 | echo "\nJOIN: {$sessionData->session}\n"; |
53 | 53 | }); |
54 | 54 | |
55 | - $sessionMonitor->on('leave', function ($sessionId) { |
|
55 | + $sessionMonitor->on('leave', function($sessionId) { |
|
56 | 56 | echo "\nLEAVE: $sessionId\n"; |
57 | 57 | }); |
58 | 58 | |
59 | - $sessionMonitor->on('error', function ($l) { |
|
59 | + $sessionMonitor->on('error', function($l) { |
|
60 | 60 | echo "\nERROR: \n"; |
61 | 61 | print_r($l); |
62 | 62 | }); |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | } |
68 | 68 | ); |
69 | 69 | |
70 | -$connection->on('close', function ($reason) use (&$timer) { |
|
70 | +$connection->on('close', function($reason) use (&$timer) { |
|
71 | 71 | |
72 | 72 | echo "The connected has closed with reason: {$reason}\n"; |
73 | 73 | |
74 | 74 | }); |
75 | 75 | |
76 | -$connection->on('error', function ($reason) { |
|
76 | +$connection->on('error', function($reason) { |
|
77 | 77 | echo "The connected has closed with error: {$reason}\n"; |
78 | 78 | }); |
79 | 79 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | ini_set('xdebug.max_nesting_level', '200'); |
4 | -if (file_exists($file = realpath(__DIR__ . "/..") . '/vendor/autoload.php')) { |
|
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 | } |