@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function __construct( |
| 36 | 36 | private readonly ConfiguratorInterface $config |
| 37 | - ) { |
|
| 37 | + ){ |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void |
| 41 | 41 | { |
| 42 | - if (!$dirs->has('views')) { |
|
| 43 | - $dirs->set('views', $dirs->get('app') . 'views'); |
|
| 42 | + if (!$dirs->has('views')){ |
|
| 43 | + $dirs->set('views', $dirs->get('app').'views'); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // default view config |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | [ |
| 50 | 50 | 'cache' => [ |
| 51 | 51 | 'enabled' => $env->get('VIEW_CACHE', !$debugMode->isEnabled()), |
| 52 | - 'directory' => $dirs->get('cache') . 'views', |
|
| 52 | + 'directory' => $dirs->get('cache').'views', |
|
| 53 | 53 | ], |
| 54 | 54 | 'namespaces' => [ |
| 55 | 55 | 'default' => [$dirs->get('views')], |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function addDirectory(string $namespace, string $directory): void |
| 64 | 64 | { |
| 65 | - if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])) { |
|
| 65 | + if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])){ |
|
| 66 | 66 | $this->config->modify(ViewsConfig::CONFIG, new Append('namespaces', $namespace, [])); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $this->config->modify( |
| 70 | 70 | ViewsConfig::CONFIG, |
| 71 | - new Append('namespaces.' . $namespace, null, $directory) |
|
| 71 | + new Append('namespaces.'.$namespace, null, $directory) |
|
| 72 | 72 | ); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addEngine(string|EngineInterface $engine): void |
|
| 75 | + public function addEngine(string | EngineInterface $engine): void |
|
| 76 | 76 | { |
| 77 | 77 | $this->config->modify( |
| 78 | 78 | ViewsConfig::CONFIG, |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function addCacheDependency(string|DependencyInterface $dependency): void |
|
| 83 | + public function addCacheDependency(string | DependencyInterface $dependency): void |
|
| 84 | 84 | { |
| 85 | 85 | $this->config->modify( |
| 86 | 86 | ViewsConfig::CONFIG, |
@@ -39,7 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void |
| 41 | 41 | { |
| 42 | - if (!$dirs->has('views')) { |
|
| 42 | + if (!$dirs->has('views')) |
|
| 43 | + { |
|
| 43 | 44 | $dirs->set('views', $dirs->get('app') . 'views'); |
| 44 | 45 | } |
| 45 | 46 | |
@@ -62,7 +63,8 @@ discard block |
||
| 62 | 63 | |
| 63 | 64 | public function addDirectory(string $namespace, string $directory): void |
| 64 | 65 | { |
| 65 | - if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])) { |
|
| 66 | + if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])) |
|
| 67 | + { |
|
| 66 | 68 | $this->config->modify(ViewsConfig::CONFIG, new Append('namespaces', $namespace, [])); |
| 67 | 69 | } |
| 68 | 70 | |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function process(string $controller, string $action, array $parameters, CoreInterface $core): string |
| 13 | 13 | { |
| 14 | - return '?' . $core->callAction($controller, $action, $parameters) . '!'; |
|
| 14 | + return '?'.$core->callAction($controller, $action, $parameters).'!'; |
|
| 15 | 15 | } |
| 16 | 16 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function testInterceptorCallingEventShouldBeDispatched(): void |
| 17 | 17 | { |
| 18 | - $interceptor = new class implements CoreInterceptorInterface { |
|
| 18 | + $interceptor = new class implements CoreInterceptorInterface{ |
|
| 19 | 19 | public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed |
| 20 | 20 | { |
| 21 | 21 | return null; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $pipeline = new InterceptorPipeline($dispatcher); |
| 32 | 32 | $pipeline->addInterceptor($interceptor); |
| 33 | 33 | |
| 34 | - $pipeline->withCore(new class implements CoreInterface { |
|
| 34 | + $pipeline->withCore(new class implements CoreInterface{ |
|
| 35 | 35 | public function callAction(string $controller, string $action, array $parameters = []): mixed |
| 36 | 36 | { |
| 37 | 37 | return null; |
@@ -15,7 +15,8 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function testInterceptorCallingEventShouldBeDispatched(): void |
| 17 | 17 | { |
| 18 | - $interceptor = new class implements CoreInterceptorInterface { |
|
| 18 | + $interceptor = new class implements CoreInterceptorInterface |
|
| 19 | + { |
|
| 19 | 20 | public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed |
| 20 | 21 | { |
| 21 | 22 | return null; |
@@ -31,7 +32,8 @@ discard block |
||
| 31 | 32 | $pipeline = new InterceptorPipeline($dispatcher); |
| 32 | 33 | $pipeline->addInterceptor($interceptor); |
| 33 | 34 | |
| 34 | - $pipeline->withCore(new class implements CoreInterface { |
|
| 35 | + $pipeline->withCore(new class implements CoreInterface |
|
| 36 | + { |
|
| 35 | 37 | public function callAction(string $controller, string $action, array $parameters = []): mixed |
| 36 | 38 | { |
| 37 | 39 | return null; |
@@ -71,7 +71,8 @@ discard block |
||
| 71 | 71 | public function paginate(PaginableInterface $target): PaginatorInterface |
| 72 | 72 | { |
| 73 | 73 | $paginator = clone $this; |
| 74 | - if ($target instanceof \Countable && $paginator->count === 0) { |
|
| 74 | + if ($target instanceof \Countable && $paginator->count === 0) |
|
| 75 | + { |
|
| 75 | 76 | $paginator->setCount($target->count()); |
| 76 | 77 | } |
| 77 | 78 | |
@@ -93,7 +94,8 @@ discard block |
||
| 93 | 94 | |
| 94 | 95 | public function countDisplayed(): int |
| 95 | 96 | { |
| 96 | - if ($this->getPage() === $this->countPages) { |
|
| 97 | + if ($this->getPage() === $this->countPages) |
|
| 98 | + { |
|
| 97 | 99 | return $this->count - $this->getOffset(); |
| 98 | 100 | } |
| 99 | 101 | |
@@ -107,7 +109,8 @@ discard block |
||
| 107 | 109 | |
| 108 | 110 | public function nextPage(): ?int |
| 109 | 111 | { |
| 110 | - if ($this->getPage() !== $this->countPages) { |
|
| 112 | + if ($this->getPage() !== $this->countPages) |
|
| 113 | + { |
|
| 111 | 114 | return $this->getPage() + 1; |
| 112 | 115 | } |
| 113 | 116 | |
@@ -116,7 +119,8 @@ discard block |
||
| 116 | 119 | |
| 117 | 120 | public function previousPage(): ?int |
| 118 | 121 | { |
| 119 | - if ($this->getPage() > 1) { |
|
| 122 | + if ($this->getPage() > 1) |
|
| 123 | + { |
|
| 120 | 124 | return $this->getPage() - 1; |
| 121 | 125 | } |
| 122 | 126 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | private int $limit = 25, |
| 18 | 18 | int $count = 0, |
| 19 | 19 | private readonly ?string $parameter = null, |
| 20 | - ) { |
|
| 20 | + ){ |
|
| 21 | 21 | $this->setCount($count); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function paginate(PaginableInterface $target): PaginatorInterface |
| 74 | 74 | { |
| 75 | 75 | $paginator = clone $this; |
| 76 | - if ($target instanceof \Countable && $paginator->count === 0) { |
|
| 76 | + if ($target instanceof \Countable && $paginator->count === 0){ |
|
| 77 | 77 | $paginator->setCount($target->count()); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function countDisplayed(): int |
| 97 | 97 | { |
| 98 | - if ($this->getPage() === $this->countPages) { |
|
| 98 | + if ($this->getPage() === $this->countPages){ |
|
| 99 | 99 | return $this->count - $this->getOffset(); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | public function nextPage(): ?int |
| 111 | 111 | { |
| 112 | - if ($this->getPage() !== $this->countPages) { |
|
| 112 | + if ($this->getPage() !== $this->countPages){ |
|
| 113 | 113 | return $this->getPage() + 1; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | public function previousPage(): ?int |
| 120 | 120 | { |
| 121 | - if ($this->getPage() > 1) { |
|
| 121 | + if ($this->getPage() > 1){ |
|
| 122 | 122 | return $this->getPage() - 1; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -18,22 +18,27 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function init(Container $container, AbstractKernel $kernel): void |
| 20 | 20 | { |
| 21 | - $kernel->booting(static function (AbstractKernel $kernel) use ($container) { |
|
| 21 | + $kernel->booting(static function (AbstractKernel $kernel) use ($container) |
|
| 22 | + { |
|
| 22 | 23 | $container->bind('hij', 'foo'); |
| 23 | 24 | |
| 24 | - $kernel->booting(static function () use ($container) { |
|
| 25 | + $kernel->booting(static function () use ($container) |
|
| 26 | + { |
|
| 25 | 27 | $container->bind('ijk', 'foo'); |
| 26 | 28 | }); |
| 27 | 29 | }); |
| 28 | 30 | |
| 29 | - $kernel->booted(function (AbstractKernel $kernel) use ($container) { |
|
| 31 | + $kernel->booted(function (AbstractKernel $kernel) use ($container) |
|
| 32 | + { |
|
| 30 | 33 | $container->bind('jkl', 'foo'); |
| 31 | 34 | |
| 32 | - $kernel->booting(function () use ($container) { |
|
| 35 | + $kernel->booting(function () use ($container) |
|
| 36 | + { |
|
| 33 | 37 | $container->bind('klm', 'foo'); |
| 34 | 38 | }); |
| 35 | 39 | |
| 36 | - $kernel->booted(function () use ($container) { |
|
| 40 | + $kernel->booted(function () use ($container) |
|
| 41 | + { |
|
| 37 | 42 | $container->bind('lmn', 'foo'); |
| 38 | 43 | }); |
| 39 | 44 | }); |
@@ -44,11 +49,13 @@ discard block |
||
| 44 | 49 | public function boot(ConfigurationBootloader $configuration, AbstractKernel $kernel, Container $container): void |
| 45 | 50 | { |
| 46 | 51 | // won't be executed |
| 47 | - $kernel->booting(function (AbstractKernel $kernel) use ($container) { |
|
| 52 | + $kernel->booting(function (AbstractKernel $kernel) use ($container) |
|
| 53 | + { |
|
| 48 | 54 | $container->bind('ghi', 'foo'); |
| 49 | 55 | }); |
| 50 | 56 | |
| 51 | - $kernel->booted(function (AbstractKernel $kernel) use ($container) { |
|
| 57 | + $kernel->booted(function (AbstractKernel $kernel) use ($container) |
|
| 58 | + { |
|
| 52 | 59 | $container->bind('mno', 'foo'); |
| 53 | 60 | }); |
| 54 | 61 | |
@@ -34,7 +34,8 @@ |
||
| 34 | 34 | |
| 35 | 35 | public function testCreateInjectionNotForClass(): void |
| 36 | 36 | { |
| 37 | - $class = new #[ProvideFrom(method: 'test')] class { |
|
| 37 | + $class = new #[ProvideFrom(method: 'test')] class |
|
| 38 | + { |
|
| 38 | 39 | }; |
| 39 | 40 | |
| 40 | 41 | $ref = new \ReflectionClass($class); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function register(string $class): void |
| 24 | 24 | { |
| 25 | - if ($this->isBooted($class)) { |
|
| 25 | + if ($this->isBooted($class)){ |
|
| 26 | 26 | throw new BootloaderAlreadyBootedException($class); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -22,7 +22,8 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function register(string $class): void |
| 24 | 24 | { |
| 25 | - if ($this->isBooted($class)) { |
|
| 25 | + if ($this->isBooted($class)) |
|
| 26 | + { |
|
| 26 | 27 | throw new BootloaderAlreadyBootedException($class); |
| 27 | 28 | } |
| 28 | 29 | |
@@ -14,7 +14,8 @@ discard block |
||
| 14 | 14 | public function __construct( |
| 15 | 15 | private array $directories = [] |
| 16 | 16 | ) { |
| 17 | - foreach ($directories as $name => $directory) { |
|
| 17 | + foreach ($directories as $name => $directory) |
|
| 18 | + { |
|
| 18 | 19 | $this->set($name, $directory); |
| 19 | 20 | } |
| 20 | 21 | } |
@@ -34,7 +35,8 @@ discard block |
||
| 34 | 35 | |
| 35 | 36 | public function get(string $name): string |
| 36 | 37 | { |
| 37 | - if (!$this->has($name)) { |
|
| 38 | + if (!$this->has($name)) |
|
| 39 | + { |
|
| 38 | 40 | throw new DirectoryException("Undefined directory '{$name}'"); |
| 39 | 41 | } |
| 40 | 42 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function __construct( |
| 18 | 18 | private array $directories = [] |
| 19 | - ) { |
|
| 20 | - foreach ($directories as $name => $directory) { |
|
| 19 | + ){ |
|
| 20 | + foreach ($directories as $name => $directory){ |
|
| 21 | 21 | $this->set($name, $directory); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | public function set(string $name, string $path): DirectoriesInterface |
| 31 | 31 | { |
| 32 | 32 | $path = \str_replace(['\\', '//'], '/', $path); |
| 33 | - $this->directories[$name] = \rtrim($path, '/') . '/'; |
|
| 33 | + $this->directories[$name] = \rtrim($path, '/').'/'; |
|
| 34 | 34 | |
| 35 | 35 | return $this; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function get(string $name): string |
| 39 | 39 | { |
| 40 | - if (!$this->has($name)) { |
|
| 40 | + if (!$this->has($name)){ |
|
| 41 | 41 | throw new DirectoryException("Undefined directory '{$name}'"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | { |
| 14 | 14 | public function __construct( |
| 15 | 15 | public readonly FinalizerInterface $finalizer |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | } |