@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | private readonly FileSnapshot $fileSnapshot |
11 | - ) { |
|
11 | + ){ |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function register(\Throwable $e): SnapshotInterface |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | string $filename, |
26 | 26 | string $destination, |
27 | 27 | string $mergeMode = self::FOLLOW, |
28 | - int $mode = FilesInterface::READONLY |
|
28 | + int $mode = FilesInterface::readonly |
|
29 | 29 | ): void; |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | string $directory, |
38 | 38 | string $destination, |
39 | 39 | string $mergeMode = self::REPLACE, |
40 | - int $mode = FilesInterface::READONLY |
|
40 | + int $mode = FilesInterface::readonly |
|
41 | 41 | ): void; |
42 | 42 | |
43 | 43 | /** |
@@ -45,5 +45,5 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @throws PublishException |
47 | 47 | */ |
48 | - public function ensureDirectory(string $directory, int $mode = FilesInterface::READONLY): void; |
|
48 | + public function ensureDirectory(string $directory, int $mode = FilesInterface::readonly): void; |
|
49 | 49 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function __construct( |
17 | 17 | private readonly FilesInterface $files |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function publish( |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | string $mergeMode = self::FOLLOW, |
25 | 25 | int $mode = FilesInterface::READONLY |
26 | 26 | ): void { |
27 | - if (!$this->files->isFile($filename)) { |
|
27 | + if (!$this->files->isFile($filename)){ |
|
28 | 28 | throw new PublishException(\sprintf("Given '%s' is not valid file", $filename)); |
29 | 29 | } |
30 | 30 | |
31 | - if ($this->files->exists($destination)) { |
|
32 | - if ($this->files->md5($destination) === $this->files->md5($filename)) { |
|
31 | + if ($this->files->exists($destination)){ |
|
32 | + if ($this->files->md5($destination) === $this->files->md5($filename)){ |
|
33 | 33 | //Nothing to do |
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
37 | - if ($mergeMode === self::FOLLOW) { |
|
37 | + if ($mergeMode === self::FOLLOW){ |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | } |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | string $mergeMode = self::REPLACE, |
54 | 54 | int $mode = FilesInterface::READONLY |
55 | 55 | ): void { |
56 | - if (!$this->files->isDirectory($directory)) { |
|
56 | + if (!$this->files->isDirectory($directory)){ |
|
57 | 57 | throw new PublishException(\sprintf("Given '%s' is not valid directory", $directory)); |
58 | 58 | } |
59 | 59 | |
60 | 60 | $finder = new Finder(); |
61 | 61 | $finder->files()->in($directory); |
62 | 62 | |
63 | - foreach ($finder->getIterator() as $file) { |
|
63 | + foreach ($finder->getIterator() as $file){ |
|
64 | 64 | $this->publish( |
65 | 65 | (string)$file, |
66 | - $destination . '/' . $file->getRelativePathname(), |
|
66 | + $destination.'/'.$file->getRelativePathname(), |
|
67 | 67 | $mergeMode, |
68 | 68 | $mode |
69 | 69 | ); |
@@ -24,17 +24,21 @@ discard block |
||
24 | 24 | string $mergeMode = self::FOLLOW, |
25 | 25 | int $mode = FilesInterface::READONLY |
26 | 26 | ): void { |
27 | - if (!$this->files->isFile($filename)) { |
|
27 | + if (!$this->files->isFile($filename)) |
|
28 | + { |
|
28 | 29 | throw new PublishException(\sprintf("Given '%s' is not valid file", $filename)); |
29 | 30 | } |
30 | 31 | |
31 | - if ($this->files->exists($destination)) { |
|
32 | - if ($this->files->md5($destination) === $this->files->md5($filename)) { |
|
32 | + if ($this->files->exists($destination)) |
|
33 | + { |
|
34 | + if ($this->files->md5($destination) === $this->files->md5($filename)) |
|
35 | + { |
|
33 | 36 | //Nothing to do |
34 | 37 | return; |
35 | 38 | } |
36 | 39 | |
37 | - if ($mergeMode === self::FOLLOW) { |
|
40 | + if ($mergeMode === self::FOLLOW) |
|
41 | + { |
|
38 | 42 | return; |
39 | 43 | } |
40 | 44 | } |
@@ -53,14 +57,16 @@ discard block |
||
53 | 57 | string $mergeMode = self::REPLACE, |
54 | 58 | int $mode = FilesInterface::READONLY |
55 | 59 | ): void { |
56 | - if (!$this->files->isDirectory($directory)) { |
|
60 | + if (!$this->files->isDirectory($directory)) |
|
61 | + { |
|
57 | 62 | throw new PublishException(\sprintf("Given '%s' is not valid directory", $directory)); |
58 | 63 | } |
59 | 64 | |
60 | 65 | $finder = new Finder(); |
61 | 66 | $finder->files()->in($directory); |
62 | 67 | |
63 | - foreach ($finder->getIterator() as $file) { |
|
68 | + foreach ($finder->getIterator() as $file) |
|
69 | + { |
|
64 | 70 | $this->publish( |
65 | 71 | (string)$file, |
66 | 72 | $destination . '/' . $file->getRelativePathname(), |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | string $filename, |
23 | 23 | string $destination, |
24 | 24 | string $mergeMode = self::FOLLOW, |
25 | - int $mode = FilesInterface::READONLY |
|
25 | + int $mode = FilesInterface::readonly |
|
26 | 26 | ): void { |
27 | 27 | if (!$this->files->isFile($filename)) { |
28 | 28 | throw new PublishException(\sprintf("Given '%s' is not valid file", $filename)); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | string $directory, |
52 | 52 | string $destination, |
53 | 53 | string $mergeMode = self::REPLACE, |
54 | - int $mode = FilesInterface::READONLY |
|
54 | + int $mode = FilesInterface::readonly |
|
55 | 55 | ): void { |
56 | 56 | if (!$this->files->isDirectory($directory)) { |
57 | 57 | throw new PublishException(\sprintf("Given '%s' is not valid directory", $directory)); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - public function ensureDirectory(string $directory, int $mode = FilesInterface::READONLY): void |
|
73 | + public function ensureDirectory(string $directory, int $mode = FilesInterface::readonly): void |
|
74 | 74 | { |
75 | 75 | $this->files->ensureDirectory($directory, $mode); |
76 | 76 | } |
@@ -49,13 +49,18 @@ |
||
49 | 49 | /** @var Console $console */ |
50 | 50 | $console = $this->container->get(Console::class); |
51 | 51 | |
52 | - try { |
|
52 | + try |
|
53 | + { |
|
53 | 54 | return $console->start($input ?? new ArgvInput(), $output); |
54 | - } catch (Throwable $e) { |
|
55 | + } |
|
56 | + catch (Throwable $e) |
|
57 | + { |
|
55 | 58 | $this->handleException($e, $output); |
56 | 59 | |
57 | 60 | return 255; |
58 | - } finally { |
|
61 | + } |
|
62 | + finally |
|
63 | + { |
|
59 | 64 | $listener->disable(); |
60 | 65 | $this->finalizer->finalize(false); |
61 | 66 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | private readonly FinalizerInterface $finalizer, |
30 | 30 | private readonly ContainerInterface $container, |
31 | 31 | private readonly ExceptionHandlerInterface $errorHandler, |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public static function canServe(EnvironmentInterface $env): bool |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | /** @var Console $console */ |
52 | 52 | $console = $this->container->get(Console::class); |
53 | 53 | |
54 | - try { |
|
54 | + try{ |
|
55 | 55 | return $console->start($input ?? new ArgvInput(), $output); |
56 | - } catch (Throwable $e) { |
|
56 | + }catch (Throwable $e){ |
|
57 | 57 | $this->handleException($e, $output); |
58 | 58 | |
59 | 59 | return 255; |
60 | - } finally { |
|
60 | + }finally{ |
|
61 | 61 | $listener->disable(); |
62 | 62 | $this->finalizer->finalize(false); |
63 | 63 | } |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | private readonly AppEnvironment $appEnv, |
18 | 18 | InputInterface $input, |
19 | 19 | OutputInterface $output, |
20 | - ) { |
|
20 | + ){ |
|
21 | 21 | $this->input = $input; |
22 | 22 | $this->output = $output; |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function confirmToProceed(string $message = 'Application in production.'): bool |
26 | 26 | { |
27 | - if (!$this->appEnv->isProduction()) { |
|
27 | + if (!$this->appEnv->isProduction()){ |
|
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
31 | - if ($this->hasOption('force') && $this->option('force')) { |
|
31 | + if ($this->hasOption('force') && $this->option('force')){ |
|
32 | 32 | return true; |
33 | 33 | } |
34 | 34 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $confirmed = $this->confirm('Do you really wish to run command?'); |
38 | 38 | |
39 | - if (!$confirmed) { |
|
39 | + if (!$confirmed){ |
|
40 | 40 | $this->comment('Command Canceled!'); |
41 | 41 | |
42 | 42 | return false; |
@@ -24,11 +24,13 @@ discard block |
||
24 | 24 | |
25 | 25 | public function confirmToProceed(string $message = 'Application in production.'): bool |
26 | 26 | { |
27 | - if (!$this->appEnv->isProduction()) { |
|
27 | + if (!$this->appEnv->isProduction()) |
|
28 | + { |
|
28 | 29 | return true; |
29 | 30 | } |
30 | 31 | |
31 | - if ($this->hasOption('force') && $this->option('force')) { |
|
32 | + if ($this->hasOption('force') && $this->option('force')) |
|
33 | + { |
|
32 | 34 | return true; |
33 | 35 | } |
34 | 36 | |
@@ -36,7 +38,8 @@ discard block |
||
36 | 38 | |
37 | 39 | $confirmed = $this->confirm('Do you really wish to run command?'); |
38 | 40 | |
39 | - if (!$confirmed) { |
|
41 | + if (!$confirmed) |
|
42 | + { |
|
40 | 43 | $this->comment('Command Canceled!'); |
41 | 44 | |
42 | 45 | return false; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function __construct( |
17 | 17 | private readonly FilesInterface $files, |
18 | 18 | private readonly DirectoriesInterface $dirs |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function ensure(OutputInterface $output): void |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $runtimeDirectory = $this->dirs->get('runtime'); |
27 | 27 | |
28 | - if (!$this->files->exists($runtimeDirectory)) { |
|
28 | + if (!$this->files->exists($runtimeDirectory)){ |
|
29 | 29 | $this->files->ensureDirectory($runtimeDirectory); |
30 | 30 | $output->writeln('<comment>created</comment>'); |
31 | 31 | return; |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | $output->writeln('<info>exists</info>'); |
34 | 34 | |
35 | 35 | |
36 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
37 | - try { |
|
36 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename){ |
|
37 | + try{ |
|
38 | 38 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
39 | 39 | $this->files->setPermissions(\dirname($filename), FilesInterface::RUNTIME); |
40 | - } catch (\Throwable $e) { |
|
40 | + }catch (\Throwable $e){ |
|
41 | 41 | // @codeCoverageIgnoreStart |
42 | 42 | $output->writeln( |
43 | 43 | \sprintf( |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // @codeCoverageIgnoreEnd |
51 | 51 | } |
52 | 52 | |
53 | - if ($output->isVerbose()) { |
|
53 | + if ($output->isVerbose()){ |
|
54 | 54 | $output->writeln( |
55 | 55 | \sprintf( |
56 | 56 | '<fg=green>[updated]</fg=green> `%s`', |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | |
26 | 26 | $runtimeDirectory = $this->dirs->get('runtime'); |
27 | 27 | |
28 | - if (!$this->files->exists($runtimeDirectory)) { |
|
28 | + if (!$this->files->exists($runtimeDirectory)) |
|
29 | + { |
|
29 | 30 | $this->files->ensureDirectory($runtimeDirectory); |
30 | 31 | $output->writeln('<comment>created</comment>'); |
31 | 32 | return; |
@@ -33,11 +34,15 @@ discard block |
||
33 | 34 | $output->writeln('<info>exists</info>'); |
34 | 35 | |
35 | 36 | |
36 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
37 | - try { |
|
37 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename) |
|
38 | + { |
|
39 | + try |
|
40 | + { |
|
38 | 41 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
39 | 42 | $this->files->setPermissions(\dirname($filename), FilesInterface::RUNTIME); |
40 | - } catch (\Throwable $e) { |
|
43 | + } |
|
44 | + catch (\Throwable $e) |
|
45 | + { |
|
41 | 46 | // @codeCoverageIgnoreStart |
42 | 47 | $output->writeln( |
43 | 48 | \sprintf( |
@@ -50,7 +55,8 @@ discard block |
||
50 | 55 | // @codeCoverageIgnoreEnd |
51 | 56 | } |
52 | 57 | |
53 | - if ($output->isVerbose()) { |
|
58 | + if ($output->isVerbose()) |
|
59 | + { |
|
54 | 60 | $output->writeln( |
55 | 61 | \sprintf( |
56 | 62 | '<fg=green>[updated]</fg=green> `%s`', |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | private readonly TranslatorInterface $translator |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function process(ViewSource $source, ContextInterface $context): ViewSource |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function __construct( |
20 | 20 | private readonly TranslatorInterface $translator |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | $this->locales = $translator->getCatalogueManager()->getLocales(); |
23 | 23 | } |
24 | 24 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct( |
13 | 13 | private readonly MemoryInterface $memory |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function setLocales(?array $locales): void |