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