Passed
Pull Request — master (#225)
by Anton
02:31
created
tests/Framework/GRPC/DispatcherTest.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
     public function setUp(): void
24 24
     {
25 25
         exec('protoc 2>&1', $out);
26
-        if (strpos(join("\n", $out), '--php_out') === false) {
26
+        if (strpos(join("\n", $out), '--php_out') === false){
27 27
             $this->markTestSkipped('Protoc binary is missing');
28 28
         }
29 29
 
30 30
         parent::setUp();
31 31
 
32 32
         $fs = new Files();
33
-        $proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto');
33
+        $proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto');
34 34
 
35 35
         // protoc can't figure relative paths
36 36
         $proto = str_replace('Framework/../', '', $proto);
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             'proto' => $proto
40 40
         ]);
41 41
 
42
-        file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE);
42
+        file_put_contents($this->app->dir('app').'src/Service/EchoService.php', GenerateTest::SERVICE);
43 43
     }
44 44
 
45 45
     public function tearDown(): void
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 
49 49
         $fs = new Files();
50 50
 
51
-        if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) {
52
-            $fs->deleteDirectory($this->app->dir('app') . 'src/Service');
51
+        if ($fs->isDirectory($this->app->dir('app').'src/Service')){
52
+            $fs->deleteDirectory($this->app->dir('app').'src/Service');
53 53
         }
54 54
 
55
-        if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) {
56
-            $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata');
55
+        if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){
56
+            $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata');
57 57
         }
58 58
     }
59 59
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $msg->setMsg('hello');
80 80
 
