@@ -3,21 +3,21 @@ |
||
3 | 3 | |
4 | 4 | class Worker extends \Workerman\Worker |
5 | 5 | { |
6 | - public static function runAll() |
|
7 | - { |
|
8 | - self::checkSapiEnv(); |
|
9 | - self::init(); |
|
10 | - self::parseCommand(); |
|
11 | - self::daemonize(); |
|
12 | - self::initWorkers(); |
|
13 | - self::installSignal(); |
|
14 | - self::saveMasterPid(); |
|
15 | - self::forkWorkers(); |
|
16 | - // @codeCoverageIgnoreStart |
|
17 | - self::resetStd(); |
|
18 | - self::monitorWorkers(); |
|
19 | - // @codeCoverageIgnoreEnd |
|
20 | - } // @codeCoverageIgnore |
|
6 | + public static function runAll() |
|
7 | + { |
|
8 | + self::checkSapiEnv(); |
|
9 | + self::init(); |
|
10 | + self::parseCommand(); |
|
11 | + self::daemonize(); |
|
12 | + self::initWorkers(); |
|
13 | + self::installSignal(); |
|
14 | + self::saveMasterPid(); |
|
15 | + self::forkWorkers(); |
|
16 | + // @codeCoverageIgnoreStart |
|
17 | + self::resetStd(); |
|
18 | + self::monitorWorkers(); |
|
19 | + // @codeCoverageIgnoreEnd |
|
20 | + } // @codeCoverageIgnore |
|
21 | 21 | |
22 | 22 | protected static function parseCommand() |
23 | 23 | { |
@@ -18,7 +18,7 @@ |
||
18 | 18 | require $wrapper_file; |
19 | 19 | } |
20 | 20 | $ref = new ReflectionClass($wrapper); |
21 | - if(!$ref->implementsInterface(ServerInterface::class)) { |
|
21 | + if (!$ref->implementsInterface(ServerInterface::class)) { |
|
22 | 22 | throw new Exception("$wrapper must be instance of Laravoole\\Wrapper\\ServerInterface", 1); |
23 | 23 | } |
24 | 24 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public static function decode($data) |
18 | 18 | { |
19 | 19 | $data = @json_decode($data); |
20 | - if(!isset($data->m) || !isset($data->p)) { |
|
20 | + if (!isset($data->m) || !isset($data->p)) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | 23 | return [ |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | public static function encode($statusCode, $method, $content, $echo) |
8 | 8 | { |
9 | - if($statusCode >= 400) { |
|
9 | + if ($statusCode >= 400) { |
|
10 | 10 | $error = $content; |
11 | 11 | $content = null; |
12 | 12 | } else { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public static function decode($data) |
25 | 25 | { |
26 | 26 | $data = @json_decode($data); |
27 | - if(!isset($data->method) || !isset($data->params)) { |
|
27 | + if (!isset($data->method) || !isset($data->params)) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | return [ |
@@ -39,7 +39,7 @@ |
||
39 | 39 | return $illuminateResponse->getFile()->getPathname(); |
40 | 40 | }; |
41 | 41 | if ($accept_gzip && isset($response->header['Content-Type'])) { |
42 | - $size = $illuminateResponse->getFile()->getSize(); |
|
42 | + $size = $illuminateResponse->getFile()->getSize(); |
|
43 | 43 | } |
44 | 44 | } else { |
45 | 45 | $content = $illuminateResponse->getContent(); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | } |
36 | 36 | // content |
37 | 37 | if ($illuminateResponse instanceof BinaryFileResponse) { |
38 | - $content = function () use ($illuminateResponse) { |
|
38 | + $content = function() use ($illuminateResponse) { |
|
39 | 39 | return $illuminateResponse->getFile()->getPathname(); |
40 | 40 | }; |
41 | 41 | if ($accept_gzip && isset($response->header['Content-Type'])) { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | fwrite(STDOUT, "Swoole worker $worker_id starting\n"); |
63 | 63 | parent::onWorkerStart($serv, $worker_id); |
64 | - $this->fastcgi = new FastCgi([$this, 'requestCallback'], [$this, 'sendCallback'], [$this, 'closeCallback'], function ($level, $info) { |
|
64 | + $this->fastcgi = new FastCgi([$this, 'requestCallback'], [$this, 'sendCallback'], [$this, 'closeCallback'], function($level, $info) { |
|
65 | 65 | fwrite(STDOUT, "$level $info"); |
66 | 66 | }); |
67 | 67 | // override |
@@ -39,14 +39,14 @@ |
||
39 | 39 | |
40 | 40 | public function endResponse($response, $content) |
41 | 41 | { |
42 | - $connection = $response->request->getLaravooleInfo()->workermanConnection; |
|
42 | + $connection = $response->request->getLaravooleInfo()->workermanConnection; |
|
43 | 43 | if (!is_string($content)) { |
44 | - $response->content = file_get_contents($content()); |
|
44 | + $response->content = file_get_contents($content()); |
|
45 | 45 | } else { |
46 | - $response->content = $content; |
|
46 | + $response->content = $content; |
|
47 | 47 | } |
48 | 48 | $rawContent = $response->getRawContent(); |
49 | - $connection->maxSendBufferSize = strlen($rawContent); |
|
49 | + $connection->maxSendBufferSize = strlen($rawContent); |
|
50 | 50 | $connection->close($rawContent, true); |
51 | 51 | } |
52 | 52 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | $input = file_get_contents('php://stdin'); |
3 | -spl_autoload_register(function ($class) { |
|
3 | +spl_autoload_register(function($class) { |
|
4 | 4 | if (is_file($file = __DIR__ . '/' . substr(strtr($class, '\\', '/'), 10) . '.php')) { |
5 | 5 | require $file; |
6 | 6 | return true; |
@@ -37,7 +37,7 @@ |
||
37 | 37 | |
38 | 38 | protected function convertUploadedFiles(array $files) |
39 | 39 | { |
40 | - return array_map(function ($file) { |
|
40 | + return array_map(function($file) { |
|
41 | 41 | if (is_null($file) || (is_array($file) && empty(array_filter($file)))) { |
42 | 42 | return $file; |
43 | 43 | } |