@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct( |
29 | 29 | private readonly ListenerRegistryInterface $listenerRegistry |
30 | - ) { |
|
30 | + ){ |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __invoke(LogEvent $event): void |
37 | 37 | { |
38 | - if (empty($this->output)) { |
|
38 | + if (empty($this->output)){ |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
42 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
42 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){ |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function enable(): self |
74 | 74 | { |
75 | - if (!empty($this->listenerRegistry)) { |
|
75 | + if (!empty($this->listenerRegistry)){ |
|
76 | 76 | $this->listenerRegistry->addListener($this); |
77 | 77 | } |
78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function disable(): self |
86 | 86 | { |
87 | - if (!empty($this->listenerRegistry)) { |
|
87 | + if (!empty($this->listenerRegistry)){ |
|
88 | 88 | $this->listenerRegistry->removeListener($this); |
89 | 89 | } |
90 | 90 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | private function getChannel(string $channel): string |
100 | 100 | { |
101 | - if (!\class_exists($channel, false)) { |
|
101 | + if (!\class_exists($channel, false)){ |
|
102 | 102 | return \sprintf('[%s]', $channel); |
103 | 103 | } |
104 | 104 | |
105 | - try { |
|
105 | + try{ |
|
106 | 106 | $reflection = new \ReflectionClass($channel); |
107 | - } catch (\ReflectionException) { |
|
107 | + }catch (\ReflectionException){ |
|
108 | 108 | return $channel; |
109 | 109 | } |
110 | 110 | |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | |
114 | 114 | private function getMessage(bool $decorated, string $message): string |
115 | 115 | { |
116 | - if (!$decorated) { |
|
116 | + if (!$decorated){ |
|
117 | 117 | return $message; |
118 | 118 | } |
119 | 119 | |
120 | - return Color::GRAY . $message . Color::RESET; |
|
120 | + return Color::GRAY.$message.Color::RESET; |
|
121 | 121 | } |
122 | 122 | } |
@@ -35,11 +35,13 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __invoke(LogEvent $event): void |
37 | 37 | { |
38 | - if (empty($this->output)) { |
|
38 | + if (empty($this->output)) |
|
39 | + { |
|
39 | 40 | return; |
40 | 41 | } |
41 | 42 | |
42 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
43 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) |
|
44 | + { |
|
43 | 45 | return; |
44 | 46 | } |
45 | 47 | |
@@ -72,7 +74,8 @@ discard block |
||
72 | 74 | */ |
73 | 75 | public function enable(): self |
74 | 76 | { |
75 | - if (!empty($this->listenerRegistry)) { |
|
77 | + if (!empty($this->listenerRegistry)) |
|
78 | + { |
|
76 | 79 | $this->listenerRegistry->addListener($this); |
77 | 80 | } |
78 | 81 | |
@@ -84,7 +87,8 @@ discard block |
||
84 | 87 | */ |
85 | 88 | public function disable(): self |
86 | 89 | { |
87 | - if (!empty($this->listenerRegistry)) { |
|
90 | + if (!empty($this->listenerRegistry)) |
|
91 | + { |
|
88 | 92 | $this->listenerRegistry->removeListener($this); |
89 | 93 | } |
90 | 94 | |
@@ -98,13 +102,17 @@ discard block |
||
98 | 102 | |
99 | 103 | private function getChannel(string $channel): string |
100 | 104 | { |
101 | - if (!\class_exists($channel, false)) { |
|
105 | + if (!\class_exists($channel, false)) |
|
106 | + { |
|
102 | 107 | return \sprintf('[%s]', $channel); |
103 | 108 | } |
104 | 109 | |
105 | - try { |
|
110 | + try |
|
111 | + { |
|
106 | 112 | $reflection = new \ReflectionClass($channel); |
107 | - } catch (\ReflectionException) { |
|
113 | + } |
|
114 | + catch (\ReflectionException) |
|
115 | + { |
|
108 | 116 | return $channel; |
109 | 117 | } |
110 | 118 | |
@@ -113,7 +121,8 @@ discard block |
||
113 | 121 | |
114 | 122 | private function getMessage(bool $decorated, string $message): string |
115 | 123 | { |
116 | - if (!$decorated) { |
|
124 | + if (!$decorated) |
|
125 | + { |
|
117 | 126 | return $message; |
118 | 127 | } |
119 | 128 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | private readonly TranslatorInterface $translator |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function process(ViewSource $source, ContextInterface $context): ViewSource |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function __construct( |
20 | 20 | private readonly TranslatorInterface $translator |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | $this->locales = $translator->getCatalogueManager()->getLocales(); |
23 | 23 | } |
24 | 24 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct( |
13 | 13 | private readonly MemoryInterface $memory |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function setLocales(?array $locales): void |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Spiral\Core\Container\Autowire; |
7 | 7 | use Spiral\Router\RouterInterface; |
8 | 8 | |
9 | -if (!\function_exists('bind')) { |
|
9 | +if (!\function_exists('bind')){ |
|
10 | 10 | /** |
11 | 11 | * Shortcut to container Autowire definition. |
12 | 12 | * |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if (!\function_exists('route')) { |
|
24 | +if (!\function_exists('route')){ |
|
25 | 25 | /** |
26 | 26 | * Generate the URL to a named route. |
27 | 27 | * |
@@ -6,7 +6,8 @@ discard block |
||
6 | 6 | use Spiral\Core\Container\Autowire; |
7 | 7 | use Spiral\Router\RouterInterface; |
8 | 8 | |
9 | -if (!\function_exists('bind')) { |
|
9 | +if (!\function_exists('bind')) |
|
10 | +{ |
|
10 | 11 | /** |
11 | 12 | * Shortcut to container Autowire definition. |
12 | 13 | * |
@@ -21,7 +22,8 @@ discard block |
||
21 | 22 | } |
22 | 23 | } |
23 | 24 | |
24 | -if (!\function_exists('route')) { |
|
25 | +if (!\function_exists('route')) |
|
26 | +{ |
|
25 | 27 | /** |
26 | 28 | * Generate the URL to a named route. |
27 | 29 | * |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | private readonly PermissionsInterface $permissions, |
21 | 21 | private readonly ContainerInterface $container, |
22 | 22 | private array $roles = [] |
23 | - ) { |
|
23 | + ){ |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | public function allows(string $permission, array $context = []): bool |
30 | 30 | { |
31 | 31 | $allows = false; |
32 | - foreach ($this->getRoles() as $role) { |
|
33 | - if (!$this->permissions->hasRole($role)) { |
|
32 | + foreach ($this->getRoles() as $role){ |
|
33 | + if (!$this->permissions->hasRole($role)){ |
|
34 | 34 | continue; |
35 | 35 | } |
36 | 36 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getActor(): ActorInterface |
72 | 72 | { |
73 | - if (!\is_null($this->actor)) { |
|
73 | + if (!\is_null($this->actor)){ |
|
74 | 74 | return $this->actor; |
75 | 75 | } |
76 | 76 | |
77 | - try { |
|
77 | + try{ |
|
78 | 78 | return $this->container->get(ActorInterface::class); |
79 | - } catch (NotFoundExceptionInterface $e) { |
|
79 | + }catch (NotFoundExceptionInterface $e){ |
|
80 | 80 | throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e); |
81 | 81 | } |
82 | 82 | } |
@@ -29,8 +29,10 @@ discard block |
||
29 | 29 | public function allows(string $permission, array $context = []): bool |
30 | 30 | { |
31 | 31 | $allows = false; |
32 | - foreach ($this->getRoles() as $role) { |
|
33 | - if (!$this->permissions->hasRole($role)) { |
|
32 | + foreach ($this->getRoles() as $role) |
|
33 | + { |
|
34 | + if (!$this->permissions->hasRole($role)) |
|
35 | + { |
|
34 | 36 | continue; |
35 | 37 | } |
36 | 38 | |
@@ -70,13 +72,17 @@ discard block |
||
70 | 72 | */ |
71 | 73 | public function getActor(): ActorInterface |
72 | 74 | { |
73 | - if (!\is_null($this->actor)) { |
|
75 | + if (!\is_null($this->actor)) |
|
76 | + { |
|
74 | 77 | return $this->actor; |
75 | 78 | } |
76 | 79 | |
77 | - try { |
|
80 | + try |
|
81 | + { |
|
78 | 82 | return $this->container->get(ActorInterface::class); |
79 | - } catch (NotFoundExceptionInterface $e) { |
|
83 | + } |
|
84 | + catch (NotFoundExceptionInterface $e) |
|
85 | + { |
|
80 | 86 | throw new ScopeException('Unable to resolve Actor from the scope', $e->getCode(), $e); |
81 | 87 | } |
82 | 88 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function populate(StateInterface $state): void |
25 | 25 | { |
26 | - if ($this->request === null) { |
|
26 | + if ($this->request === null){ |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | $state->setVariable('headers', $this->request->getHeaders()); |
34 | 34 | |
35 | - if ($this->request->getQueryParams() !== []) { |
|
35 | + if ($this->request->getQueryParams() !== []){ |
|
36 | 36 | $state->setVariable('query', $this->request->getQueryParams()); |
37 | 37 | } |
38 | 38 | |
39 | - if ($this->request->getParsedBody() !== null) { |
|
39 | + if ($this->request->getParsedBody() !== null){ |
|
40 | 40 | $state->setVariable('data', $this->request->getParsedBody()); |
41 | 41 | } |
42 | 42 | } |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | public function populate(StateInterface $state): void |
25 | 25 | { |
26 | - if ($this->request === null) { |
|
26 | + if ($this->request === null) |
|
27 | + { |
|
27 | 28 | return; |
28 | 29 | } |
29 | 30 | |
@@ -32,11 +33,13 @@ discard block |
||
32 | 33 | |
33 | 34 | $state->setVariable('headers', $this->request->getHeaders()); |
34 | 35 | |
35 | - if ($this->request->getQueryParams() !== []) { |
|
36 | + if ($this->request->getQueryParams() !== []) |
|
37 | + { |
|
36 | 38 | $state->setVariable('query', $this->request->getQueryParams()); |
37 | 39 | } |
38 | 40 | |
39 | - if ($this->request->getParsedBody() !== null) { |
|
41 | + if ($this->request->getParsedBody() !== null) |
|
42 | + { |
|
40 | 43 | $state->setVariable('data', $this->request->getParsedBody()); |
41 | 44 | } |
42 | 45 | } |
@@ -15,14 +15,14 @@ |
||
15 | 15 | public function __construct( |
16 | 16 | private readonly ContainerInterface $container, |
17 | 17 | private readonly EnvironmentInterface $env |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function populate(StateInterface $state): void |
22 | 22 | { |
23 | 23 | $state->setTag('php', \phpversion()); |
24 | 24 | |
25 | - if ($this->container->has(DispatcherInterface::class)) { |
|
25 | + if ($this->container->has(DispatcherInterface::class)){ |
|
26 | 26 | $state->setTag('dispatcher', $this->container->get(DispatcherInterface::class)::class); |
27 | 27 | } |
28 | 28 |
@@ -22,7 +22,8 @@ |
||
22 | 22 | { |
23 | 23 | $state->setTag('php', \phpversion()); |
24 | 24 | |
25 | - if ($this->container->has(DispatcherInterface::class)) { |
|
25 | + if ($this->container->has(DispatcherInterface::class)) |
|
26 | + { |
|
26 | 27 | $state->setTag('dispatcher', $this->container->get(DispatcherInterface::class)::class); |
27 | 28 | } |
28 | 29 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct( |
13 | 13 | private FileSnapshot $fileSnapshot, |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function report(\Throwable $exception): void |