81 81
         $w->shouldReceive('receive')->once()->with(
82
-            \Mockery::on(function (&$context) {
82
+            \Mockery::on(function (&$context){
83 83
                 $context = '{
84 84
                   "service": "service.Echo",
85 85
                   "method": "Ping",
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         )->andReturn($msg->serializeToString());
92 92
 
93 93
         $w->shouldReceive('send')->once()->with(
94
-            \Mockery::on(function ($out) {
94
+            \Mockery::on(function ($out){
95 95
                 $msg = new Message();
96 96
                 $msg->mergeFromString($out);
97 97
                 $this->assertSame('hello', $msg->getMsg());
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         // one command only
105 105
         $w->shouldReceive('receive')->once()->with(
106
-            \Mockery::on(function (&$context) {
106
+            \Mockery::on(function (&$context){
107 107
                 $context = null;
108 108
                 return true;
109 109
             })
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $msg->setMsg('hello');
124 124
 
125 125
         $w->shouldReceive('receive')->once()->with(
126
-            \Mockery::on(function (&$context) {
126
+            \Mockery::on(function (&$context){
127 127
                 $context = '{
128 128
                   "service": "service.Echo",
129 129
                   "method": "Invalid",
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         )->andReturn($msg->serializeToString());
136 136
 
137 137
         $w->shouldReceive('error')->once()->with(
138
-            \Mockery::on(function ($out) {
138
+            \Mockery::on(function ($out){
139 139
                 $this->assertContains('Method `Invalid` not found', $out);
140 140
                 return true;
141 141
             })
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
         // one command only
145 145
         $w->shouldReceive('receive')->once()->with(
146
-            \Mockery::on(function (&$context) {
146
+            \Mockery::on(function (&$context){
147 147
                 $context = null;
148 148
                 return true;
149 149
             })
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
     public function setUp(): void
24 24
     {
25 25
         exec('protoc 2>&1', $out);
26
-        if (strpos(join("\n", $out), '--php_out') === false) {
26
+        if (strpos(join("\n", $out), '--php_out') === false)
27
+        {
27 28
             $this->markTestSkipped('Protoc binary is missing');
28 29
         }
29 30
 
@@ -48,11 +49,13 @@  discard block
 block discarded – undo
48 49
 
49 50
         $fs = new Files();
50 51
 
51
-        if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) {
52
+        if ($fs->isDirectory($this->app->dir('app') . 'src/Service'))
53
+        {
52 54
             $fs->deleteDirectory($this->app->dir('app') . 'src/Service');
53 55
         }
54 56
 
55
-        if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) {
57
+        if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata'))
58
+        {
56 59
             $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata');
57 60
         }
58 61
     }
@@ -79,7 +82,8 @@  discard block
 block discarded – undo
79 82
         $msg->setMsg('hello');
80 83
 
81 84
         $w->shouldReceive('receive')->once()->with(
82
-            \Mockery::on(function (&$context) {
85
+            \Mockery::on(function (&$context)
86
+            {
83 87
                 $context = '{
84 88
                   "service": "service.Echo",
85 89
                   "method": "Ping",
@@ -91,7 +95,8 @@  discard block
 block discarded – undo
91 95
         )->andReturn($msg->serializeToString());
92 96
 
93 97
         $w->shouldReceive('send')->once()->with(
94
-            \Mockery::on(function ($out) {
98
+            \Mockery::on(function ($out)
99
+            {
95 100
                 $msg = new Message();
96 101
                 $msg->mergeFromString($out);
97 102
                 $this->assertSame('hello', $msg->getMsg());
@@ -103,7 +108,8 @@  discard block
 block discarded – undo
103 108
 
104 109
         // one command only
105 110
         $w->shouldReceive('receive')->once()->with(
106
-            \Mockery::on(function (&$context) {
111
+            \Mockery::on(function (&$context)
112
+            {
107 113
                 $context = null;
108 114
                 return true;
109 115
             })
@@ -123,7 +129,8 @@  discard block
 block discarded – undo
123 129
         $msg->setMsg('hello');
124 130
 
125 131
         $w->shouldReceive('receive')->once()->with(
126
-            \Mockery::on(function (&$context) {
132
+            \Mockery::on(function (&$context)
133
+            {
127 134
                 $context = '{
128 135
                   "service": "service.Echo",
129 136
                   "method": "Invalid",
@@ -135,7 +142,8 @@  discard block
 block discarded – undo
135 142
         )->andReturn($msg->serializeToString());
136 143
 
137 144
         $w->shouldReceive('error')->once()->with(
138
-            \Mockery::on(function ($out) {
145
+            \Mockery::on(function ($out)
146
+            {
139 147
                 $this->assertContains('Method `Invalid` not found', $out);
140 148
                 return true;
141 149
             })
@@ -143,7 +151,8 @@  discard block
 block discarded – undo
143 151
 
144 152
         // one command only
145 153
         $w->shouldReceive('receive')->once()->with(
146
-            \Mockery::on(function (&$context) {
154
+            \Mockery::on(function (&$context)
155
+            {
147 156
                 $context = null;
148 157
                 return true;
149 158
             })
Please login to merge, or discard this patch.
tests/app/src/Bootloader/WSBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@
 block discarded – undo
21 21
 
22 22
     public function boot(WebsocketsBootloader $ws, EnvironmentInterface $env): void
23 23
     {
24
-        if ($env->get('RR_BROADCAST_PATH') === null) {
24
+        if ($env->get('RR_BROADCAST_PATH') === null){
25 25
             return;
26 26
         }
27 27
 
28 28
         $ws->setServerCallback($env->get('WS_SERVER_CALLBACK'));
29 29
 
30
-        if ($env->get('WS_TOPIC_CALLBACK') !== null) {
30
+        if ($env->get('WS_TOPIC_CALLBACK') !== null){
31 31
             $ws->addTopicCallback('topic', $env->get('WS_TOPIC_CALLBACK'));
32 32
         }
33 33
 
34
-        if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null) {
34
+        if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null){
35 35
             $ws->addTopicCallback('wildcard.{id}', $env->get('WS_TOPIC_WILDCARD_CALLBACK'));
36 36
         }
37 37
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,17 +21,20 @@
 block discarded – undo
21 21
 
22 22
     public function boot(WebsocketsBootloader $ws, EnvironmentInterface $env): void
23 23
     {
24
-        if ($env->get('RR_BROADCAST_PATH') === null) {
24
+        if ($env->get('RR_BROADCAST_PATH') === null)
25
+        {
25 26
             return;
26 27
         }
27 28
 
28 29
         $ws->setServerCallback($env->get('WS_SERVER_CALLBACK'));
29 30
 
30
-        if ($env->get('WS_TOPIC_CALLBACK') !== null) {
31
+        if ($env->get('WS_TOPIC_CALLBACK') !== null)
32
+        {
31 33
             $ws->addTopicCallback('topic', $env->get('WS_TOPIC_CALLBACK'));
32 34
         }
33 35
 
34
-        if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null) {
36
+        if ($env->get('WS_TOPIC_WILDCARD_CALLBACK') !== null)
37
+        {
35 38
             $ws->addTopicCallback('wildcard.{id}', $env->get('WS_TOPIC_WILDCARD_CALLBACK'));
36 39
         }
37 40
     }
Please login to merge, or discard this patch.
src/Bootloader/Http/WebsocketsBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
             'authorizeTopics' => []
54 54
         ]);
55 55
 
56
-        if ($env->get('RR_BROADCAST_PATH', null) !== null) {
56
+        if ($env->get('RR_BROADCAST_PATH', null) !== null){
57 57
             $http->addMiddleware(WebsocketsMiddleware::class);
58 58
         }
59 59
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,8 @@
 block discarded – undo
53 53
             'authorizeTopics' => []
54 54
         ]);
55 55
 
56
-        if ($env->get('RR_BROADCAST_PATH', null) !== null) {
56
+        if ($env->get('RR_BROADCAST_PATH', null) !== null)
57
+        {
57 58
             $http->addMiddleware(WebsocketsMiddleware::class);
58 59
         }
59 60
     }
Please login to merge, or discard this patch.
tests/Framework/Http/WebsocketsTest.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function testAllowServerAccess(): void
40 40
     {
41
-        $this->init(static function () {
41
+        $this->init(static function (){
42 42
             return true;
43 43
         });
44 44
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function testDenyServerAccess(): void
52 52
     {
53
-        $this->init(static function () {
53
+        $this->init(static function (){
54 54
             return false;
55 55
         });
56 56
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function testServerAccessWithDependency(): void
64 64
     {
65
-        $this->init(static function (ServerRequestInterface $request) {
65
+        $this->init(static function (ServerRequestInterface $request){
66 66
             return $request instanceof ServerRequestInterface;
67 67
         });
68 68
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
     public function testTopicAccessOK(): void
126 126
     {
127
-        $this->init(null, function () {
127
+        $this->init(null, function (){
128 128
             return true;
129 129
         });
130 130
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
     public function testTopicWildcardAccessFail(): void
138 138
     {
139
-        $this->init(null, function () {
139
+        $this->init(null, function (){
140 140
             return true;
141 141
         });
142 142
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $this->init(
152 152
             null,
153 153
             null,
154
-            function () {
154
+            function (){
155 155
                 return true;
156 156
             }
157 157
         );
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $this->init(
168 168
             null,
169 169
             null,
170
-            function ($id) {
170
+            function ($id){
171 171
                 return $id === '1';
172 172
             }
173 173
         );
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         $this->init(
184 184
             null,
185 185
             null,
186
-            function ($id) {
186
+            function ($id){
187 187
                 return $id === '1';
188 188
             }
189 189
         );
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             'CYCLE_AUTH'                 => true,
205 205
             'RR_BROADCAST_PATH'          => '/ws/',
206 206
             'WS_SERVER_CALLBACK'         => null,
207
-            'WS_TOPIC_CALLBACK'          => function (AuthContextInterface $authContext) {
207
+            'WS_TOPIC_CALLBACK'          => function (AuthContextInterface $authContext){
208 208
                 return $authContext->getToken() !== null;
209 209
             },
210 210
             'WS_TOPIC_WILDCARD_CALLBACK' => null,
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function testAllowServerAccess(): void
40 40
     {
41
-        $this->init(static function () {
41
+        $this->init(static function ()
42
+        {
42 43
             return true;
43 44
         });
44 45
 
@@ -50,7 +51,8 @@  discard block
 block discarded – undo
50 51
 
51 52
     public function testDenyServerAccess(): void
52 53
     {
53
-        $this->init(static function () {
54
+        $this->init(static function ()
55
+        {
54 56
             return false;
55 57
         });
56 58
 
@@ -62,7 +64,8 @@  discard block
 block discarded – undo
62 64
 
63 65
     public function testServerAccessWithDependency(): void
64 66
     {
65
-        $this->init(static function (ServerRequestInterface $request) {
67
+        $this->init(static function (ServerRequestInterface $request)
68
+        {
66 69
             return $request instanceof ServerRequestInterface;
67 70
         });
68 71
 
@@ -124,7 +127,8 @@  discard block
 block discarded – undo
124 127
 
125 128
     public function testTopicAccessOK(): void
126 129
     {
127
-        $this->init(null, function () {
130
+        $this->init(null, function ()
131
+        {
128 132
             return true;
129 133
         });
130 134
 
@@ -136,7 +140,8 @@  discard block
 block discarded – undo
136 140
 
137 141
     public function testTopicWildcardAccessFail(): void
138 142
     {
139
-        $this->init(null, function () {
143
+        $this->init(null, function ()
144
+        {
140 145
             return true;
141 146
         });
142 147
 
@@ -151,7 +156,8 @@  discard block
 block discarded – undo
151 156
         $this->init(
152 157
             null,
153 158
             null,
154
-            function () {
159
+            function ()
160
+            {
155 161
                 return true;
156 162
             }
157 163
         );
@@ -167,7 +173,8 @@  discard block
 block discarded – undo
167 173
         $this->init(
168 174
             null,
169 175
             null,
170
-            function ($id) {
176
+            function ($id)
177
+            {
171 178
                 return $id === '1';
172 179
             }
173 180
         );
@@ -183,7 +190,8 @@  discard block
 block discarded – undo
183 190
         $this->init(
184 191
             null,
185 192
             null,
186
-            function ($id) {
193
+            function ($id)
194
+            {
187 195
                 return $id === '1';
188 196
             }
189 197
         );
@@ -204,7 +212,8 @@  discard block
 block discarded – undo
204 212
             'CYCLE_AUTH'                 => true,
205 213
             'RR_BROADCAST_PATH'          => '/ws/',
206 214
             'WS_SERVER_CALLBACK'         => null,
207
-            'WS_TOPIC_CALLBACK'          => function (AuthContextInterface $authContext) {
215
+            'WS_TOPIC_CALLBACK'          => function (AuthContextInterface $authContext)
216
+            {
208 217
                 return $authContext->getToken() !== null;
209 218
             },
210 219
             'WS_TOPIC_WILDCARD_CALLBACK' => null,
Please login to merge, or discard this patch.
tests/Framework/HttpTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         array $headers = []
46 46
     ): ResponseInterface {
47 47
         $r = $this->request($uri, 'GET', [], $headers, []);
48
-        foreach ($attributes as $k => $v) {
48
+        foreach ($attributes as $k => $v){
49 49
             $r = $r->withAttribute($k, $v);
50 50
         }
51 51
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     protected function fetchCookies(array $header)
87 87
     {
88 88
         $result = [];
89
-        foreach ($header as $line) {
89
+        foreach ($header as $line){
90 90
             $cookie = explode('=', $line);
91 91
             $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));
92 92
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
         array $headers = []
46 46
     ): ResponseInterface {
47 47
         $r = $this->request($uri, 'GET', [], $headers, []);
48
-        foreach ($attributes as $k => $v) {
48
+        foreach ($attributes as $k => $v)
49
+        {
49 50
             $r = $r->withAttribute($k, $v);
50 51
         }
51 52
 
@@ -86,7 +87,8 @@  discard block
 block discarded – undo
86 87
     protected function fetchCookies(array $header)
87 88
     {
88 89
         $result = [];
89
-        foreach ($header as $line) {
90
+        foreach ($header as $line)
91
+        {
90 92
             $cookie = explode('=', $line);
91 93
             $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));
92 94
         }
Please login to merge, or discard this patch.
src/Broadcast/Middleware/WebsocketsMiddleware.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         ScopeInterface $scope,
51 51
         ResolverInterface $resolver,
52 52
         ResponseFactoryInterface $responseFactory
53
-    ) {
53
+    ){
54 54
         $this->config = $config;
55 55
         $this->scope = $scope;
56 56
         $this->resolver = $resolver;
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
69 69
     {
70
-        if ($request->getUri()->getPath() !== $this->config->getPath()) {
70
+        if ($request->getUri()->getPath() !== $this->config->getPath()){
71 71
             return $handler->handle($request);
72 72
         }
73 73
 
74 74
         // server authorization
75
-        if ($request->getAttribute('ws:joinServer', null) !== null) {
76
-            if (!$this->authorizeServer($request)) {
75
+        if ($request->getAttribute('ws:joinServer', null) !== null){
76
+            if (!$this->authorizeServer($request)){
77 77
                 return $this->responseFactory->createResponse(403);
78 78
             }
79 79
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
         }
82 82
 
83 83
         // topic authorization
84
-        if (is_string($request->getAttribute('ws:joinTopics', null))) {
84
+        if (is_string($request->getAttribute('ws:joinTopics', null))){
85 85
             $topics = explode(',', $request->getAttribute('ws:joinTopics'));
86
-            foreach ($topics as $topic) {
87
-                if (!$this->authorizeTopic($request, $topic)) {
86
+            foreach ($topics as $topic){
87
+                if (!$this->authorizeTopic($request, $topic)){
88 88
                     return $this->responseFactory->createResponse(403);
89 89
                 }
90 90
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     private function authorizeServer(ServerRequestInterface $request): bool
105 105
     {
106 106
         $callback = $this->config->getServerCallback();
107
-        if ($callback === null) {
107
+        if ($callback === null){
108 108
             return true;
109 109
         }
110 110
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $parameters = [];
124 124
         $callback = $this->config->findTopicCallback($topic, $parameters);
125
-        if ($callback === null) {
125
+        if ($callback === null){
126 126
             return false;
127 127
         }
128 128
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         /** @var \ReflectionFunctionAbstract $reflection */
143 143
         $reflection = null;
144
-        switch (true) {
144
+        switch (true){
145 145
             case $callback instanceof \Closure || is_string($callback):
146 146
                 $reflection = new \ReflectionFunction($callback);
147 147
                 break;
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,13 +67,16 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
69 69
     {
70
-        if ($request->getUri()->getPath() !== $this->config->getPath()) {
70
+        if ($request->getUri()->getPath() !== $this->config->getPath())
71
+        {
71 72
             return $handler->handle($request);
72 73
         }
73 74
 
74 75
         // server authorization
75
-        if ($request->getAttribute('ws:joinServer', null) !== null) {
76
-            if (!$this->authorizeServer($request)) {
76
+        if ($request->getAttribute('ws:joinServer', null) !== null)
77
+        {
78
+            if (!$this->authorizeServer($request))
79
+            {
77 80
                 return $this->responseFactory->createResponse(403);
78 81
             }
79 82
 
@@ -81,10 +84,13 @@  discard block
 block discarded – undo
81 84
         }
82 85
 
83 86
         // topic authorization
84
-        if (is_string($request->getAttribute('ws:joinTopics', null))) {
87
+        if (is_string($request->getAttribute('ws:joinTopics', null)))
88
+        {
85 89
             $topics = explode(',', $request->getAttribute('ws:joinTopics'));
86
-            foreach ($topics as $topic) {
87
-                if (!$this->authorizeTopic($request, $topic)) {
90
+            foreach ($topics as $topic)
91
+            {
92
+                if (!$this->authorizeTopic($request, $topic))
93
+                {
88 94
                     return $this->responseFactory->createResponse(403);
89 95
                 }
90 96
             }
@@ -104,7 +110,8 @@  discard block
 block discarded – undo
104 110
     private function authorizeServer(ServerRequestInterface $request): bool
105 111
     {
106 112
         $callback = $this->config->getServerCallback();
107
-        if ($callback === null) {
113
+        if ($callback === null)
114
+        {
108 115
             return true;
109 116
         }
110 117
 
@@ -122,7 +129,8 @@  discard block
 block discarded – undo
122 129
     {
123 130
         $parameters = [];
124 131
         $callback = $this->config->findTopicCallback($topic, $parameters);
125
-        if ($callback === null) {
132
+        if ($callback === null)
133
+        {
126 134
             return false;
127 135
         }
128 136
 
@@ -141,7 +149,8 @@  discard block
 block discarded – undo
141 149
     {
142 150
         /** @var \ReflectionFunctionAbstract $reflection */
143 151
         $reflection = null;
144
-        switch (true) {
152
+        switch (true)
153
+        {
145 154
             case $callback instanceof \Closure || is_string($callback):
146 155
                 $reflection = new \ReflectionFunction($callback);
147 156
                 break;
@@ -159,7 +168,8 @@  discard block
 block discarded – undo
159 168
             [
160 169
                 ServerRequestInterface::class => $request
161 170
             ],
162
-            function () use ($reflection, $parameters, $callback) {
171
+            function () use ($reflection, $parameters, $callback)
172
+            {
163 173
                 return call_user_func_array(
164 174
                     $callback,
165 175
                     $this->resolver->resolveArguments($reflection, $parameters)
Please login to merge, or discard this patch.
src/Broadcast/Config/WebsocketsConfig.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         parent::__construct($config);
36 36
 
37
-        foreach ($config['authorizeTopics'] as $topic => $callback) {
37
+        foreach ($config['authorizeTopics'] as $topic => $callback){
38 38
             $this->patterns[$this->compilePattern($topic)] = $callback;
39 39
         }
40 40
     }
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function findTopicCallback(string $topic, array &$matches): ?callable
64 64
     {
65
-        foreach ($this->patterns as $pattern => $callback) {
66
-            if (preg_match($pattern, $topic, $matches)) {
65
+        foreach ($this->patterns as $pattern => $callback){
66
+            if (preg_match($pattern, $topic, $matches)){
67 67
                 return $callback;
68 68
             }
69 69
         }
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
     private function compilePattern(string $topic): string
79 79
     {
80 80
         $replaces = [];
81
-        if (preg_match_all('/\{(\w+):?(.*?)?\}/', $topic, $matches)) {
81
+        if (preg_match_all('/\{(\w+):?(.*?)?\}/', $topic, $matches)){
82 82
             $variables = array_combine($matches[1], $matches[2]);
83
-            foreach ($variables as $key => $segment) {
84
-                $replaces['{' . $key . '}'] = '(?P<' . $key . '>[^\/\.]+)';
83
+            foreach ($variables as $key => $segment){
84
+                $replaces['{'.$key.'}'] = '(?P<'.$key.'>[^\/\.]+)';
85 85
             }
86 86
         }
87 87
 
88
-        return '/^' . strtr($topic, $replaces + ['/' => '\\/', '[' => '(?:', ']' => ')?', '.' => '\.']) . '$/iu';
88
+        return '/^'.strtr($topic, $replaces + ['/' => '\\/', '[' => '(?:', ']' => ')?', '.' => '\.']).'$/iu';
89 89
     }
90 90
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
     {
35 35
         parent::__construct($config);
36 36
 
37
-        foreach ($config['authorizeTopics'] as $topic => $callback) {
37
+        foreach ($config['authorizeTopics'] as $topic => $callback)
38
+        {
38 39
             $this->patterns[$this->compilePattern($topic)] = $callback;
39 40
         }
40 41
     }
@@ -62,8 +63,10 @@  discard block
 block discarded – undo
62 63
      */
63 64
     public function findTopicCallback(string $topic, array &$matches): ?callable
64 65
     {
65
-        foreach ($this->patterns as $pattern => $callback) {
66
-            if (preg_match($pattern, $topic, $matches)) {
66
+        foreach ($this->patterns as $pattern => $callback)
67
+        {
68
+            if (preg_match($pattern, $topic, $matches))
69
+            {
67 70
                 return $callback;
68 71
             }
69 72
         }
@@ -78,9 +81,11 @@  discard block
 block discarded – undo
78 81
     private function compilePattern(string $topic): string
79 82
     {
80 83
         $replaces = [];
81
-        if (preg_match_all('/\{(\w+):?(.*?)?\}/', $topic, $matches)) {
84
+        if (preg_match_all('/\{(\w+):?(.*?)?\}/', $topic, $matches))
85
+        {
82 86
             $variables = array_combine($matches[1], $matches[2]);
83
-            foreach ($variables as $key => $segment) {
87
+            foreach ($variables as $key => $segment)
88
+            {
84 89
                 $replaces['{' . $key . '}'] = '(?P<' . $key . '>[^\/\.]+)';
85 90
             }
86 91
         }
Please login to merge, or discard this patch.
tests/app/src/TestApp.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         // HTTP extensions
45 45
         Bootloader\Http\DiactorosBootloader::class,
46 46
         Bootloader\Http\RouterBootloader::class,
47
-       // Bootloader\Http\ErrorHandlerBootloader::class,
47
+        // Bootloader\Http\ErrorHandlerBootloader::class,
48 48
         Bootloader\Http\JsonPayloadsBootloader::class,
49 49
         Bootloader\Http\CookiesBootloader::class,
50 50
         Bootloader\Http\SessionBootloader::class,
Please login to merge, or discard this patch.
tests/app/src/Bootloader/AuthBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         EnvironmentInterface $env,
24 24
         BootloadManager $bootloadManager
25 25
     ): void {
26
-        if ($env->get('CYCLE_AUTH')) {
26
+        if ($env->get('CYCLE_AUTH')){
27 27
             $bootloadManager->bootload([CycleTokensBootloader::class]);
28 28
             return;
29 29
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@
 block discarded – undo
23 23
         EnvironmentInterface $env,
24 24
         BootloadManager $bootloadManager
25 25
     ): void {
26
-        if ($env->get('CYCLE_AUTH')) {
26
+        if ($env->get('CYCLE_AUTH'))
27
+        {
27 28
             $bootloadManager->bootload([CycleTokensBootloader::class]);
28 29
             return;
29 30
         }
Please login to merge, or discard this patch.