@@ -31,12 +31,12 @@ |
||
| 31 | 31 | |
| 32 | 32 | $fs = new Files(); |
| 33 | 33 | |
| 34 | - if ($fs->isDirectory(__DIR__ . '/../app/migrations')) { |
|
| 35 | - $fs->deleteDirectory(__DIR__ . '/../app/migrations'); |
|
| 34 | + if ($fs->isDirectory(__DIR__.'/../app/migrations')){ |
|
| 35 | + $fs->deleteDirectory(__DIR__.'/../app/migrations'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime'); |
| 39 | - if ($fs->isDirectory($runtime)) { |
|
| 39 | + if ($fs->isDirectory($runtime)){ |
|
| 40 | 40 | $fs->deleteDirectory($runtime); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -38,15 +38,15 @@ |
||
| 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 | + if (!$service->isInstantiable()){ |
|
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $instance = $this->container->get($service->getName()); |
| 47 | 47 | |
| 48 | - foreach ($service->getInterfaces() as $interface) { |
|
| 49 | - if ($interface->isSubclassOf(ServiceInterface::class)) { |
|
| 48 | + foreach ($service->getInterfaces() as $interface){ |
|
| 49 | + if ($interface->isSubclassOf(ServiceInterface::class)){ |
|
| 50 | 50 | $result[$interface->getName()] = $instance; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | string $clientFilename = null, |
| 27 | 27 | string $clientMediaType = null |
| 28 | 28 | ): UploadedFileInterface { |
| 29 | - if ($size === null) { |
|
| 29 | + if ($size === null){ |
|
| 30 | 30 | $size = $stream->getSize(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -37,7 +37,7 @@ |
||
| 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 | $response = $response->withAddedHeader($header, $value); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -40,21 +40,21 @@ 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 | throw new BootException( |
| 45 | 45 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
| 49 | + if (!in_array($parts[1], ['tcp', 'unix'])){ |
|
| 50 | 50 | throw new BootException( |
| 51 | 51 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ($parts[1] == 'unix') { |
|
| 55 | + if ($parts[1] == 'unix'){ |
|
| 56 | 56 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
| 57 | - } else { |
|
| 57 | + }else{ |
|
| 58 | 58 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -69,25 +69,25 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | $conn = $env->get('RR_RELAY', static::WORKER_DEFAULT); |
| 71 | 71 | |
| 72 | - if ($conn === 'pipes' || empty($conn)) { |
|
| 72 | + if ($conn === 'pipes' || empty($conn)){ |
|
| 73 | 73 | return new Worker(new StreamRelay(STDIN, STDOUT)); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
| 76 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){ |
|
| 77 | 77 | throw new BootException( |
| 78 | 78 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
| 82 | + if (!in_array($parts[1], ['tcp', 'unix'])){ |
|
| 83 | 83 | throw new BootException( |
| 84 | 84 | "Unable to configure Worker connection, invalid DSN given `{$conn}`." |
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if ($parts[1] == 'unix') { |
|
| 88 | + if ($parts[1] == 'unix'){ |
|
| 89 | 89 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
| 90 | - } else { |
|
| 90 | + }else{ |
|
| 91 | 91 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | public function makeApp(array $env = []): TestApp |
| 18 | 18 | { |
| 19 | 19 | return TestApp::init([ |
| 20 | - 'root' => __DIR__ . '/../..', |
|
| 21 | - 'app' => __DIR__ . '/../app', |
|
| 22 | - 'runtime' => sys_get_temp_dir() . '/spiral', |
|
| 23 | - 'cache' => sys_get_temp_dir() . '/spiral', |
|
| 20 | + 'root' => __DIR__.'/../..', |
|
| 21 | + 'app' => __DIR__.'/../app', |
|
| 22 | + 'runtime' => sys_get_temp_dir().'/spiral', |
|
| 23 | + 'cache' => sys_get_temp_dir().'/spiral', |
|
| 24 | 24 | ], new Environment($env), false); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -37,8 +37,8 @@ |
||
| 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 | + if ($class->isAbstract()){ |
|
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -45,17 +45,17 @@ 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 | throw new PublishException("Given '{$filename}' is not valid file"); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ($this->files->exists($destination)) { |
|
| 53 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
| 52 | + if ($this->files->exists($destination)){ |
|
| 53 | + if ($this->files->md5($destination) == $this->files->md5($filename)){ |
|
| 54 | 54 | //Nothing to do |
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ($mergeMode == self::FOLLOW) { |
|
| 58 | + if ($mergeMode == self::FOLLOW){ |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | string $mergeMode = self::REPLACE, |
| 78 | 78 | int $mode = FilesInterface::READONLY |
| 79 | 79 | ): void { |
| 80 | - if (!$this->files->isDirectory($directory)) { |
|
| 80 | + if (!$this->files->isDirectory($directory)){ |
|
| 81 | 81 | throw new PublishException("Given '{$directory}' is not valid directory"); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * @var SplFileInfo $file |
| 89 | 89 | */ |
| 90 | - foreach ($finder->getIterator() as $file) { |
|
| 90 | + foreach ($finder->getIterator() as $file){ |
|
| 91 | 91 | $this->publish( |
| 92 | 92 | (string)$file, |
| 93 | - $destination . '/' . $file->getRelativePathname(), |
|
| 93 | + $destination.'/'.$file->getRelativePathname(), |
|
| 94 | 94 | $mergeMode, |
| 95 | 95 | $mode |
| 96 | 96 | ); |
@@ -46,7 +46,7 @@ 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 | throw new ScopeException('Unable to create paginator, no request scope found'); |
| 51 | 51 | } |
| 52 | 52 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | //Getting page number |
| 58 | 58 | $page = 0; |
| 59 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
| 59 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])){ |
|
| 60 | 60 | $page = (int)$query[$parameter]; |
| 61 | 61 | } |
| 62 | 62 | |