@@ -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 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | private function setCount(int $count): self |
132 | 132 | { |
133 | 133 | $this->count = \max($count, 0); |
134 | - $this->countPages = $this->count > 0 ? (int) \ceil($this->count / $this->limit) : 1; |
|
134 | + $this->countPages = $this->count > 0 ? (int)\ceil($this->count / $this->limit) : 1; |
|
135 | 135 | |
136 | 136 | return $this; |
137 | 137 | } |
@@ -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 |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | |
32 | 32 | public function getID(): string |
33 | 33 | { |
34 | - if (empty($this->id)) { |
|
34 | + if (empty($this->id)) |
|
35 | + { |
|
35 | 36 | $this->id = \md5(\serialize($this->values)); |
36 | 37 | } |
37 | 38 | |
@@ -40,7 +41,8 @@ discard block |
||
40 | 41 | |
41 | 42 | public function set(string $name, mixed $value): self |
42 | 43 | { |
43 | - if (\array_key_exists($name, $this->values) && !$this->overwrite) { |
|
44 | + if (\array_key_exists($name, $this->values) && !$this->overwrite) |
|
45 | + { |
|
44 | 46 | return $this; |
45 | 47 | } |
46 | 48 | |
@@ -54,7 +56,8 @@ discard block |
||
54 | 56 | |
55 | 57 | public function get(string $name, mixed $default = null): mixed |
56 | 58 | { |
57 | - if (isset($this->values[$name])) { |
|
59 | + if (isset($this->values[$name])) |
|
60 | + { |
|
58 | 61 | return $this->normalize($this->values[$name]); |
59 | 62 | } |
60 | 63 | |
@@ -68,7 +71,8 @@ discard block |
||
68 | 71 | { |
69 | 72 | $result = []; |
70 | 73 | |
71 | - foreach ($this->values as $key => $value) { |
|
74 | + foreach ($this->values as $key => $value) |
|
75 | + { |
|
72 | 76 | $result[$key] = $this->normalize($value); |
73 | 77 | } |
74 | 78 | |
@@ -77,12 +81,14 @@ discard block |
||
77 | 81 | |
78 | 82 | protected function normalize(mixed $value): mixed |
79 | 83 | { |
80 | - if (!\is_string($value)) { |
|
84 | + if (!\is_string($value)) |
|
85 | + { |
|
81 | 86 | return $value; |
82 | 87 | } |
83 | 88 | |
84 | 89 | $alias = \strtolower($value); |
85 | - if (isset(self::VALUE_MAP[$alias])) { |
|
90 | + if (isset(self::VALUE_MAP[$alias])) |
|
91 | + { |
|
86 | 92 | return self::VALUE_MAP[$alias]; |
87 | 93 | } |
88 | 94 |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | public function __construct( |
26 | 26 | array $values = [], |
27 | 27 | private readonly bool $overwrite = false, |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | $this->values = $values + $_ENV + $_SERVER; |
30 | 30 | } |
31 | 31 | |
32 | 32 | public function getID(): string |
33 | 33 | { |
34 | - if (empty($this->id)) { |
|
34 | + if (empty($this->id)){ |
|
35 | 35 | $this->id = \md5(\serialize($this->values)); |
36 | 36 | } |
37 | 37 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function set(string $name, mixed $value): self |
42 | 42 | { |
43 | - if (\array_key_exists($name, $this->values) && !$this->overwrite) { |
|
43 | + if (\array_key_exists($name, $this->values) && !$this->overwrite){ |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function get(string $name, mixed $default = null): mixed |
56 | 56 | { |
57 | - if (isset($this->values[$name])) { |
|
57 | + if (isset($this->values[$name])){ |
|
58 | 58 | return $this->normalize($this->values[$name]); |
59 | 59 | } |
60 | 60 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $result = []; |
70 | 70 | |
71 | - foreach ($this->values as $key => $value) { |
|
71 | + foreach ($this->values as $key => $value){ |
|
72 | 72 | $result[$key] = $this->normalize($value); |
73 | 73 | } |
74 | 74 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | |
78 | 78 | protected function normalize(mixed $value): mixed |
79 | 79 | { |
80 | - if (!\is_string($value)) { |
|
80 | + if (!\is_string($value)){ |
|
81 | 81 | return $value; |
82 | 82 | } |
83 | 83 | |
84 | 84 | $alias = \strtolower($value); |
85 | - if (isset(self::VALUE_MAP[$alias])) { |
|
85 | + if (isset(self::VALUE_MAP[$alias])){ |
|
86 | 86 | return self::VALUE_MAP[$alias]; |
87 | 87 | } |
88 | 88 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | $this->dispatcher?->dispatch(new Finalizing($this)); |
28 | 28 | |
29 | - foreach ($this->finalizers as $finalizer) { |
|
29 | + foreach ($this->finalizers as $finalizer){ |
|
30 | 30 | \call_user_func($finalizer, $terminate); |
31 | 31 | } |
32 | 32 | } |
@@ -26,7 +26,8 @@ |
||
26 | 26 | { |
27 | 27 | $this->dispatcher?->dispatch(new Finalizing($this)); |
28 | 28 | |
29 | - foreach ($this->finalizers as $finalizer) { |
|
29 | + foreach ($this->finalizers as $finalizer) |
|
30 | + { |
|
30 | 31 | \call_user_func($finalizer, $terminate); |
31 | 32 | } |
32 | 33 | } |
@@ -43,14 +43,14 @@ |
||
43 | 43 | ? $class::DESCRIPTION |
44 | 44 | : '', |
45 | 45 | false, |
46 | - function () use ($class): SymfonyCommand { |
|
46 | + function () use ($class) : SymfonyCommand { |
|
47 | 47 | /** @var SpiralCommand $command */ |
48 | 48 | $command = $this->container->get($class); |
49 | 49 | |
50 | 50 | $command->setContainer($this->container); |
51 | 51 | $command->setInterceptors($this->interceptors); |
52 | 52 | |
53 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
53 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface){ |
|
54 | 54 | $command->setEventDispatcher($this->dispatcher); |
55 | 55 | } |
56 | 56 |
@@ -50,7 +50,8 @@ |
||
50 | 50 | $command->setContainer($this->container); |
51 | 51 | $command->setInterceptors($this->interceptors); |
52 | 52 | |
53 | - if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) { |
|
53 | + if ($this->dispatcher !== null && $command instanceof EventDispatcherAwareInterface) |
|
54 | + { |
|
54 | 55 | $command->setEventDispatcher($this->dispatcher); |
55 | 56 | } |
56 | 57 |
@@ -33,8 +33,10 @@ |
||
33 | 33 | public function locateCommands(): array |
34 | 34 | { |
35 | 35 | $commands = []; |
36 | - foreach ($this->commands as $command) { |
|
37 | - if ($command instanceof SymfonyCommand) { |
|
36 | + foreach ($this->commands as $command) |
|
37 | + { |
|
38 | + if ($command instanceof SymfonyCommand) |
|
39 | + { |
|
38 | 40 | $commands[] = $command; |
39 | 41 | continue; |
40 | 42 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | private readonly array $commands, |
24 | 24 | array $interceptors = [], |
25 | 25 | ContainerInterface $container = new Container(), |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | $this->interceptors = $interceptors; |
28 | 28 | $this->container = $container; |
29 | 29 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | public function locateCommands(): array |
35 | 35 | { |
36 | 36 | $commands = []; |
37 | - foreach ($this->commands as $command) { |
|
38 | - if ($command instanceof SymfonyCommand) { |
|
37 | + foreach ($this->commands as $command){ |
|
38 | + if ($command instanceof SymfonyCommand){ |
|
39 | 39 | $commands[] = $command; |
40 | 40 | continue; |
41 | 41 | } |
@@ -31,18 +31,21 @@ |
||
31 | 31 | public function execute(ContainerInterface $container, OutputInterface $output): void |
32 | 32 | { |
33 | 33 | $function = $this->function; |
34 | - if (\is_string($function) && \str_contains($function, ':')) { |
|
34 | + if (\is_string($function) && \str_contains($function, ':')) |
|
35 | + { |
|
35 | 36 | $function = \explode(':', \str_replace('::', ':', $function)); |
36 | 37 | } |
37 | 38 | |
38 | - if (\is_array($function) && isset($function[0]) && !\is_object($function[0])) { |
|
39 | + if (\is_array($function) && isset($function[0]) && !\is_object($function[0])) |
|
40 | + { |
|
39 | 41 | $function[0] = $container->get($function[0]); |
40 | 42 | } |
41 | 43 | |
42 | 44 | /** @var ResolverInterface $resolver */ |
43 | 45 | $resolver = $container->get(ResolverInterface::class); |
44 | 46 | |
45 | - if (\is_array($function)) { |
|
47 | + if (\is_array($function)) |
|
48 | + { |
|
46 | 49 | $reflection = new \ReflectionMethod($function[0], $function[1]); |
47 | 50 | $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [ |
48 | 51 | 'output' => $output, |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * @param string|callable|array<class-string, string> $function |
21 | 21 | */ |
22 | 22 | public function __construct( |
23 | - string|array|callable $function, |
|
23 | + string | array | callable $function, |
|
24 | 24 | string $header = '', |
25 | 25 | string $footer = '', |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | $this->function = $function; |
28 | 28 | parent::__construct($header, $footer); |
29 | 29 | } |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | public function execute(ContainerInterface $container, OutputInterface $output): void |
32 | 32 | { |
33 | 33 | $function = $this->function; |
34 | - if (\is_string($function) && \str_contains($function, ':')) { |
|
34 | + if (\is_string($function) && \str_contains($function, ':')){ |
|
35 | 35 | $function = \explode(':', \str_replace('::', ':', $function)); |
36 | 36 | } |
37 | 37 | |
38 | - if (\is_array($function) && isset($function[0]) && !\is_object($function[0])) { |
|
38 | + if (\is_array($function) && isset($function[0]) && !\is_object($function[0])){ |
|
39 | 39 | $function[0] = $container->get($function[0]); |
40 | 40 | } |
41 | 41 | |
42 | 42 | /** @var ResolverInterface $resolver */ |
43 | 43 | $resolver = $container->get(ResolverInterface::class); |
44 | 44 | |
45 | - if (\is_array($function)) { |
|
45 | + if (\is_array($function)){ |
|
46 | 46 | $reflection = new \ReflectionMethod($function[0], $function[1]); |
47 | 47 | $reflection->invokeArgs($function[0], $resolver->resolveArguments($reflection, [ |
48 | 48 | 'output' => $output, |