@@ -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 |
@@ -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 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $finalizer->addFinalizer(function () use ($container): void { |
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 | }); |
@@ -28,7 +28,8 @@ |
||
28 | 28 | $finalizer->addFinalizer(function () use ($container): void { |
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 | 33 | $driver->disconnect(); |
33 | 34 | } |
34 | 35 | }); |
@@ -40,8 +40,8 @@ |
||
40 | 40 | EnvironmentInterface $env, |
41 | 41 | DirectoriesInterface $dirs |
42 | 42 | ): void { |
43 | - if (!$dirs->has('migrations')) { |
|
44 | - $dirs->set('migrations', $dirs->get('app') . 'migrations'); |
|
43 | + if (!$dirs->has('migrations')){ |
|
44 | + $dirs->set('migrations', $dirs->get('app').'migrations'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $config->setDefaults('migration', [ |
@@ -40,7 +40,8 @@ |
||
40 | 40 | EnvironmentInterface $env, |
41 | 41 | DirectoriesInterface $dirs |
42 | 42 | ): void { |
43 | - if (!$dirs->has('migrations')) { |
|
43 | + if (!$dirs->has('migrations')) |
|
44 | + { |
|
44 | 45 | $dirs->set('migrations', $dirs->get('app') . 'migrations'); |
45 | 46 | } |
46 | 47 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | 'handler' => new Autowire( |
63 | 63 | FileHandler::class, |
64 | 64 | [ |
65 | - 'directory' => $directories->get('runtime') . 'session', |
|
65 | + 'directory' => $directories->get('runtime').'session', |
|
66 | 66 | 'lifetime' => 86400 |
67 | 67 | ] |
68 | 68 | ) |
@@ -58,8 +58,8 @@ |
||
58 | 58 | */ |
59 | 59 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs): void |
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): void |
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 |
@@ -75,31 +75,31 @@ discard block |
||
75 | 75 | */ |
76 | 76 | private function configureExtensions(ConsoleBootloader $console, Container $container): void |
77 | 77 | { |
78 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
78 | + if ($container->has(DatabaseProviderInterface::class)){ |
|
79 | 79 | $this->configureDatabase($console); |
80 | 80 | } |
81 | 81 | |
82 | - if ($container->has(ORMInterface::class)) { |
|
82 | + if ($container->has(ORMInterface::class)){ |
|
83 | 83 | $this->configureCycle($console, $container); |
84 | 84 | } |
85 | 85 | |
86 | - if ($container->has(TranslatorInterface::class)) { |
|
86 | + if ($container->has(TranslatorInterface::class)){ |
|
87 | 87 | $this->configureTranslator($console); |
88 | 88 | } |
89 | 89 | |
90 | - if ($container->has(ViewsInterface::class)) { |
|
90 | + if ($container->has(ViewsInterface::class)){ |
|
91 | 91 | $this->configureViews($console); |
92 | 92 | } |
93 | 93 | |
94 | - if ($container->has(Migrator::class)) { |
|
94 | + if ($container->has(Migrator::class)){ |
|
95 | 95 | $this->configureMigrations($console); |
96 | 96 | } |
97 | 97 | |
98 | - if ($container->has(InvokerInterface::class)) { |
|
98 | + if ($container->has(InvokerInterface::class)){ |
|
99 | 99 | $this->configureGRPC($console); |
100 | 100 | } |
101 | 101 | |
102 | - if ($container->has(EncryptionInterface::class)) { |
|
102 | + if ($container->has(EncryptionInterface::class)){ |
|
103 | 103 | $this->configureEncrypter($console); |
104 | 104 | } |
105 | 105 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $console->addCommand(Cycle\SyncCommand::class); |
130 | 130 | |
131 | - if ($container->has(Migrator::class)) { |
|
131 | + if ($container->has(Migrator::class)){ |
|
132 | 132 | $console->addCommand(Cycle\MigrateCommand::class); |
133 | 133 | } |
134 | 134 | } |
@@ -75,31 +75,38 @@ discard block |
||
75 | 75 | */ |
76 | 76 | private function configureExtensions(ConsoleBootloader $console, Container $container): void |
77 | 77 | { |
78 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
78 | + if ($container->has(DatabaseProviderInterface::class)) |
|
79 | + { |
|
79 | 80 | $this->configureDatabase($console); |
80 | 81 | } |
81 | 82 | |
82 | - if ($container->has(ORMInterface::class)) { |
|
83 | + if ($container->has(ORMInterface::class)) |
|
84 | + { |
|
83 | 85 | $this->configureCycle($console, $container); |
84 | 86 | } |
85 | 87 | |
86 | - if ($container->has(TranslatorInterface::class)) { |
|
88 | + if ($container->has(TranslatorInterface::class)) |
|
89 | + { |
|
87 | 90 | $this->configureTranslator($console); |
88 | 91 | } |
89 | 92 | |
90 | - if ($container->has(ViewsInterface::class)) { |
|
93 | + if ($container->has(ViewsInterface::class)) |
|
94 | + { |
|
91 | 95 | $this->configureViews($console); |
92 | 96 | } |
93 | 97 | |
94 | - if ($container->has(Migrator::class)) { |
|
98 | + if ($container->has(Migrator::class)) |
|
99 | + { |
|
95 | 100 | $this->configureMigrations($console); |
96 | 101 | } |
97 | 102 | |
98 | - if ($container->has(InvokerInterface::class)) { |
|
103 | + if ($container->has(InvokerInterface::class)) |
|
104 | + { |
|
99 | 105 | $this->configureGRPC($console); |
100 | 106 | } |
101 | 107 | |
102 | - if ($container->has(EncryptionInterface::class)) { |
|
108 | + if ($container->has(EncryptionInterface::class)) |
|
109 | + { |
|
103 | 110 | $this->configureEncrypter($console); |
104 | 111 | } |
105 | 112 | } |
@@ -128,7 +135,8 @@ discard block |
||
128 | 135 | |
129 | 136 | $console->addCommand(Cycle\SyncCommand::class); |
130 | 137 | |
131 | - if ($container->has(Migrator::class)) { |
|
138 | + if ($container->has(Migrator::class)) |
|
139 | + { |
|
132 | 140 | $console->addCommand(Cycle\MigrateCommand::class); |
133 | 141 | } |
134 | 142 | } |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs): void |
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): void |
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): void |
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): void |
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 |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __invoke(LogEvent $event): void |
51 | 51 | { |
52 | - if (empty($this->output)) { |
|
52 | + if (empty($this->output)){ |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
56 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){ |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function enable(): self |
91 | 91 | { |
92 | - if (!empty($this->logs)) { |
|
92 | + if (!empty($this->logs)){ |
|
93 | 93 | $this->logs->addListener($this); |
94 | 94 | } |
95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function disable(): self |
105 | 105 | { |
106 | - if (!empty($this->logs)) { |
|
106 | + if (!empty($this->logs)){ |
|
107 | 107 | $this->logs->removeListener($this); |
108 | 108 | } |
109 | 109 | |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | */ |
127 | 127 | private function getChannel(string $channel): string |
128 | 128 | { |
129 | - if (!class_exists($channel, false)) { |
|
129 | + if (!class_exists($channel, false)){ |
|
130 | 130 | return "[{$channel}]"; |
131 | 131 | } |
132 | 132 | |
133 | - try { |
|
133 | + try{ |
|
134 | 134 | $reflection = new \ReflectionClass($channel); |
135 | - } catch (\ReflectionException $e) { |
|
135 | + }catch (\ReflectionException $e){ |
|
136 | 136 | return $channel; |
137 | 137 | } |
138 | 138 | |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | */ |
147 | 147 | private function getMessage(bool $decorated, string $message) |
148 | 148 | { |
149 | - if (!$decorated) { |
|
149 | + if (!$decorated){ |
|
150 | 150 | return $message; |
151 | 151 | } |
152 | 152 | |
153 | - return Color::GRAY . $message . Color::RESET; |
|
153 | + return Color::GRAY.$message.Color::RESET; |
|
154 | 154 | } |
155 | 155 | } |
@@ -49,11 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __invoke(LogEvent $event): void |
51 | 51 | { |
52 | - if (empty($this->output)) { |
|
52 | + if (empty($this->output)) |
|
53 | + { |
|
53 | 54 | return; |
54 | 55 | } |
55 | 56 | |
56 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
57 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) |
|
58 | + { |
|
57 | 59 | return; |
58 | 60 | } |
59 | 61 | |
@@ -89,7 +91,8 @@ discard block |
||
89 | 91 | */ |
90 | 92 | public function enable(): self |
91 | 93 | { |
92 | - if (!empty($this->logs)) { |
|
94 | + if (!empty($this->logs)) |
|
95 | + { |
|
93 | 96 | $this->logs->addListener($this); |
94 | 97 | } |
95 | 98 | |
@@ -103,7 +106,8 @@ discard block |
||
103 | 106 | */ |
104 | 107 | public function disable(): self |
105 | 108 | { |
106 | - if (!empty($this->logs)) { |
|
109 | + if (!empty($this->logs)) |
|
110 | + { |
|
107 | 111 | $this->logs->removeListener($this); |
108 | 112 | } |
109 | 113 | |
@@ -126,13 +130,17 @@ discard block |
||
126 | 130 | */ |
127 | 131 | private function getChannel(string $channel): string |
128 | 132 | { |
129 | - if (!class_exists($channel, false)) { |
|
133 | + if (!class_exists($channel, false)) |
|
134 | + { |
|
130 | 135 | return "[{$channel}]"; |
131 | 136 | } |
132 | 137 | |
133 | - try { |
|
138 | + try |
|
139 | + { |
|
134 | 140 | $reflection = new \ReflectionClass($channel); |
135 | - } catch (\ReflectionException $e) { |
|
141 | + } |
|
142 | + catch (\ReflectionException $e) |
|
143 | + { |
|
136 | 144 | return $channel; |
137 | 145 | } |
138 | 146 | |
@@ -146,7 +154,8 @@ discard block |
||
146 | 154 | */ |
147 | 155 | private function getMessage(bool $decorated, string $message) |
148 | 156 | { |
149 | - if (!$decorated) { |
|
157 | + if (!$decorated) |
|
158 | + { |
|
150 | 159 | return $message; |
151 | 160 | } |
152 | 161 |
@@ -43,28 +43,28 @@ |
||
43 | 43 | */ |
44 | 44 | protected function mapDirectories(array $directories): array |
45 | 45 | { |
46 | - if (!isset($directories['root'])) { |
|
46 | + if (!isset($directories['root'])){ |
|
47 | 47 | throw new BootException('Missing required directory `root`.'); |
48 | 48 | } |
49 | 49 | |
50 | - if (!isset($directories['app'])) { |
|
51 | - $directories['app'] = $directories['root'] . '/app/'; |
|
50 | + if (!isset($directories['app'])){ |
|
51 | + $directories['app'] = $directories['root'].'/app/'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return array_merge([ |
55 | 55 | // public root |
56 | - 'public' => $directories['root'] . '/public/', |
|
56 | + 'public' => $directories['root'].'/public/', |
|
57 | 57 | |
58 | 58 | // vendor libraries |
59 | - 'vendor' => $directories['root'] . '/vendor/', |
|
59 | + 'vendor' => $directories['root'].'/vendor/', |
|
60 | 60 | |
61 | 61 | // data directories |
62 | - 'runtime' => $directories['root'] . '/runtime/', |
|
63 | - 'cache' => $directories['root'] . '/runtime/cache/', |
|
62 | + 'runtime' => $directories['root'].'/runtime/', |
|
63 | + 'cache' => $directories['root'].'/runtime/cache/', |
|
64 | 64 | |
65 | 65 | // application directories |
66 | - 'config' => $directories['app'] . '/config/', |
|
67 | - 'resources' => $directories['app'] . '/resources/', |
|
66 | + 'config' => $directories['app'].'/config/', |
|
67 | + 'resources' => $directories['app'].'/resources/', |
|
68 | 68 | ], $directories); |
69 | 69 | } |
70 | 70 | } |
@@ -43,11 +43,13 @@ |
||
43 | 43 | */ |
44 | 44 | protected function mapDirectories(array $directories): array |
45 | 45 | { |
46 | - if (!isset($directories['root'])) { |
|
46 | + if (!isset($directories['root'])) |
|
47 | + { |
|
47 | 48 | throw new BootException('Missing required directory `root`.'); |
48 | 49 | } |
49 | 50 | |
50 | - if (!isset($directories['app'])) { |
|
51 | + if (!isset($directories['app'])) |
|
52 | + { |
|
51 | 53 | $directories['app'] = $directories['root'] . '/app/'; |
52 | 54 | } |
53 | 55 |