@@ -90,7 +90,7 @@ |
||
| 90 | 90 | do { |
| 91 | 91 | $l = @socket_recvfrom($this->fd, $buf, 10240, MSG_DONTWAIT, $host, $port); |
| 92 | 92 | if ($l) { |
| 93 | - $key = '['.$host . ']:' . $port; |
|
| 93 | + $key = '[' . $host . ']:' . $port; |
|
| 94 | 94 | if (!isset($this->portsMap[$key])) { |
| 95 | 95 | |
| 96 | 96 | if ($this->pool->allowedClients !== null) { |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | /** |
| 63 | 63 | * Called when the worker is ready to go. |
| 64 | 64 | * @return void |
| 65 | - */ |
|
| 65 | + */ |
|
| 66 | 66 | public function onReady() { |
| 67 | 67 | parent::onReady(); |
| 68 | 68 | $this->WS = WebSocketServer::getInstance(); |
@@ -82,8 +82,7 @@ discard block |
||
| 82 | 82 | // No auth |
| 83 | 83 | $m = "\x00"; |
| 84 | 84 | $this->state = self::STATE_AUTHORIZED; |
| 85 | - } |
|
| 86 | - elseif (strpos($methods, "\x02") !== FALSE) { |
|
| 85 | + } elseif (strpos($methods, "\x02") !== FALSE) { |
|
| 87 | 86 | // Username/Password authentication |
| 88 | 87 | $m = "\x02"; |
| 89 | 88 | $this->state = self::STATE_HANDSHAKED; |
@@ -100,8 +99,7 @@ discard block |
||
| 100 | 99 | } else { |
| 101 | 100 | goto start; |
| 102 | 101 | } |
| 103 | - } |
|
| 104 | - elseif ($this->state === self::STATE_HANDSHAKED) { |
|
| 102 | + } elseif ($this->state === self::STATE_HANDSHAKED) { |
|
| 105 | 103 | // Handshaked |
| 106 | 104 | if ($l < 3) { |
| 107 | 105 | // Not enough data yet |
@@ -151,8 +149,7 @@ discard block |
||
| 151 | 149 | } else { |
| 152 | 150 | goto start; |
| 153 | 151 | } |
| 154 | - } |
|
| 155 | - elseif ($this->state === self::STATE_AUTHORIZED) { |
|
| 152 | + } elseif ($this->state === self::STATE_AUTHORIZED) { |
|
| 156 | 153 | // Ready for query |
| 157 | 154 | if ($l < 4) { |
| 158 | 155 | // Not enough data yet |
@@ -173,14 +170,12 @@ discard block |
||
| 173 | 170 | if ($atype === "\x01") { |
| 174 | 171 | $address = inet_ntop(binarySubstr($this->buf, $pl, 4)); |
| 175 | 172 | $pl += 4; |
| 176 | - } |
|
| 177 | - elseif ($atype === "\x03") { |
|
| 173 | + } elseif ($atype === "\x03") { |
|
| 178 | 174 | $len = ord(binarySubstr($this->buf, $pl, 1)); |
| 179 | 175 | ++$pl; |
| 180 | 176 | $address = binarySubstr($this->buf, $pl, $len); |
| 181 | 177 | $pl += $len; |
| 182 | - } |
|
| 183 | - elseif ($atype === "\x04") { |
|
| 178 | + } elseif ($atype === "\x04") { |
|
| 184 | 179 | $address = inet_ntop(binarySubstr($this->buf, $pl, 16)); |
| 185 | 180 | $pl += 16; |
| 186 | 181 | } else { |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * Called when new data received |
| 25 | 25 | * @param string New data |
| 26 | 26 | * @return void |
| 27 | - */ |
|
| 27 | + */ |
|
| 28 | 28 | public function stdin($buf) { |
| 29 | 29 | $this->buf .= $buf; |
| 30 | 30 | start: |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | |
| 10 | 10 | class RedisClientConnection extends NetworkClientConnection { |
| 11 | 11 | |
| 12 | - public $result = null; // current result (array) |
|
| 12 | + public $result = null; // current result (array) |
|
| 13 | 13 | public $resultLength = 0; |
| 14 | - public $resultSize = 0; // number of received array items in result |
|
| 14 | + public $resultSize = 0; // number of received array items in result |
|
| 15 | 15 | public $value = ''; |
| 16 | - public $valueLength = 0; // length of incoming value |
|
| 17 | - public $valueSize = 0; // size of received part of the value |
|
| 18 | - public $error; // error message |
|
| 19 | - public $key; // current incoming key |
|
| 20 | - public $EOL = "\r\n"; // EOL for gets() and writeln() |
|
| 16 | + public $valueLength = 0; // length of incoming value |
|
| 17 | + public $valueSize = 0; // size of received part of the value |
|
| 18 | + public $error; // error message |
|
| 19 | + public $key; // current incoming key |
|
| 20 | + public $EOL = "\r\n"; // EOL for gets() and writeln() |
|
| 21 | 21 | const STATE_BINARY = 1; |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -51,21 +51,18 @@ |
||
| 51 | 51 | $this->result = array((int) binarySubstr($l, 1)); |
| 52 | 52 | } |
| 53 | 53 | goto start; |
| 54 | - } |
|
| 55 | - elseif (($char == '+') || ($char == '-')) { // inline string |
|
| 54 | + } elseif (($char == '+') || ($char == '-')) { // inline string |
|
| 56 | 55 | $this->resultLength = 1; |
| 57 | 56 | $this->resultSize = 1; |
| 58 | 57 | $this->error = ($char == '-'); |
| 59 | 58 | $this->result = array(binarySubstr($l, 1)); |
| 60 | 59 | goto start; |
| 61 | - } |
|
| 62 | - elseif ($char == '*') { // defines number of elements of incoming array |
|
| 60 | + } elseif ($char == '*') { // defines number of elements of incoming array |
|
| 63 | 61 | $this->resultLength = (int) substr($l, 1); |
| 64 | 62 | $this->resultSize = 0; |
| 65 | 63 | $this->result = array(); |
| 66 | 64 | goto start; |
| 67 | - } |
|
| 68 | - elseif ($char == '$') { // defines size of the data block |
|
| 65 | + } elseif ($char == '$') { // defines size of the data block |
|
| 69 | 66 | $this->valueLength = (int) substr($l, 1); |
| 70 | 67 | $this->state = self::STATE_BINARY; // binary data block |
| 71 | 68 | break; // stop reading line-by-line |
@@ -26,8 +26,8 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function __call($name, $args) { |
| 28 | 28 | $onResponse = null; |
| 29 | - if (($e = end($args)) && (is_array($e) || is_object($e)) && is_callable($e)) { |
|
| 30 | - $onResponse= array_pop($args); |
|
| 29 | + if (($e = end($args)) && (is_array($e) || is_object($e)) && is_callable($e)) { |
|
| 30 | + $onResponse = array_pop($args); |
|
| 31 | 31 | } |
| 32 | 32 | reset($args); |
| 33 | 33 | $name = strtoupper($name); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | if (@inet_pton($host) === false) { // dirty condition check |
| 173 | 173 | DNSClient::getInstance()->resolve($host, function($result) use ($host) { |
| 174 | 174 | if ($result === false) { |
| 175 | - Daemon::log(get_class($this).'->connectTo (raw) : enable to resolve hostname: '.$host); |
|
| 175 | + Daemon::log(get_class($this) . '->connectTo (raw) : enable to resolve hostname: ' . $host); |
|
| 176 | 176 | $this->onFailureEvent(null); |
| 177 | 177 | return; |
| 178 | 178 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } else { |
| 185 | 185 | $real = $result; |
| 186 | 186 | } |
| 187 | - $this->connectTo('raw:'. $real); |
|
| 187 | + $this->connectTo('raw:' . $real); |
|
| 188 | 188 | }); |
| 189 | 189 | return; |
| 190 | 190 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | if ($pton === false) { // dirty condition check |
| 211 | 211 | DNSClient::getInstance()->resolve($host, function($result) use ($host) { |
| 212 | 212 | if ($result === false) { |
| 213 | - Daemon::log(get_class($this).'->connectTo (udp) : enable to resolve hostname: '.$host); |
|
| 213 | + Daemon::log(get_class($this) . '->connectTo (udp) : enable to resolve hostname: ' . $host); |
|
| 214 | 214 | $this->onStateEvent($this->bev, EventBufferEvent::ERROR); |
| 215 | 215 | return; |
| 216 | 216 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | if ($pton === false) { // dirty condition check |
| 257 | 257 | DNSClient::getInstance()->resolve($this->host, function($result) use ($host) { |
| 258 | 258 | if ($result === false) { |
| 259 | - Daemon::log(get_class($this).'->connectTo (tcp) : enable to resolve hostname: '.$host); |
|
| 259 | + Daemon::log(get_class($this) . '->connectTo (tcp) : enable to resolve hostname: ' . $host); |
|
| 260 | 260 | $this->onStateEvent($this->bev, EventBufferEvent::ERROR); |
| 261 | 261 | return; |
| 262 | 262 | } |
@@ -162,8 +162,7 @@ discard block |
||
| 162 | 162 | socket_set_option($fd, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $this->timeout, 'usec' => 0)); |
| 163 | 163 | socket_set_option($fd, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $this->timeout, 'usec' => 0)); |
| 164 | 164 | @socket_connect($fd, $e[1], 0); |
| 165 | - } |
|
| 166 | - elseif (stripos($addr, 'raw:') === 0) { |
|
| 165 | + } elseif (stripos($addr, 'raw:') === 0) { |
|
| 167 | 166 | $this->type = 'raw'; |
| 168 | 167 | // Raw-socket |
| 169 | 168 | $this->addr = $addr; |
@@ -200,8 +199,7 @@ discard block |
||
| 200 | 199 | socket_set_option($fd, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $this->timeout, 'usec' => 0)); |
| 201 | 200 | socket_set_nonblock($fd); |
| 202 | 201 | @socket_connect($fd, $host, 0); |
| 203 | - } |
|
| 204 | - elseif (stripos($addr, 'udp:') === 0) { |
|
| 202 | + } elseif (stripos($addr, 'udp:') === 0) { |
|
| 205 | 203 | $this->type = 'udp'; |
| 206 | 204 | // UDP-socket |
| 207 | 205 | $this->addr = $addr; |
@@ -308,8 +306,7 @@ discard block |
||
| 308 | 306 | if (!$this->bevConnectEnabled) { |
| 309 | 307 | @socket_connect($fd, $host, $port); |
| 310 | 308 | socket_getsockname($fd, $this->locAddr, $this->locPort); |
| 311 | - } |
|
| 312 | - else { |
|
| 309 | + } else { |
|
| 313 | 310 | $this->bevConnect = true; |
| 314 | 311 | } |
| 315 | 312 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | class FlashPolicyServer extends NetworkServer { |
| 10 | 10 | |
| 11 | - public $policyData; // Cached policy-file. |
|
| 11 | + public $policyData; // Cached policy-file. |
|
| 12 | 12 | /** |
| 13 | 13 | * Setting default config options |
| 14 | 14 | * Overriden from ConnectionPool::getConfigDefaults |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | protected function getConfigDefaults() { |
| 18 | 18 | return array( |
| 19 | 19 | // @todo add description strings |
| 20 | - 'file' => getcwd().'/conf/crossdomain.xml', |
|
| 20 | + 'file' => getcwd() . '/conf/crossdomain.xml', |
|
| 21 | 21 | 'listen' => '0.0.0.0', |
| 22 | 22 | 'port' => 843, |
| 23 | 23 | ); |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | $this->write("<error/>\x00"); |
| 61 | 61 | } |
| 62 | 62 | $this->finish(); |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | $this->finish(); |
| 66 | 65 | } |
| 67 | 66 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | if (!isset($this->files[$path])) { |
| 34 | 34 | $this->files[$path] = array(); |
| 35 | 35 | if ($this->inotify) { |
| 36 | - $this->descriptors[inotify_add_watch($this->inotify, $path,$flags?:IN_MODIFY)] = $path; |
|
| 36 | + $this->descriptors[inotify_add_watch($this->inotify, $path, $flags ?: IN_MODIFY)] = $path; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | $this->files[$path][] = $subscriber; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $path = realpath($path); |
| 46 | 46 | |
| 47 | - if (!isset($this->files[$path])) {return false;} |
|
| 47 | + if (!isset($this->files[$path])) {return false; } |
|
| 48 | 48 | if (($k = array_search($subscriber, $this->files[$path], true)) !== false) { |
| 49 | 49 | unset($this->files[$path][$k]); |
| 50 | 50 | } |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | foreach ($this->files[$path] as $k => $subscriber) { |
| 67 | 67 | if (is_callable($subscriber) || is_array($subscriber)) { |
| 68 | 68 | call_user_func($subscriber, $path); |
| 69 | - } |
|
| 70 | - elseif (!Daemon::$process->IPCManager->importFile($subscriber, $path)) { |
|
| 69 | + } elseif (!Daemon::$process->IPCManager->importFile($subscriber, $path)) { |
|
| 71 | 70 | $this->rmWatch($path, $subscriber); |
| 72 | 71 | } |
| 73 | 72 | } |
@@ -85,8 +84,7 @@ discard block |
||
| 85 | 84 | } |
| 86 | 85 | $this->onFileChanged($path); |
| 87 | 86 | } |
| 88 | - } |
|
| 89 | - else { |
|
| 87 | + } else { |
|
| 90 | 88 | static $hash = array(); |
| 91 | 89 | |
| 92 | 90 | foreach (array_keys($this->files) as $path) { |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | return 0; |
| 15 | 15 | } |
| 16 | 16 | return $pri1 < $pri2 ? -1 : 1; |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | public function executeOne() { |
| 19 | 19 | if ($this->isEmpty()) { |
| 20 | 20 | return false; |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | public function dequeue() { |
| 10 | 10 | return $this->extract(); |
| 11 | 11 | } |
| 12 | - public function compare($pri1, $pri2) { |
|
| 12 | + public function compare($pri1, $pri2) { |
|
| 13 | 13 | if ($pri1 === $pri2) { |
| 14 | 14 | return 0; |
| 15 | 15 | } |