@@ -31,12 +31,14 @@ |
||
31 | 31 | |
32 | 32 | $fs = new Files(); |
33 | 33 | |
34 | - if ($fs->isDirectory(__DIR__ . '/../app/migrations')) { |
|
34 | + if ($fs->isDirectory(__DIR__ . '/../app/migrations')) |
|
35 | + { |
|
35 | 36 | $fs->deleteDirectory(__DIR__ . '/../app/migrations'); |
36 | 37 | } |
37 | 38 | |
38 | 39 | $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime'); |
39 | - if ($fs->isDirectory($runtime)) { |
|
40 | + if ($fs->isDirectory($runtime)) |
|
41 | + { |
|
40 | 42 | $fs->deleteDirectory($runtime); |
41 | 43 | } |
42 | 44 | } |
@@ -133,7 +133,8 @@ |
||
133 | 133 | string $footer, |
134 | 134 | array $options |
135 | 135 | ): Append { |
136 | - if (is_array($sequence) || $sequence instanceof \Closure) { |
|
136 | + if (is_array($sequence) || $sequence instanceof \Closure) |
|
137 | + { |
|
137 | 138 | return new Append( |
138 | 139 | $target, |
139 | 140 | null, |
@@ -38,15 +38,19 @@ |
||
38 | 38 | public function getServices(): array |
39 | 39 | { |
40 | 40 | $result = []; |
41 | - foreach ($this->classes->getClasses(ServiceInterface::class) as $service) { |
|
42 | - if (!$service->isInstantiable()) { |
|
41 | + foreach ($this->classes->getClasses(ServiceInterface::class) as $service) |
|
42 | + { |
|
43 | + if (!$service->isInstantiable()) |
|
44 | + { |
|
43 | 45 | continue; |
44 | 46 | } |
45 | 47 | |
46 | 48 | $instance = $this->container->get($service->getName()); |
47 | 49 | |
48 | - foreach ($service->getInterfaces() as $interface) { |
|
49 | - if ($interface->isSubclassOf(ServiceInterface::class)) { |
|
50 | + foreach ($service->getInterfaces() as $interface) |
|
51 | + { |
|
52 | + if ($interface->isSubclassOf(ServiceInterface::class)) |
|
53 | + { |
|
50 | 54 | $result[$interface->getName()] = $instance; |
51 | 55 | } |
52 | 56 | } |
@@ -26,7 +26,8 @@ |
||
26 | 26 | string $clientFilename = null, |
27 | 27 | string $clientMediaType = null |
28 | 28 | ): UploadedFileInterface { |
29 | - if ($size === null) { |
|
29 | + if ($size === null) |
|
30 | + { |
|
30 | 31 | $size = $stream->getSize(); |
31 | 32 | } |
32 | 33 |
@@ -37,7 +37,8 @@ |
||
37 | 37 | $response = new Response('php://memory', $code, []); |
38 | 38 | $response = $response->withStatus($code, $reasonPhrase); |
39 | 39 | |
40 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
40 | + foreach ($this->config->getBaseHeaders() as $header => $value) |
|
41 | + { |
|
41 | 42 | $response = $response->withAddedHeader($header, $value); |
42 | 43 | } |
43 | 44 |
@@ -40,21 +40,26 @@ discard block |
||
40 | 40 | { |
41 | 41 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
42 | 42 | |
43 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
43 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
44 | + { |
|
44 | 45 | throw new BootException( |
45 | 46 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
46 | 47 | ); |
47 | 48 | } |
48 | 49 | |
49 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
50 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
51 | + { |
|
50 | 52 | throw new BootException( |
51 | 53 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
52 | 54 | ); |
53 | 55 | } |
54 | 56 | |
55 | - if ($parts[1] == 'unix') { |
|
57 | + if ($parts[1] == 'unix') |
|
58 | + { |
|
56 | 59 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
57 | - } else { |
|
60 | + } |
|
61 | + else |
|
62 | + { |
|
58 | 63 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
59 | 64 | } |
60 | 65 | |
@@ -69,25 +74,31 @@ discard block |
||
69 | 74 | { |
70 | 75 | $conn = $env->get('RR_RELAY', static::WORKER_DEFAULT); |
71 | 76 | |
72 | - if ($conn === 'pipes' || empty($conn)) { |
|
77 | + if ($conn === 'pipes' || empty($conn)) |
|
78 | + { |
|
73 | 79 | return new Worker(new StreamRelay(STDIN, STDOUT)); |
74 | 80 | } |
75 | 81 | |
76 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
82 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
83 | + { |
|
77 | 84 | throw new BootException( |
78 | 85 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
79 | 86 | ); |
80 | 87 | } |
81 | 88 | |
82 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
89 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
90 | + { |
|
83 | 91 | throw new BootException( |
84 | 92 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
85 | 93 | ); |
86 | 94 | } |
87 | 95 | |
88 | - if ($parts[1] == 'unix') { |
|
96 | + if ($parts[1] == 'unix') |
|
97 | + { |
|
89 | 98 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
90 | - } else { |
|
99 | + } |
|
100 | + else |
|
101 | + { |
|
91 | 102 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
92 | 103 | } |
93 | 104 |
@@ -37,8 +37,10 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) |
|
41 | + { |
|
42 | + if ($class->isAbstract()) |
|
43 | + { |
|
42 | 44 | continue; |
43 | 45 | } |
44 | 46 |
@@ -45,17 +45,21 @@ discard block |
||
45 | 45 | string $mergeMode = self::FOLLOW, |
46 | 46 | int $mode = FilesInterface::READONLY |
47 | 47 | ): void { |
48 | - if (!$this->files->isFile($filename)) { |
|
48 | + if (!$this->files->isFile($filename)) |
|
49 | + { |
|
49 | 50 | throw new PublishException("Given '{$filename}' is not valid file"); |
50 | 51 | } |
51 | 52 | |
52 | - if ($this->files->exists($destination)) { |
|
53 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
53 | + if ($this->files->exists($destination)) |
|
54 | + { |
|
55 | + if ($this->files->md5($destination) == $this->files->md5($filename)) |
|
56 | + { |
|
54 | 57 | //Nothing to do |
55 | 58 | return; |
56 | 59 | } |
57 | 60 | |
58 | - if ($mergeMode == self::FOLLOW) { |
|
61 | + if ($mergeMode == self::FOLLOW) |
|
62 | + { |
|
59 | 63 | return; |
60 | 64 | } |
61 | 65 | } |
@@ -77,7 +81,8 @@ discard block |
||
77 | 81 | string $mergeMode = self::REPLACE, |
78 | 82 | int $mode = FilesInterface::READONLY |
79 | 83 | ): void { |
80 | - if (!$this->files->isDirectory($directory)) { |
|
84 | + if (!$this->files->isDirectory($directory)) |
|
85 | + { |
|
81 | 86 | throw new PublishException("Given '{$directory}' is not valid directory"); |
82 | 87 | } |
83 | 88 | |
@@ -87,7 +92,8 @@ discard block |
||
87 | 92 | /** |
88 | 93 | * @var SplFileInfo $file |
89 | 94 | */ |
90 | - foreach ($finder->getIterator() as $file) { |
|
95 | + foreach ($finder->getIterator() as $file) |
|
96 | + { |
|
91 | 97 | $this->publish( |
92 | 98 | (string)$file, |
93 | 99 | $destination . '/' . $file->getRelativePathname(), |
@@ -46,7 +46,8 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface |
48 | 48 | { |
49 | - if (!$this->container->has(ServerRequestInterface::class)) { |
|
49 | + if (!$this->container->has(ServerRequestInterface::class)) |
|
50 | + { |
|
50 | 51 | throw new ScopeException('Unable to create paginator, no request scope found'); |
51 | 52 | } |
52 | 53 | /** |
@@ -56,7 +57,8 @@ discard block |
||
56 | 57 | |
57 | 58 | //Getting page number |
58 | 59 | $page = 0; |
59 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
60 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])) |
|
61 | + { |
|
60 | 62 | $page = (int)$query[$parameter]; |
61 | 63 | } |
62 | 64 |