@@ -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 | ); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | |
124 | 124 | if ('log' === $runmode) { |
125 | - passthru('tail -n '.$n.' -f '.escapeshellarg(Daemon::$config->logstorage->value)); |
|
125 | + passthru('tail -n ' . $n . ' -f ' . escapeshellarg(Daemon::$config->logstorage->value)); |
|
126 | 126 | exit; |
127 | 127 | } |
128 | 128 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | if (isset(Daemon::$config->locale->value) && Daemon::$config->locale->value !== '') { |
134 | - setlocale(LC_ALL,explode(',', Daemon::$config->locale->value)); |
|
134 | + setlocale(LC_ALL, explode(',', Daemon::$config->locale->value)); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | if ( |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | elseif ($runmode == 'reopenlog') { |
330 | 330 | if ( |
331 | 331 | (!Daemon_Bootstrap::$pid) |
332 | - || (!posix_kill(Daemon_Bootstrap::$pid,SIGUSR1)) |
|
332 | + || (!posix_kill(Daemon_Bootstrap::$pid, SIGUSR1)) |
|
333 | 333 | ) { |
334 | 334 | echo '[REOPEN-LOG] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n"; |
335 | 335 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | elseif ($runmode == 'reload') { |
338 | 338 | if ( |
339 | 339 | (!Daemon_Bootstrap::$pid) |
340 | - || (!posix_kill(Daemon_Bootstrap::$pid,SIGUSR2)) |
|
340 | + || (!posix_kill(Daemon_Bootstrap::$pid, SIGUSR2)) |
|
341 | 341 | ) { |
342 | 342 | echo '[RELOAD] ERROR. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n"; |
343 | 343 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | ); |
369 | 369 | |
370 | 370 | foreach (Daemon::$config as $name => $entry) { |
371 | - if (!$entry instanceof Daemon_ConfigEntry) {continue;} |
|
371 | + if (!$entry instanceof Daemon_ConfigEntry) {continue; } |
|
372 | 372 | |
373 | 373 | $row = array( |
374 | 374 | 'parameter' => $name, |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | elseif ($runmode == 'hardstop') { |
393 | 393 | echo '[HARDSTOP] Sending SIGINT to ' . Daemon_Bootstrap::$pid . '... '; |
394 | 394 | |
395 | - $ok = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid,SIGINT); |
|
395 | + $ok = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid, SIGINT); |
|
396 | 396 | |
397 | 397 | echo $ok ? 'OK.' : 'ERROR. It seems that phpDaemon is not running.'; |
398 | 398 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | echo "\nAlso you can use some optional parameters to override the same configuration variables:\n"; |
439 | 439 | |
440 | - foreach(self::$params as $name => $desc) { |
|
440 | + foreach (self::$params as $name => $desc) { |
|
441 | 441 | if (empty($desc)) { |
442 | 442 | continue; |
443 | 443 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * @return void |
479 | 479 | */ |
480 | 480 | public static function stop($mode = 1) { |
481 | - $ok = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid, $mode === 3 ? SIGINT:SIGTERM); |
|
481 | + $ok = Daemon_Bootstrap::$pid && posix_kill(Daemon_Bootstrap::$pid, $mode === 3 ? SIGINT : SIGTERM); |
|
482 | 482 | |
483 | 483 | if (!$ok) { |
484 | 484 | echo '[WARN]. It seems that phpDaemon is not running' . (Daemon_Bootstrap::$pid ? ' (PID ' . Daemon_Bootstrap::$pid . ')' : '') . ".\n"; |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | $out = array(); |
507 | 507 | $last_arg = NULL; |
508 | 508 | |
509 | - for($i = 1, $il = sizeof($args); $i < $il; ++$i) { |
|
509 | + for ($i = 1, $il = sizeof($args); $i < $il; ++$i) { |
|
510 | 510 | if (preg_match('~^--(.+)~', $args[$i], $match)) { |
511 | 511 | $parts = explode('=', $match[1]); |
512 | 512 | $key = preg_replace('~[^a-z0-9]+~', '', $parts[0]); |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class AppInstance { |
11 | 11 | |
12 | - public $status = 0; // runtime status |
|
13 | - public $passphrase; // optional passphrase |
|
14 | - public $ready = FALSE; // ready to start? |
|
15 | - public $name; // name of instance |
|
12 | + public $status = 0; // runtime status |
|
13 | + public $passphrase; // optional passphrase |
|
14 | + public $ready = FALSE; // ready to start? |
|
15 | + public $name; // name of instance |
|
16 | 16 | public $config; |
17 | 17 | public $enableRPC = false; |
18 | 18 | public $requestClass; |
@@ -172,16 +172,16 @@ discard block |
||
172 | 172 | $k = strtolower(str_replace('-', '', $k)); |
173 | 173 | |
174 | 174 | if (!isset($this->config->{$k})) { |
175 | - if (is_scalar($v)) { |
|
175 | + if (is_scalar($v)) { |
|
176 | 176 | $this->config->{$k} = new Daemon_ConfigEntry($v); |
177 | 177 | } else { |
178 | 178 | $this->config->{$k} = $v; |
179 | 179 | } |
180 | 180 | } elseif ($v instanceof Daemon_ConfigSection) { |
181 | 181 | // @todo |
182 | - } else { |
|
182 | + } else { |
|
183 | 183 | $current = $this->config->{$k}; |
184 | - if (is_scalar($v)) { |
|
184 | + if (is_scalar($v)) { |
|
185 | 185 | $this->config->{$k} = new Daemon_ConfigEntry($v); |
186 | 186 | } else { |
187 | 187 | $this->config->{$k} = $v; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public static $fdCache; |
25 | 25 | public static $fdCacheSize = 128; |
26 | 26 | public static function init() { |
27 | - if (!self::$supported = Daemon::loadModuleIfAbsent('eio')) { |
|
27 | + if (!self::$supported = Daemon::loadModuleIfAbsent('eio')) { |
|
28 | 28 | Daemon::log('FS: missing pecl-eio, Filesystem I/O performance compromised. Consider installing pecl-eio.'); |
29 | 29 | return; |
30 | 30 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | self::updateConfig(); |
39 | 39 | self::$fd = eio_get_event_stream(); |
40 | - self::$ev = new Event(Daemon::$process->eventBase, self::$fd, Event::READ | Event::PERSIST, function ($fd, $events, $arg) { |
|
40 | + self::$ev = new Event(Daemon::$process->eventBase, self::$fd, Event::READ | Event::PERSIST, function($fd, $events, $arg) { |
|
41 | 41 | while (eio_nreqs()) { |
42 | 42 | eio_poll(); |
43 | 43 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | call_user_func($cb, $path, FS::statPrepare(@stat($path))); |
92 | 92 | return; |
93 | 93 | } |
94 | - return eio_stat($path, $pri, function($path, $stat) use ($cb) {call_user_func($cb, $path, FS::statPrepare($stat));}, $path); |
|
94 | + return eio_stat($path, $pri, function($path, $stat) use ($cb) {call_user_func($cb, $path, FS::statPrepare($stat)); }, $path); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public static function unlink($path, $cb = null, $pri = EIO_PRI_DEFAULT) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | call_user_func($cb, $path, FS::statPrepare(lstat($path))); |
119 | 119 | return; |
120 | 120 | } |
121 | - return eio_lstat($path, $pri, function($path, $stat) use ($cb) {call_user_func($cb, $path, FS::statPrepare($stat));}, $path); |
|
121 | + return eio_lstat($path, $pri, function($path, $stat) use ($cb) {call_user_func($cb, $path, FS::statPrepare($stat)); }, $path); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public static function realpath($path, $cb, $pri = EIO_PRI_DEFAULT) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | return eio_mkdir($path, $mode, $pri, $cb, $path); |
183 | 183 | } |
184 | 184 | |
185 | - public static function readdir($path, $cb = null, $flags, $pri = EIO_PRI_DEFAULT) { |
|
185 | + public static function readdir($path, $cb = null, $flags, $pri = EIO_PRI_DEFAULT) { |
|
186 | 186 | if (!FS::$supported) { |
187 | 187 | $r = glob($path); |
188 | 188 | if ($cb) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | call_user_func($cb, $path, false); |
212 | 212 | return; |
213 | 213 | } |
214 | - FS::open($path, 'r', function ($file) use ($cb, $path, $pri, $outfd, $offset, $length) { |
|
214 | + FS::open($path, 'r', function($file) use ($cb, $path, $pri, $outfd, $offset, $length) { |
|
215 | 215 | if (!$file) { |
216 | 216 | call_user_func($cb, $path, false); |
217 | 217 | return; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | call_user_func($cb, $path, file_get_contents($path)); |
239 | 239 | return; |
240 | 240 | } |
241 | - FS::open($path, 'r', function ($file) use ($cb, $pri, $path) { |
|
241 | + FS::open($path, 'r', function($file) use ($cb, $pri, $path) { |
|
242 | 242 | if (!$file) { |
243 | 243 | call_user_func($cb, $path, false); |
244 | 244 | return; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | call_user_func($cb, $r !== false); |
254 | 254 | return; |
255 | 255 | } |
256 | - FS::open($path, 'r', function ($file) use ($cb, $chunkcb, $pri) { |
|
256 | + FS::open($path, 'r', function($file) use ($cb, $chunkcb, $pri) { |
|
257 | 257 | if (!$file) { |
258 | 258 | call_user_func($cb, $file->path, false); |
259 | 259 | return; |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | $item = FS::$fdCache->put($fdCacheKey, null); |
284 | 284 | $item->addListener($cb); |
285 | 285 | } |
286 | - return eio_open($path, $flags , $mode, |
|
287 | - $pri, function ($arg, $fd) use ($cb, $path, $flags, $fdCacheKey, $noncache) { |
|
286 | + return eio_open($path, $flags, $mode, |
|
287 | + $pri, function($arg, $fd) use ($cb, $path, $flags, $fdCacheKey, $noncache) { |
|
288 | 288 | |
289 | 289 | if (!$fd) { |
290 | 290 | if ($noncache) { |
@@ -412,9 +412,7 @@ |
||
412 | 412 | |
413 | 413 | if (Daemon::$compatMode) { |
414 | 414 | return; |
415 | - } |
|
416 | - |
|
417 | - ++Daemon::$process->counterGC; |
|
415 | + }++Daemon::$process->counterGC; |
|
418 | 416 | |
419 | 417 | if (Daemon::$compatMode) { |
420 | 418 | return; |
@@ -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 | } |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | class MongoClientAsyncCursor { |
3 | - public $id; // Cursor's ID. |
|
4 | - public $col; // Collection's name. |
|
5 | - public $items = array(); // Array of objects |
|
6 | - public $item; // Current object |
|
7 | - public $conn; // Network connection |
|
8 | - public $finished = false; // Is this cursor finished? |
|
9 | - public $failure = false; // Is this query failured? |
|
10 | - public $await = false; // awaitCapable? |
|
11 | - public $destroyed = false; // Is this cursor destroyed? |
|
3 | + public $id; // Cursor's ID. |
|
4 | + public $col; // Collection's name. |
|
5 | + public $items = array(); // Array of objects |
|
6 | + public $item; // Current object |
|
7 | + public $conn; // Network connection |
|
8 | + public $finished = false; // Is this cursor finished? |
|
9 | + public $failure = false; // Is this query failured? |
|
10 | + public $await = false; // awaitCapable? |
|
11 | + public $destroyed = false; // Is this cursor destroyed? |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Constructor |
@@ -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 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | if (is_array($value)) { |
15 | 15 | return $value; |
16 | 16 | } |
17 | - $value = preg_replace_callback('~(".*?")|(\'.*?\')|(\s*,\s*)~s', function ($m) { |
|
17 | + $value = preg_replace_callback('~(".*?")|(\'.*?\')|(\s*,\s*)~s', function($m) { |
|
18 | 18 | if (!empty($m[3])) { |
19 | 19 | return "\x00"; |
20 | 20 | } |