Passed
Pull Request — master (#660)
by butschster
07:38
created
src/Broadcasting/src/Bootloader/WebsocketsBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@
 block discarded – undo
19 19
 
20 20
     public function start(HttpBootloader $http, BroadcastConfig $config): void
21 21
     {
22
-        if ($config->getAuthorizationPath() !== null) {
22
+        if ($config->getAuthorizationPath() !== null)
23
+        {
23 24
             $http->addMiddleware(AuthorizationMiddleware::class);
24 25
         }
25 26
     }
Please login to merge, or discard this patch.
src/Broadcasting/src/BroadcastManager.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
30 30
         // Replaces alias with real storage name
31 31
         $name = $this->config->getAliases()[$name] ?? $name;
32 32
 
33
-        if (isset($this->connections[$name])) {
33
+        if (isset($this->connections[$name]))
34
+        {
34 35
             return $this->connections[$name];
35 36
         }
36 37
 
Please login to merge, or discard this patch.
src/Broadcasting/src/Middleware/AuthorizationMiddleware.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,13 @@
 block discarded – undo
32 32
         ServerRequestInterface $request,
33 33
         RequestHandlerInterface $handler
34 34
     ): ResponseInterface {
35
-        if ($request->getUri()->getPath() !== $this->config->getAuthorizationPath()) {
35
+        if ($request->getUri()->getPath() !== $this->config->getAuthorizationPath())
36
+        {
36 37
             return $handler->handle($request);
37 38
         }
38 39
 
39
-        if ($this->broadcast->authorize($request)) {
40
+        if ($this->broadcast->authorize($request))
41
+        {
40 42
             return $this->responseFactory->createResponse(200);
41 43
         }
42 44
 
Please login to merge, or discard this patch.
src/Broadcasting/src/Driver/LogBroadcast.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,8 @@
 block discarded – undo
21 21
         $topics = implode(', ', $this->formatTopics($topics));
22 22
 
23 23
         /** @var string $message */
24
-        foreach ($this->toArray($messages) as $message) {
24
+        foreach ($this->toArray($messages) as $message)
25
+        {
25 26
             assert(\is_string($message), 'Message argument must be a type of string');
26 27
             $this->logger->info('Broadcasting on channels [' . $topics . '] with payload:' . PHP_EOL . $message);
27 28
         }
Please login to merge, or discard this patch.
src/Broadcasting/src/Driver/AbstractBroadcast.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
      */
17 17
     protected function formatTopics(array $topics): array
18 18
     {
19
-        return array_map(function ($topic) {
19
+        return array_map(function ($topic)
20
+        {
20 21
             return (string)$topic;
21 22
         }, $topics);
22 23
     }
@@ -28,7 +29,8 @@  discard block
 block discarded – undo
28 29
      */
29 30
     protected function toArray($entries): array
30 31
     {
31
-        switch (true) {
32
+        switch (true)
33
+        {
32 34
             case \is_array($entries):
33 35
                 return $entries;
34 36
 
Please login to merge, or discard this patch.
src/Broadcasting/src/Config/BroadcastConfig.php 1 patch
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
     {
28 28
         parent::__construct($config);
29 29
 
30
-        foreach ($config['authorize']['topics'] as $topic => $callback) {
30
+        foreach ($config['authorize']['topics'] as $topic => $callback)
31
+        {
31 32
             $this->patterns[$this->compilePattern($topic)] = $callback;
32 33
         }
33 34
     }
@@ -53,11 +54,13 @@  discard block
 block discarded – undo
53 54
      */
54 55
     public function getDefaultDriver(): string
55 56
     {
56
-        if (!isset($this->config['default']) || empty($this->config['default'])) {
57
+        if (!isset($this->config['default']) || empty($this->config['default']))
58
+        {
57 59
             throw new InvalidArgumentException('Default broadcast connection is not defined.');
58 60
         }
59 61
 
60
-        if (!\is_string($this->config['default'])) {
62
+        if (!\is_string($this->config['default']))
63
+        {
61 64
             throw new InvalidArgumentException('Default broadcast connection config value must be a string');
62 65
         }
63 66
 
@@ -66,7 +69,8 @@  discard block
 block discarded – undo
66 69
 
67 70
     public function getDriverConfig(string $name): array
68 71
     {
69
-        if (!isset($this->config['connections'][$name])) {
72
+        if (!isset($this->config['connections'][$name]))
73
+        {
70 74
             throw new InvalidArgumentException(
71 75
                 sprintf('Config for connection `%s` is not defined.', $name)
72 76
             );
@@ -74,19 +78,22 @@  discard block
 block discarded – undo
74 78
 
75 79
         $config = $this->config['connections'][$name];
76 80
 
77
-        if (!isset($config['driver'])) {
81
+        if (!isset($config['driver']))
82
+        {
78 83
             throw new InvalidArgumentException(
79 84
                 sprintf('Driver for `%s` connection is not defined.', $name)
80 85
             );
81 86
         }
82 87
 
83
-        if (!\is_string($config['driver'])) {
88
+        if (!\is_string($config['driver']))
89
+        {
84 90
             throw new InvalidArgumentException(
85 91
                 \sprintf('Driver value for `%s` connection must be a string', $name)
86 92
             );
87 93
         }
88 94
 
89
-        if (isset($this->config['driverAliases'][$config['driver']])) {
95
+        if (isset($this->config['driverAliases'][$config['driver']]))
96
+        {
90 97
             $config['driver'] = $this->config['driverAliases'][$config['driver']];
91 98
         }
92 99
 
@@ -95,8 +102,10 @@  discard block
 block discarded – undo
95 102
 
96 103
     public function findTopicCallback(string $topic, array &$matches): ?callable
97 104
     {
98
-        foreach ($this->patterns as $pattern => $callback) {
99
-            if (preg_match($pattern, $topic, $matches)) {
105
+        foreach ($this->patterns as $pattern => $callback)
106
+        {
107
+            if (preg_match($pattern, $topic, $matches))
108
+            {
100 109
                 return $callback;
101 110
             }
102 111
         }
@@ -107,9 +116,11 @@  discard block
 block discarded – undo
107 116
     private function compilePattern(string $topic): string
108 117
     {
109 118
         $replaces = [];
110
-        if (preg_match_all('/\{(\w+):?(.*?)?\}/', $topic, $matches)) {
119
+        if (preg_match_all('/\{(\w+):?(.*?)?\}/', $topic, $matches))
120
+        {
111 121
             $variables = array_combine($matches[1], $matches[2]);
112
-            foreach ($variables as $key => $_) {
122
+            foreach ($variables as $key => $_)
123
+            {
113 124
                 $replaces['{' . $key . '}'] = '(?P<' . $key . '>[^\/\.]+)';
114 125
             }
115 126
         }
Please login to merge, or discard this patch.