@@ -12,6 +12,6 @@ |
||
12 | 12 | public function __construct( |
13 | 13 | public AuthorizationStatus $status, |
14 | 14 | public readonly ServerRequestInterface $request |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | final class NullBroadcast implements BroadcastInterface |
10 | 10 | { |
11 | - public function publish(iterable|string|\Stringable $topics, iterable|string $messages): void |
|
11 | + public function publish(iterable | string | \Stringable $topics, iterable | string $messages): void |
|
12 | 12 | { |
13 | 13 | // Do nothing |
14 | 14 | } |
@@ -12,17 +12,17 @@ |
||
12 | 12 | public function __construct( |
13 | 13 | private readonly LoggerInterface $logger, |
14 | 14 | private readonly string $level = LogLevel::INFO |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | - public function publish(iterable|string|\Stringable $topics, iterable|string $messages): void |
|
18 | + public function publish(iterable | string | \Stringable $topics, iterable | string $messages): void |
|
19 | 19 | { |
20 | 20 | $topics = \implode(', ', $this->formatTopics($this->toArray($topics))); |
21 | 21 | |
22 | 22 | /** @var string $message */ |
23 | - foreach ($this->toArray($messages) as $message) { |
|
23 | + foreach ($this->toArray($messages) as $message){ |
|
24 | 24 | \assert(\is_string($message), 'Message argument must be a type of string'); |
25 | - $this->logger->log($this->level, 'Broadcasting on channels [' . $topics . '] with payload: ' . $message); |
|
25 | + $this->logger->log($this->level, 'Broadcasting on channels ['.$topics.'] with payload: '.$message); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -20,7 +20,8 @@ |
||
20 | 20 | $topics = \implode(', ', $this->formatTopics($this->toArray($topics))); |
21 | 21 | |
22 | 22 | /** @var string $message */ |
23 | - foreach ($this->toArray($messages) as $message) { |
|
23 | + foreach ($this->toArray($messages) as $message) |
|
24 | + { |
|
24 | 25 | \assert(\is_string($message), 'Message argument must be a type of string'); |
25 | 26 | $this->logger->log($this->level, 'Broadcasting on channels [' . $topics . '] with payload: ' . $message); |
26 | 27 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | public function __construct( |
29 | 29 | private readonly ConfiguratorInterface $config |
30 | - ) { |
|
30 | + ){ |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function registerDriverAlias(string $driverClass, string $alias): void |
@@ -26,5 +26,5 @@ |
||
26 | 26 | * @param MessagesList $messages |
27 | 27 | * @throws BroadcastException |
28 | 28 | */ |
29 | - public function publish(iterable|string|\Stringable $topics, iterable|string $messages): void; |
|
29 | + public function publish(iterable | string | \Stringable $topics, iterable | string $messages): void; |
|
30 | 30 | } |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | private readonly ResponseFactoryInterface $responseFactory, |
23 | 23 | private readonly ?string $authorizationPath = null, |
24 | 24 | private readonly ?EventDispatcherInterface $dispatcher = null |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function process( |
29 | 29 | ServerRequestInterface $request, |
30 | 30 | RequestHandlerInterface $handler |
31 | 31 | ): ResponseInterface { |
32 | - if ($request->getUri()->getPath() !== $this->authorizationPath) { |
|
32 | + if ($request->getUri()->getPath() !== $this->authorizationPath){ |
|
33 | 33 | return $handler->handle($request); |
34 | 34 | } |
35 | 35 | |
36 | - if ($this->broadcast instanceof GuardInterface) { |
|
36 | + if ($this->broadcast instanceof GuardInterface){ |
|
37 | 37 | $status = $this->broadcast->authorize($request); |
38 | - } else { |
|
38 | + }else{ |
|
39 | 39 | $status = new AuthorizationStatus( |
40 | 40 | success: true, |
41 | 41 | topics: null |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | |
45 | 45 | $this->dispatcher?->dispatch(new Authorized($status, $request)); |
46 | 46 | |
47 | - if ($status->response !== null) { |
|
47 | + if ($status->response !== null){ |
|
48 | 48 | return $status->response; |
49 | 49 | } |
50 | 50 | |
51 | - if (!$status->success) { |
|
51 | + if (!$status->success){ |
|
52 | 52 | return $this->responseFactory->createResponse(403); |
53 | 53 | } |
54 | 54 |
@@ -29,13 +29,17 @@ discard block |
||
29 | 29 | ServerRequestInterface $request, |
30 | 30 | RequestHandlerInterface $handler |
31 | 31 | ): ResponseInterface { |
32 | - if ($request->getUri()->getPath() !== $this->authorizationPath) { |
|
32 | + if ($request->getUri()->getPath() !== $this->authorizationPath) |
|
33 | + { |
|
33 | 34 | return $handler->handle($request); |
34 | 35 | } |
35 | 36 | |
36 | - if ($this->broadcast instanceof GuardInterface) { |
|
37 | + if ($this->broadcast instanceof GuardInterface) |
|
38 | + { |
|
37 | 39 | $status = $this->broadcast->authorize($request); |
38 | - } else { |
|
40 | + } |
|
41 | + else |
|
42 | + { |
|
39 | 43 | $status = new AuthorizationStatus( |
40 | 44 | success: true, |
41 | 45 | topics: null |
@@ -44,11 +48,13 @@ discard block |
||
44 | 48 | |
45 | 49 | $this->dispatcher?->dispatch(new Authorized($status, $request)); |
46 | 50 | |
47 | - if ($status->response !== null) { |
|
51 | + if ($status->response !== null) |
|
52 | + { |
|
48 | 53 | return $status->response; |
49 | 54 | } |
50 | 55 | |
51 | - if (!$status->success) { |
|
56 | + if (!$status->success) |
|
57 | + { |
|
52 | 58 | return $this->responseFactory->createResponse(403); |
53 | 59 | } |
54 | 60 |
@@ -13,10 +13,10 @@ |
||
13 | 13 | */ |
14 | 14 | public function __construct( |
15 | 15 | public readonly bool $success, |
16 | - public readonly ?array $topics, |
|
16 | + public readonly ? array $topics, |
|
17 | 17 | public readonly array $attributes = [], |
18 | 18 | public readonly ?ResponseInterface $response = null |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function get(array $values): array |
27 | 27 | { |
28 | 28 | $output = []; |
29 | - foreach ($values as $key => $value) { |
|
29 | + foreach ($values as $key => $value){ |
|
30 | 30 | $output[$key] = self::TYPE_DEFAULTS[\gettype($value)] ?? null; |
31 | 31 | } |
32 | 32 |
@@ -26,7 +26,8 @@ |
||
26 | 26 | public function get(array $values): array |
27 | 27 | { |
28 | 28 | $output = []; |
29 | - foreach ($values as $key => $value) { |
|
29 | + foreach ($values as $key => $value) |
|
30 | + { |
|
30 | 31 | $output[$key] = self::TYPE_DEFAULTS[\gettype($value)] ?? null; |
31 | 32 | } |
32 | 33 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function getAnnotation(mixed $value): string |
28 | 28 | { |
29 | - if (\is_array($value)) { |
|
29 | + if (\is_array($value)){ |
|
30 | 30 | return $this->arrayAnnotationString($value); |
31 | 31 | } |
32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | private function arrayAnnotationString(array $value): string |
42 | 42 | { |
43 | 43 | $types = []; |
44 | - foreach ($value as $item) { |
|
44 | + foreach ($value as $item){ |
|
45 | 45 | $types[] = \gettype($item); |
46 | 46 | } |
47 | 47 | $types = \array_unique($types); |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | public function getAnnotation(mixed $value): string |
28 | 28 | { |
29 | - if (\is_array($value)) { |
|
29 | + if (\is_array($value)) |
|
30 | + { |
|
30 | 31 | return $this->arrayAnnotationString($value); |
31 | 32 | } |
32 | 33 | |
@@ -41,7 +42,8 @@ discard block |
||
41 | 42 | private function arrayAnnotationString(array $value): string |
42 | 43 | { |
43 | 44 | $types = []; |
44 | - foreach ($value as $item) { |
|
45 | + foreach ($value as $item) |
|
46 | + { |
|
45 | 47 | $types[] = \gettype($item); |
46 | 48 | } |
47 | 49 | $types = \array_unique($types); |