@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function compile(string $path, ContextInterface $context) |
22 | 22 | { |
23 | - if ($path == 'custom:error') { |
|
23 | + if ($path == 'custom:error'){ |
|
24 | 24 | throw new EngineException("Unable to compile custom:error"); |
25 | 25 | } |
26 | 26 | } |
@@ -20,7 +20,8 @@ |
||
20 | 20 | |
21 | 21 | public function compile(string $path, ContextInterface $context) |
22 | 22 | { |
23 | - if ($path == 'custom:error') { |
|
23 | + if ($path == 'custom:error') |
|
24 | + { |
|
24 | 25 | throw new EngineException("Unable to compile custom:error"); |
25 | 26 | } |
26 | 27 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | */ |
8 | 8 | declare(strict_types=1); |
9 | 9 | |
10 | -if (!function_exists('bind')) { |
|
10 | +if (!function_exists('bind')){ |
|
11 | 11 | /** |
12 | 12 | * Shortcut to container Autowire definition. |
13 | 13 | * |
@@ -7,7 +7,8 @@ |
||
7 | 7 | */ |
8 | 8 | declare(strict_types=1); |
9 | 9 | |
10 | -if (!function_exists('bind')) { |
|
10 | +if (!function_exists('bind')) |
|
11 | +{ |
|
11 | 12 | /** |
12 | 13 | * Shortcut to container Autowire definition. |
13 | 14 | * |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | '<fg=magenta>[runtime]</fg=magenta> <fg=cyan>verify `runtime` directory access</fg=cyan>' |
48 | 48 | ); |
49 | 49 | |
50 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
50 | + if ($container->has(DatabaseProviderInterface::class)){ |
|
51 | 51 | $this->configureDatabase($console); |
52 | 52 | } |
53 | 53 | |
54 | - if ($container->has(ORMInterface::class)) { |
|
54 | + if ($container->has(ORMInterface::class)){ |
|
55 | 55 | $this->configureCycle($console, $container); |
56 | 56 | } |
57 | 57 | |
58 | - if ($container->has(TranslatorInterface::class)) { |
|
58 | + if ($container->has(TranslatorInterface::class)){ |
|
59 | 59 | $this->configureTranslator($console); |
60 | 60 | } |
61 | 61 | |
62 | - if ($container->has(ViewsInterface::class)) { |
|
62 | + if ($container->has(ViewsInterface::class)){ |
|
63 | 63 | $this->configureViews($console); |
64 | 64 | } |
65 | 65 | |
66 | - if ($container->has(Migrator::class)) { |
|
66 | + if ($container->has(Migrator::class)){ |
|
67 | 67 | $this->configureMigrations($console); |
68 | 68 | } |
69 | 69 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $console->addCommand(Cycle\SyncCommand::class); |
104 | 104 | |
105 | - if ($container->has(Migrator::class)) { |
|
105 | + if ($container->has(Migrator::class)){ |
|
106 | 106 | $console->addCommand(Cycle\MigrateCommand::class); |
107 | 107 | } |
108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $console->addCommand(Translator\ResetCommand::class); |
118 | 118 | |
119 | 119 | $console->addConfigureSequence( |
120 | - function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) { |
|
120 | + function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output){ |
|
121 | 121 | $files->ensureDirectory($config->getLocaleDirectory($config->getDefaultLocale())); |
122 | 122 | $output->writeln("<info>The default locale directory has been ensured.</info>"); |
123 | 123 | }, |
@@ -47,23 +47,28 @@ discard block |
||
47 | 47 | '<fg=magenta>[runtime]</fg=magenta> <fg=cyan>verify `runtime` directory access</fg=cyan>' |
48 | 48 | ); |
49 | 49 | |
50 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
50 | + if ($container->has(DatabaseProviderInterface::class)) |
|
51 | + { |
|
51 | 52 | $this->configureDatabase($console); |
52 | 53 | } |
53 | 54 | |
54 | - if ($container->has(ORMInterface::class)) { |
|
55 | + if ($container->has(ORMInterface::class)) |
|
56 | + { |
|
55 | 57 | $this->configureCycle($console, $container); |
56 | 58 | } |
57 | 59 | |
58 | - if ($container->has(TranslatorInterface::class)) { |
|
60 | + if ($container->has(TranslatorInterface::class)) |
|
61 | + { |
|
59 | 62 | $this->configureTranslator($console); |
60 | 63 | } |
61 | 64 | |
62 | - if ($container->has(ViewsInterface::class)) { |
|
65 | + if ($container->has(ViewsInterface::class)) |
|
66 | + { |
|
63 | 67 | $this->configureViews($console); |
64 | 68 | } |
65 | 69 | |
66 | - if ($container->has(Migrator::class)) { |
|
70 | + if ($container->has(Migrator::class)) |
|
71 | + { |
|
67 | 72 | $this->configureMigrations($console); |
68 | 73 | } |
69 | 74 | } |
@@ -102,7 +107,8 @@ discard block |
||
102 | 107 | |
103 | 108 | $console->addCommand(Cycle\SyncCommand::class); |
104 | 109 | |
105 | - if ($container->has(Migrator::class)) { |
|
110 | + if ($container->has(Migrator::class)) |
|
111 | + { |
|
106 | 112 | $console->addCommand(Cycle\MigrateCommand::class); |
107 | 113 | } |
108 | 114 | } |
@@ -117,7 +123,8 @@ discard block |
||
117 | 123 | $console->addCommand(Translator\ResetCommand::class); |
118 | 124 | |
119 | 125 | $console->addConfigureSequence( |
120 | - function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) { |
|
126 | + function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) |
|
127 | + { |
|
121 | 128 | $files->ensureDirectory($config->getLocaleDirectory($config->getDefaultLocale())); |
122 | 129 | $output->writeln("<info>The default locale directory has been ensured.</info>"); |
123 | 130 | }, |
@@ -103,7 +103,7 @@ |
||
103 | 103 | ] |
104 | 104 | ]); |
105 | 105 | |
106 | - $tokenizer->addDirectory(directory('vendor') . 'spiral/validation/src/'); |
|
106 | + $tokenizer->addDirectory(directory('vendor').'spiral/validation/src/'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -36,21 +36,21 @@ |
||
36 | 36 | { |
37 | 37 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
38 | 38 | |
39 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
39 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){ |
|
40 | 40 | throw new BootException( |
41 | 41 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
42 | 42 | ); |
43 | 43 | } |
44 | 44 | |
45 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
45 | + if (!in_array($parts[1], ['tcp', 'unix'])){ |
|
46 | 46 | throw new BootException( |
47 | 47 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | - if ($parts[1] == 'unix') { |
|
51 | + if ($parts[1] == 'unix'){ |
|
52 | 52 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
53 | - } else { |
|
53 | + }else{ |
|
54 | 54 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
55 | 55 | } |
56 | 56 |
@@ -36,21 +36,26 @@ |
||
36 | 36 | { |
37 | 37 | $conn = $env->get('RR_RPC', static::RPC_DEFAULT); |
38 | 38 | |
39 | - if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) { |
|
39 | + if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) |
|
40 | + { |
|
40 | 41 | throw new BootException( |
41 | 42 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
42 | 43 | ); |
43 | 44 | } |
44 | 45 | |
45 | - if (!in_array($parts[1], ['tcp', 'unix'])) { |
|
46 | + if (!in_array($parts[1], ['tcp', 'unix'])) |
|
47 | + { |
|
46 | 48 | throw new BootException( |
47 | 49 | "Unable to configure RPC connection, invalid DSN given `{$conn}`." |
48 | 50 | ); |
49 | 51 | } |
50 | 52 | |
51 | - if ($parts[1] == 'unix') { |
|
53 | + if ($parts[1] == 'unix') |
|
54 | + { |
|
52 | 55 | $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX); |
53 | - } else { |
|
56 | + } |
|
57 | + else |
|
58 | + { |
|
54 | 59 | $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP); |
55 | 60 | } |
56 | 61 |
@@ -42,9 +42,9 @@ |
||
42 | 42 | |
43 | 43 | DirectoriesInterface $dirs, |
44 | 44 | FilesInterface $files |
45 | - ) { |
|
45 | + ){ |
|
46 | 46 | return new FileSnapshotter( |
47 | - $dirs->get('runtime') . '/snapshots/', |
|
47 | + $dirs->get('runtime').'/snapshots/', |
|
48 | 48 | $env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS), |
49 | 49 | $env->get('SNAPSHOT_VERBOSITY', HandlerInterface::VERBOSITY_VERBOSE), |
50 | 50 | new HtmlHandler(), |
@@ -58,8 +58,8 @@ |
||
58 | 58 | */ |
59 | 59 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs) |
60 | 60 | { |
61 | - if (!$dirs->has('locale')) { |
|
62 | - $dirs->set('locale', $dirs->get('app') . 'locale/'); |
|
61 | + if (!$dirs->has('locale')){ |
|
62 | + $dirs->set('locale', $dirs->get('app').'locale/'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $this->config->setDefaults('translator', [ |
@@ -58,7 +58,8 @@ |
||
58 | 58 | */ |
59 | 59 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs) |
60 | 60 | { |
61 | - if (!$dirs->has('locale')) { |
|
61 | + if (!$dirs->has('locale')) |
|
62 | + { |
|
62 | 63 | $dirs->set('locale', $dirs->get('app') . 'locale/'); |
63 | 64 | } |
64 | 65 |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs) |
44 | 44 | { |
45 | - if (!$dirs->has('views')) { |
|
46 | - $dirs->set('views', $dirs->get('app') . 'views'); |
|
45 | + if (!$dirs->has('views')){ |
|
46 | + $dirs->set('views', $dirs->get('app').'views'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // default view config |
50 | 50 | $this->config->setDefaults('views', [ |
51 | 51 | 'cache' => [ |
52 | 52 | 'enabled' => !$env->get('DEBUG', false), |
53 | - 'directory' => $dirs->get('cache') . 'views' |
|
53 | + 'directory' => $dirs->get('cache').'views' |
|
54 | 54 | ], |
55 | 55 | 'namespaces' => [ |
56 | 56 | 'default' => [$dirs->get('views')] |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function addDirectory(string $namespace, string $directory) |
68 | 68 | { |
69 | - if (!isset($this->config->getConfig('views')['namespaces'][$namespace])) { |
|
69 | + if (!isset($this->config->getConfig('views')['namespaces'][$namespace])){ |
|
70 | 70 | $this->config->modify('views', new Append('namespaces', $namespace, [])); |
71 | 71 | } |
72 | 72 | |
73 | - $this->config->modify('views', new Append('namespaces.' . $namespace, null, $directory)); |
|
73 | + $this->config->modify('views', new Append('namespaces.'.$namespace, null, $directory)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -42,7 +42,8 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs) |
44 | 44 | { |
45 | - if (!$dirs->has('views')) { |
|
45 | + if (!$dirs->has('views')) |
|
46 | + { |
|
46 | 47 | $dirs->set('views', $dirs->get('app') . 'views'); |
47 | 48 | } |
48 | 49 | |
@@ -66,7 +67,8 @@ discard block |
||
66 | 67 | */ |
67 | 68 | public function addDirectory(string $namespace, string $directory) |
68 | 69 | { |
69 | - if (!isset($this->config->getConfig('views')['namespaces'][$namespace])) { |
|
70 | + if (!isset($this->config->getConfig('views')['namespaces'][$namespace])) |
|
71 | + { |
|
70 | 72 | $this->config->modify('views', new Append('namespaces', $namespace, [])); |
71 | 73 | } |
72 | 74 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $finalizer->addFinalizer(function () use ($container) { |
29 | 29 | /** @var DatabaseManager $dbal */ |
30 | 30 | $dbal = $container->get(DatabaseManager::class); |
31 | - foreach ($dbal->getDrivers() as $driver) { |
|
31 | + foreach ($dbal->getDrivers() as $driver){ |
|
32 | 32 | $driver->disconnect(); |
33 | 33 | } |
34 | 34 | }); |
@@ -25,10 +25,12 @@ |
||
25 | 25 | */ |
26 | 26 | public function boot(FinalizerInterface $finalizer, ContainerInterface $container) |
27 | 27 | { |
28 | - $finalizer->addFinalizer(function () use ($container) { |
|
28 | + $finalizer->addFinalizer(function () use ($container) |
|
29 | + { |
|
29 | 30 | /** @var DatabaseManager $dbal */ |
30 | 31 | $dbal = $container->get(DatabaseManager::class); |
31 | - foreach ($dbal->getDrivers() as $driver) { |
|
32 | + foreach ($dbal->getDrivers() as $driver) |
|
33 | + { |
|
32 | 34 | $driver->disconnect(); |
33 | 35 | } |
34 | 36 | }); |