@@ -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; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function __construct( |
| 24 | 24 | private readonly ?EventDispatcherInterface $dispatcher = null |
| 25 | - ) { |
|
| 25 | + ){ |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function addInterceptor(CoreInterceptorInterface $interceptor): void |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function callAction(string $controller, string $action, array $parameters = []): mixed |
| 45 | 45 | { |
| 46 | - if ($this->core === null) { |
|
| 46 | + if ($this->core === null){ |
|
| 47 | 47 | throw new InterceptorException('Unable to invoke pipeline without assigned core'); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $position = $this->position++; |
| 51 | - if (isset($this->interceptors[$position])) { |
|
| 51 | + if (isset($this->interceptors[$position])){ |
|
| 52 | 52 | $interceptor = $this->interceptors[$position]; |
| 53 | 53 | $this->dispatcher?->dispatch(new InterceptorCalling( |
| 54 | 54 | controller: $controller, |
@@ -43,12 +43,14 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function callAction(string $controller, string $action, array $parameters = []): mixed |
| 45 | 45 | { |
| 46 | - if ($this->core === null) { |
|
| 46 | + if ($this->core === null) |
|
| 47 | + { |
|
| 47 | 48 | throw new InterceptorException('Unable to invoke pipeline without assigned core'); |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | $position = $this->position++; |
| 51 | - if (isset($this->interceptors[$position])) { |
|
| 52 | + if (isset($this->interceptors[$position])) |
|
| 53 | + { |
|
| 52 | 54 | $interceptor = $this->interceptors[$position]; |
| 53 | 55 | $this->dispatcher?->dispatch(new InterceptorCalling( |
| 54 | 56 | controller: $controller, |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public function __construct( |
| 17 | 17 | private readonly CoreInterface $core, |
| 18 | 18 | ?EventDispatcherInterface $dispatcher = null |
| 19 | - ) { |
|
| 19 | + ){ |
|
| 20 | 20 | $this->pipeline = new InterceptorPipeline($dispatcher); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | public readonly string $action, |
| 14 | 14 | public readonly array $parameters, |
| 15 | 15 | public readonly CoreInterceptorInterface $interceptor |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -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 | |
@@ -14,17 +14,17 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $core = TestCore::create([ |
| 16 | 16 | 'root' => __DIR__, |
| 17 | - 'cache' => __DIR__ . '/cache' |
|
| 17 | + 'cache' => __DIR__.'/cache' |
|
| 18 | 18 | ])->run(); |
| 19 | 19 | |
| 20 | 20 | /** @var MemoryInterface $memory */ |
| 21 | 21 | $memory = $core->getContainer()->get(MemoryInterface::class); |
| 22 | 22 | |
| 23 | 23 | $memory->saveData('test', 'data'); |
| 24 | - $this->assertFileExists(__DIR__ . '/cache/test.php'); |
|
| 24 | + $this->assertFileExists(__DIR__.'/cache/test.php'); |
|
| 25 | 25 | $this->assertSame('data', $memory->loadData('test')); |
| 26 | 26 | |
| 27 | - unlink(__DIR__ . '/cache/test.php'); |
|
| 27 | + unlink(__DIR__.'/cache/test.php'); |
|
| 28 | 28 | $this->assertNull($memory->loadData('test')); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $core = TestCore::create([ |
| 34 | 34 | 'root' => __DIR__, |
| 35 | - 'cache' => __DIR__ . '/cache' |
|
| 35 | + 'cache' => __DIR__.'/cache' |
|
| 36 | 36 | ])->run(); |
| 37 | 37 | |
| 38 | 38 | /** @var MemoryInterface $memory */ |
| 39 | 39 | $memory = $core->getContainer()->get(MemoryInterface::class); |
| 40 | 40 | |
| 41 | - file_put_contents(__DIR__ . '/cache/test.php', '<?php broken'); |
|
| 41 | + file_put_contents(__DIR__.'/cache/test.php', '<?php broken'); |
|
| 42 | 42 | $this->assertNull($memory->loadData('test')); |
| 43 | 43 | |
| 44 | - unlink(__DIR__ . '/cache/test.php'); |
|
| 44 | + unlink(__DIR__.'/cache/test.php'); |
|
| 45 | 45 | $this->assertNull($memory->loadData('test')); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -33,9 +33,9 @@ |
||
| 33 | 33 | |
| 34 | 34 | $this->assertSame($expected, $enum); |
| 35 | 35 | |
| 36 | - if ($enum === DebugMode::Enabled) { |
|
| 36 | + if ($enum === DebugMode::Enabled){ |
|
| 37 | 37 | $this->assertTrue($enum->isEnabled()); |
| 38 | - } else { |
|
| 38 | + }else{ |
|
| 39 | 39 | $this->assertFalse($enum->isEnabled()); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -33,9 +33,12 @@ |
||
| 33 | 33 | |
| 34 | 34 | $this->assertSame($expected, $enum); |
| 35 | 35 | |
| 36 | - if ($enum === DebugMode::Enabled) { |
|
| 36 | + if ($enum === DebugMode::Enabled) |
|
| 37 | + { |
|
| 37 | 38 | $this->assertTrue($enum->isEnabled()); |
| 38 | - } else { |
|
| 39 | + } |
|
| 40 | + else |
|
| 41 | + { |
|
| 39 | 42 | $this->assertFalse($enum->isEnabled()); |
| 40 | 43 | } |
| 41 | 44 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $core = TestCore::create([ |
| 20 | 20 | 'root' => __DIR__, |
| 21 | - 'config' => __DIR__ . '/config', |
|
| 21 | + 'config' => __DIR__.'/config', |
|
| 22 | 22 | ])->run(); |
| 23 | 23 | |
| 24 | 24 | /** @var ContainerInterface $c */ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $core = TestCore::create([ |
| 35 | 35 | 'root' => __DIR__, |
| 36 | - 'config' => __DIR__ . '/config', |
|
| 36 | + 'config' => __DIR__.'/config', |
|
| 37 | 37 | ])->run(new Environment([ |
| 38 | 38 | 'key' => '(true)', |
| 39 | 39 | ])); |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $core = TestCore::create([ |
| 52 | 52 | 'root' => __DIR__, |
| 53 | - 'config' => __DIR__ . '/config', |
|
| 53 | + 'config' => __DIR__.'/config', |
|
| 54 | 54 | ])->run(); |
| 55 | 55 | |
| 56 | 56 | /** @var ContainerInterface $c */ |
| 57 | 57 | $c = $core->getContainer(); |
| 58 | 58 | |
| 59 | 59 | ContainerScope::runScope($c, function (): void { |
| 60 | - $this->assertDir(__DIR__ . '/config', directory('config')); |
|
| 60 | + $this->assertDir(__DIR__.'/config', directory('config')); |
|
| 61 | 61 | }); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $core = TestCore::create([ |
| 76 | 76 | 'root' => __DIR__, |
| 77 | - 'config' => __DIR__ . '/config', |
|
| 77 | + 'config' => __DIR__.'/config', |
|
| 78 | 78 | ])->run(); |
| 79 | 79 | |
| 80 | 80 | /** @var ContainerInterface $c */ |
@@ -102,6 +102,6 @@ discard block |
||
| 102 | 102 | private function assertDir($path, $value): void |
| 103 | 103 | { |
| 104 | 104 | $path = str_replace(['\\', '//'], '/', $path); |
| 105 | - $this->assertSame(rtrim($path, '/') . '/', $value); |
|
| 105 | + $this->assertSame(rtrim($path, '/').'/', $value); |
|
| 106 | 106 | } |
| 107 | 107 | } |
@@ -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 | |