Passed
Pull Request — master (#592)
by Aleksei
06:09
created
src/Framework/Bootloader/Storage/StorageConfig.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
      */
104 104
     private function bootStorages(array $config): void
105 105
     {
106
-        foreach ($config['buckets'] as $name => $bucket) {
107
-            if (!\is_string($name)) {
106
+        foreach ($config['buckets'] as $name => $bucket){
107
+            if (!\is_string($name)){
108 108
                 throw new InvalidArgumentException(
109 109
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
110 110
                         \get_debug_type($name),
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             }
114 114
 
115 115
             $serverName = $bucket['server'] ?? null;
116
-            if (!\is_string($serverName)) {
116
+            if (!\is_string($serverName)){
117 117
                 throw new InvalidArgumentException(
118 118
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
119 119
                         $name,
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             }
124 124
 
125 125
             $server = $config['servers'][$serverName] ?? null;
126
-            if (!\is_array($server)) {
126
+            if (!\is_array($server)){
127 127
                 throw new InvalidArgumentException(
128 128
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
129 129
                         $name,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             }
134 134
 
135 135
             $adapter = $server['adapter'] ?? null;
136
-            if (!\is_string($adapter)) {
136
+            if (!\is_string($adapter)){
137 137
                 throw new InvalidArgumentException(
138 138
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
139 139
                         $serverName,
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
             $this->adapters[$name] = $adapter;
148 148
 
149
-            if (isset($bucket['distribution'])) {
149
+            if (isset($bucket['distribution'])){
150 150
                 $this->distributions[$name] = $bucket['distribution'];
151 151
             }
152 152
         }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
162 162
     {
163
-        switch ($server['adapter']) {
163
+        switch ($server['adapter']){
164 164
             case 'local':
165 165
                 return $this->createLocalAdapter($serverName, $bucket, $server);
166 166
 
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
      */
185 185
     private function createS3Adapter(string $serverName, array $bucket, array $server, bool $async): FilesystemAdapter
186 186
     {
187
-        if (!\class_exists(Credentials::class)) {
187
+        if (!\class_exists(Credentials::class)){
188 188
             throw new ConfigException(
189
-                'Can not create AWS credentials while creating "' . $serverName . '" server. '
189
+                'Can not create AWS credentials while creating "'.$serverName.'" server. '
190 190
                 . 'Perhaps you forgot to install the "league/flysystem-aws-s3-v3" package?'
191 191
             );
192 192
         }
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
         $name = $bucket['bucket'] ?? $server['bucket'];
207 207
         $visibility = $bucket['visibility'] ?? $server['bucket'] ?? Visibility::VISIBILITY_PUBLIC;
208 208
 
209
-        if ($async) {
210
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
209
+        if ($async){
210
+            if (!\class_exists(AsyncAwsS3Adapter::class)){
211 211
                 throw new InvalidArgumentException(
212 212
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
213 213
                 );
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             );
224 224
         }
225 225
 
226
-        if (!\class_exists(AwsS3V3Adapter::class)) {
226
+        if (!\class_exists(AwsS3V3Adapter::class)){
227 227
             throw new InvalidArgumentException(
228 228
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
229 229
             );
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
249 249
     {
250
-        if (!\is_string($server['directory'] ?? null)) {
250
+        if (!\is_string($server['directory'] ?? null)){
251 251
             throw new InvalidArgumentException(
252 252
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
253 253
                     $serverName,
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $adapter = $server['adapter'];
283 283
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
284 284
 
285
-        if (!$isFilesystemAdapter) {
285
+        if (!$isFilesystemAdapter){
286 286
             throw new InvalidArgumentException(
287 287
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
288 288
                     $serverName,
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
             );
293 293
         }
294 294
 
295
-        try {
295
+        try{
296 296
             return new $adapter(...\array_values($server['options'] ?? []));
297
-        } catch (\Throwable $e) {
297
+        }catch (\Throwable $e){
298 298
             $message = 'An error occurred while server `%s` initializing: %s';
299 299
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
300 300
         }
Please login to merge, or discard this patch.
Braces   +31 added lines, -15 removed lines patch added patch discarded remove patch
@@ -103,8 +103,10 @@  discard block
 block discarded – undo
103 103
      */
104 104
     private function bootStorages(array $config): void
105 105
     {
106
-        foreach ($config['buckets'] as $name => $bucket) {
107
-            if (!\is_string($name)) {
106
+        foreach ($config['buckets'] as $name => $bucket)
107
+        {
108
+            if (!\is_string($name))
109
+            {
108 110
                 throw new InvalidArgumentException(
109 111
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
110 112
                         \get_debug_type($name),
@@ -113,7 +115,8 @@  discard block
 block discarded – undo
113 115
             }
114 116
 
115 117
             $serverName = $bucket['server'] ?? null;
116
-            if (!\is_string($serverName)) {
118
+            if (!\is_string($serverName))
119
+            {
117 120
                 throw new InvalidArgumentException(
118 121
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
119 122
                         $name,
@@ -123,7 +126,8 @@  discard block
 block discarded – undo
123 126
             }
124 127
 
125 128
             $server = $config['servers'][$serverName] ?? null;
126
-            if (!\is_array($server)) {
129
+            if (!\is_array($server))
130
+            {
127 131
                 throw new InvalidArgumentException(
128 132
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
129 133
                         $name,
@@ -133,7 +137,8 @@  discard block
 block discarded – undo
133 137
             }
134 138
 
135 139
             $adapter = $server['adapter'] ?? null;
136
-            if (!\is_string($adapter)) {
140
+            if (!\is_string($adapter))
141
+            {
137 142
                 throw new InvalidArgumentException(
138 143
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
139 144
                         $serverName,
@@ -146,7 +151,8 @@  discard block
 block discarded – undo
146 151
 
147 152
             $this->adapters[$name] = $adapter;
148 153
 
149
-            if (isset($bucket['distribution'])) {
154
+            if (isset($bucket['distribution']))
155
+            {
150 156
                 $this->distributions[$name] = $bucket['distribution'];
151 157
             }
152 158
         }
@@ -160,7 +166,8 @@  discard block
 block discarded – undo
160 166
      */
161 167
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
162 168
     {
163
-        switch ($server['adapter']) {
169
+        switch ($server['adapter'])
170
+        {
164 171
             case 'local':
165 172
                 return $this->createLocalAdapter($serverName, $bucket, $server);
166 173
 
@@ -184,7 +191,8 @@  discard block
 block discarded – undo
184 191
      */
185 192
     private function createS3Adapter(string $serverName, array $bucket, array $server, bool $async): FilesystemAdapter
186 193
     {
187
-        if (!\class_exists(Credentials::class)) {
194
+        if (!\class_exists(Credentials::class))
195
+        {
188 196
             throw new ConfigException(
189 197
                 'Can not create AWS credentials while creating "' . $serverName . '" server. '
190 198
                 . 'Perhaps you forgot to install the "league/flysystem-aws-s3-v3" package?'
@@ -206,8 +214,10 @@  discard block
 block discarded – undo
206 214
         $name = $bucket['bucket'] ?? $server['bucket'];
207 215
         $visibility = $bucket['visibility'] ?? $server['bucket'] ?? Visibility::VISIBILITY_PUBLIC;
208 216
 
209
-        if ($async) {
210
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
217
+        if ($async)
218
+        {
219
+            if (!\class_exists(AsyncAwsS3Adapter::class))
220
+            {
211 221
                 throw new InvalidArgumentException(
212 222
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
213 223
                 );
@@ -223,7 +233,8 @@  discard block
 block discarded – undo
223 233
             );
224 234
         }
225 235
 
226
-        if (!\class_exists(AwsS3V3Adapter::class)) {
236
+        if (!\class_exists(AwsS3V3Adapter::class))
237
+        {
227 238
             throw new InvalidArgumentException(
228 239
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
229 240
             );
@@ -247,7 +258,8 @@  discard block
 block discarded – undo
247 258
      */
248 259
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
249 260
     {
250
-        if (!\is_string($server['directory'] ?? null)) {
261
+        if (!\is_string($server['directory'] ?? null))
262
+        {
251 263
             throw new InvalidArgumentException(
252 264
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
253 265
                     $serverName,
@@ -282,7 +294,8 @@  discard block
 block discarded – undo
282 294
         $adapter = $server['adapter'];
283 295
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
284 296
 
285
-        if (!$isFilesystemAdapter) {
297
+        if (!$isFilesystemAdapter)
298
+        {
286 299
             throw new InvalidArgumentException(
287 300
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
288 301
                     $serverName,
@@ -292,9 +305,12 @@  discard block
 block discarded – undo
292 305
             );
293 306
         }
294 307
 
295
-        try {
308
+        try
309
+        {
296 310
             return new $adapter(...\array_values($server['options'] ?? []));
297
-        } catch (\Throwable $e) {
311
+        }
312
+        catch (\Throwable $e)
313
+        {
298 314
             $message = 'An error occurred while server `%s` initializing: %s';
299 315
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
300 316
         }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Storage/StorageBootloader.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
 
40 40
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
41 41
 
42
-        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, Container $app) {
42
+        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, Container $app){
43 43
             $manager = new Storage($config->getDefaultBucket());
44 44
 
45 45
             $distributions = $config->getDistributions();
46 46
 
47
-            foreach ($config->getAdapters() as $name => $adapter) {
47
+            foreach ($config->getAdapters() as $name => $adapter){
48 48
                 $resolver = null;
49 49
 
50
-                if (isset($distributions[$name])) {
51
-                    try {
50
+                if (isset($distributions[$name])){
51
+                    try{
52 52
                         $cdn = $app->make(CdnInterface::class);
53
-                    } catch (NotFoundException $e) {
53
+                    }catch (NotFoundException $e){
54 54
                         $message = 'Unable to create distribution for bucket "%s". '
55 55
                             . 'Please make sure that bootloader %s is added in your application';
56 56
                         $message = \sprintf($message, $name, DistributionBootloader::class);
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
             return $manager;
68 68
         });
69 69
 
70
-        $app->bindSingleton(Storage::class, static function (StorageInterface $manager) {
70
+        $app->bindSingleton(Storage::class, static function (StorageInterface $manager){
71 71
             return $manager;
72 72
         });
73 73
 
74
-        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager) {
74
+        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager){
75 75
             return $manager->bucket();
76 76
         });
77 77
 
78
-        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage) {
78
+        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage){
79 79
             return $storage;
80 80
         });
81 81
     }
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,18 +39,24 @@  discard block
 block discarded – undo
39 39
 
40 40
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
41 41
 
42
-        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, Container $app) {
42
+        $app->bindSingleton(StorageInterface::class, static function (StorageConfig $config, Container $app)
43
+        {
43 44
             $manager = new Storage($config->getDefaultBucket());
44 45
 
45 46
             $distributions = $config->getDistributions();
46 47
 
47
-            foreach ($config->getAdapters() as $name => $adapter) {
48
+            foreach ($config->getAdapters() as $name => $adapter)
49
+            {
48 50
                 $resolver = null;
49 51
 
50
-                if (isset($distributions[$name])) {
51
-                    try {
52
+                if (isset($distributions[$name]))
53
+                {
54
+                    try
55
+                    {
52 56
                         $cdn = $app->make(CdnInterface::class);
53
-                    } catch (NotFoundException $e) {
57
+                    }
58
+                    catch (NotFoundException $e)
59
+                    {
54 60
                         $message = 'Unable to create distribution for bucket "%s". '
55 61
                             . 'Please make sure that bootloader %s is added in your application';
56 62
                         $message = \sprintf($message, $name, DistributionBootloader::class);
@@ -67,15 +73,18 @@  discard block
 block discarded – undo
67 73
             return $manager;
68 74
         });
69 75
 
70
-        $app->bindSingleton(Storage::class, static function (StorageInterface $manager) {
76
+        $app->bindSingleton(Storage::class, static function (StorageInterface $manager)
77
+        {
71 78
             return $manager;
72 79
         });
73 80
 
74
-        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager) {
81
+        $app->bindSingleton(BucketInterface::class, static function (StorageInterface $manager)
82
+        {
75 83
             return $manager->bucket();
76 84
         });
77 85
 
78
-        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage) {
86
+        $app->bindSingleton(Bucket::class, static function (BucketInterface $storage)
87
+        {
79 88
             return $storage;
80 89
         });
81 90
     }
Please login to merge, or discard this patch.
src/Distribution/src/Resolver/StaticResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,6 +75,6 @@
 block discarded – undo
75 75
         $prefix = \trim($this->host->getPath(), self::URI_PATH_DELIMITER);
76 76
         $file = \trim($file, self::URI_PATH_DELIMITER);
77 77
 
78
-        return self::URI_PATH_DELIMITER . ('' === $prefix ? '' : $prefix . self::URI_PATH_DELIMITER) . $file;
78
+        return self::URI_PATH_DELIMITER.('' === $prefix ? '' : $prefix.self::URI_PATH_DELIMITER).$file;
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
src/AuthHttp/tests/HeaderTransportTest.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 
44 44
         $http->setHandler(
45 45
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
46
-                if ($request->getAttribute('authContext')->getToken() === null) {
46
+                if ($request->getAttribute('authContext')->getToken() === null){
47 47
                     echo 'no token';
48
-                } else {
48
+                }else{
49 49
                     echo $request->getAttribute('authContext')->getToken()->getID();
50 50
                     echo ':';
51 51
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 
68 68
         $http->setHandler(
69 69
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
70
-                if ($request->getAttribute('authContext')->getToken() === null) {
70
+                if ($request->getAttribute('authContext')->getToken() === null){
71 71
                     echo 'no token';
72
-                } else {
72
+                }else{
73 73
                     echo $request->getAttribute('authContext')->getToken()->getID();
74 74
                     echo ':';
75 75
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 
91 91
         $http->setHandler(
92 92
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
93
-                if ($request->getAttribute('authContext')->getToken() === null) {
93
+                if ($request->getAttribute('authContext')->getToken() === null){
94 94
                     echo 'no token';
95
-                } else {
95
+                }else{
96 96
                     echo $request->getAttribute('authContext')->getToken()->getID();
97 97
                     echo ':';
98 98
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,9 +43,12 @@  discard block
 block discarded – undo
43 43
 
44 44
         $http->setHandler(
45 45
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
46
-                if ($request->getAttribute('authContext')->getToken() === null) {
46
+                if ($request->getAttribute('authContext')->getToken() === null)
47
+                {
47 48
                     echo 'no token';
48
-                } else {
49
+                }
50
+                else
51
+                {
49 52
                     echo $request->getAttribute('authContext')->getToken()->getID();
50 53
                     echo ':';
51 54
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -67,9 +70,12 @@  discard block
 block discarded – undo
67 70
 
68 71
         $http->setHandler(
69 72
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
70
-                if ($request->getAttribute('authContext')->getToken() === null) {
73
+                if ($request->getAttribute('authContext')->getToken() === null)
74
+                {
71 75
                     echo 'no token';
72
-                } else {
76
+                }
77
+                else
78
+                {
73 79
                     echo $request->getAttribute('authContext')->getToken()->getID();
74 80
                     echo ':';
75 81
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -90,9 +96,12 @@  discard block
 block discarded – undo
90 96
 
91 97
         $http->setHandler(
92 98
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
93
-                if ($request->getAttribute('authContext')->getToken() === null) {
99
+                if ($request->getAttribute('authContext')->getToken() === null)
100
+                {
94 101
                     echo 'no token';
95
-                } else {
102
+                }
103
+                else
104
+                {
96 105
                     echo $request->getAttribute('authContext')->getToken()->getID();
97 106
                     echo ':';
98 107
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
Please login to merge, or discard this patch.
src/AuthHttp/src/Transport/HeaderTransport.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function fetchToken(Request $request): ?string
43 43
     {
44
-        if ($request->hasHeader($this->header)) {
44
+        if ($request->hasHeader($this->header)){
45 45
             return $this->extractToken($request);
46 46
         }
47 47
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         string $tokenID,
58 58
         \DateTimeInterface $expiresAt = null
59 59
     ): Response {
60
-        if ($request->hasHeader($this->header) && $this->extractToken($request) === $tokenID) {
60
+        if ($request->hasHeader($this->header) && $this->extractToken($request) === $tokenID){
61 61
             return $response;
62 62
         }
63 63
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $headerLine = $request->getHeaderLine($this->header);
82 82
 
83
-        if ($this->valueFormat !== '%s') {
83
+        if ($this->valueFormat !== '%s'){
84 84
             [$token] = sscanf($headerLine, $this->valueFormat);
85 85
 
86
-            return $token !== null ? (string) $token : null;
86
+            return $token !== null ? (string)$token : null;
87 87
         }
88 88
 
89 89
         return $headerLine;
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function fetchToken(Request $request): ?string
43 43
     {
44
-        if ($request->hasHeader($this->header)) {
44
+        if ($request->hasHeader($this->header))
45
+        {
45 46
             return $this->extractToken($request);
46 47
         }
47 48
 
@@ -57,7 +58,8 @@  discard block
 block discarded – undo
57 58
         string $tokenID,
58 59
         \DateTimeInterface $expiresAt = null
59 60
     ): Response {
60
-        if ($request->hasHeader($this->header) && $this->extractToken($request) === $tokenID) {
61
+        if ($request->hasHeader($this->header) && $this->extractToken($request) === $tokenID)
62
+        {
61 63
             return $response;
62 64
         }
63 65
 
@@ -80,7 +82,8 @@  discard block
 block discarded – undo
80 82
     {
81 83
         $headerLine = $request->getHeaderLine($this->header);
82 84
 
83
-        if ($this->valueFormat !== '%s') {
85
+        if ($this->valueFormat !== '%s')
86
+        {
84 87
             [$token] = sscanf($headerLine, $this->valueFormat);
85 88
 
86 89
             return $token !== null ? (string) $token : null;
Please login to merge, or discard this patch.
src/Framework/Broadcast/Middleware/WebsocketsMiddleware.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         ScopeInterface $scope,
59 59
         ResolverInterface $resolver,
60 60
         ResponseFactoryInterface $responseFactory
61
-    ) {
61
+    ){
62 62
         $this->config = $config;
63 63
         $this->scope = $scope;
64 64
         $this->resolver = $resolver;
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
77 77
     {
78
-        if ($request->getUri()->getPath() !== $this->config->getPath()) {
78
+        if ($request->getUri()->getPath() !== $this->config->getPath()){
79 79
             return $handler->handle($request);
80 80
         }
81 81
 
82 82
         // server authorization
83
-        if ($request->getAttribute('ws:joinServer', null) !== null) {
84
-            if (!$this->authorizeServer($request)) {
83
+        if ($request->getAttribute('ws:joinServer', null) !== null){
84
+            if (!$this->authorizeServer($request)){
85 85
                 return $this->responseFactory->createResponse(403);
86 86
             }
87 87
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 
91 91
         // topic authorization
92 92
         $topics = $request->getAttribute('ws:joinTopics');
93
-        if (\is_string($topics)) {
94
-            foreach (\explode(',', $topics) as $topic) {
95
-                if (!$this->authorizeTopic($request, $topic)) {
93
+        if (\is_string($topics)){
94
+            foreach (\explode(',', $topics) as $topic){
95
+                if (!$this->authorizeTopic($request, $topic)){
96 96
                     return $this->responseFactory->createResponse(403);
97 97
                 }
98 98
             }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $callback = $this->config->getServerCallback();
115 115
 
116
-        if ($callback === null) {
116
+        if ($callback === null){
117 117
             return true;
118 118
         }
119 119
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $parameters = [];
133 133
         $callback = $this->config->findTopicCallback($topic, $parameters);
134
-        if ($callback === null) {
134
+        if ($callback === null){
135 135
             return false;
136 136
         }
137 137
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function invoke(ServerRequestInterface $request, callable $callback, array $parameters = []): bool
150 150
     {
151
-        switch (true) {
151
+        switch (true){
152 152
             case $callback instanceof \Closure:
153 153
             case \is_string($callback):
154 154
                 $reflection = new \ReflectionFunction($callback);
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,13 +75,16 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
77 77
     {
78
-        if ($request->getUri()->getPath() !== $this->config->getPath()) {
78
+        if ($request->getUri()->getPath() !== $this->config->getPath())
79
+        {
79 80
             return $handler->handle($request);
80 81
         }
81 82
 
82 83
         // server authorization
83
-        if ($request->getAttribute('ws:joinServer', null) !== null) {
84
-            if (!$this->authorizeServer($request)) {
84
+        if ($request->getAttribute('ws:joinServer', null) !== null)
85
+        {
86
+            if (!$this->authorizeServer($request))
87
+            {
85 88
                 return $this->responseFactory->createResponse(403);
86 89
             }
87 90
 
@@ -90,9 +93,12 @@  discard block
 block discarded – undo
90 93
 
91 94
         // topic authorization
92 95
         $topics = $request->getAttribute('ws:joinTopics');
93
-        if (\is_string($topics)) {
94
-            foreach (\explode(',', $topics) as $topic) {
95
-                if (!$this->authorizeTopic($request, $topic)) {
96
+        if (\is_string($topics))
97
+        {
98
+            foreach (\explode(',', $topics) as $topic)
99
+            {
100
+                if (!$this->authorizeTopic($request, $topic))
101
+                {
96 102
                     return $this->responseFactory->createResponse(403);
97 103
                 }
98 104
             }
@@ -113,7 +119,8 @@  discard block
 block discarded – undo
113 119
     {
114 120
         $callback = $this->config->getServerCallback();
115 121
 
116
-        if ($callback === null) {
122
+        if ($callback === null)
123
+        {
117 124
             return true;
118 125
         }
119 126
 
@@ -131,7 +138,8 @@  discard block
 block discarded – undo
131 138
     {
132 139
         $parameters = [];
133 140
         $callback = $this->config->findTopicCallback($topic, $parameters);
134
-        if ($callback === null) {
141
+        if ($callback === null)
142
+        {
135 143
             return false;
136 144
         }
137 145
 
@@ -148,7 +156,8 @@  discard block
 block discarded – undo
148 156
      */
149 157
     private function invoke(ServerRequestInterface $request, callable $callback, array $parameters = []): bool
150 158
     {
151
-        switch (true) {
159
+        switch (true)
160
+        {
152 161
             case $callback instanceof \Closure:
153 162
             case \is_string($callback):
154 163
                 $reflection = new \ReflectionFunction($callback);
@@ -166,7 +175,8 @@  discard block
 block discarded – undo
166 175
                 throw new LogicException('Unable to invoke callable function');
167 176
         }
168 177
 
169
-        $scoped = function () use ($reflection, $parameters, $callback) {
178
+        $scoped = function () use ($reflection, $parameters, $callback)
179
+        {
170 180
             return \call_user_func_array($callback, $this->resolver->resolveArguments($reflection, $parameters));
171 181
         };
172 182
 
Please login to merge, or discard this patch.
src/Framework/Command/Cycle/Generator/ShowChanges.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
         $this->output->writeln('<info>Detecting schema changes:</info>');
43 43
 
44 44
         $this->changes = [];
45
-        foreach ($registry->getIterator() as $e) {
46
-            if ($registry->hasTable($e)) {
45
+        foreach ($registry->getIterator() as $e){
46
+            if ($registry->hasTable($e)){
47 47
                 $table = $registry->getTableSchema($e);
48 48
 
49
-                if ($table->getComparator()->hasChanges()) {
50
-                    $key = $registry->getDatabase($e) . ':' . $registry->getTable($e);
49
+                if ($table->getComparator()->hasChanges()){
50
+                    $key = $registry->getDatabase($e).':'.$registry->getTable($e);
51 51
                     $this->changes[$key] = [
52 52
                         'database' => $registry->getDatabase($e),
53 53
                         'table'    => $registry->getTable($e),
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
             }
58 58
         }
59 59
 
60
-        if ($this->changes === []) {
60
+        if ($this->changes === []){
61 61
             $this->output->writeln('<fg=yellow>no database changes has been detected</fg=yellow>');
62 62
 
63 63
             return $registry;
64 64
         }
65 65
 
66
-        foreach ($this->changes as $change) {
66
+        foreach ($this->changes as $change){
67 67
             $this->output->write(sprintf('• <fg=cyan>%s.%s</fg=cyan>', $change['database'], $change['table']));
68 68
             $this->describeChanges($change['schema']);
69 69
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function describeChanges(AbstractTable $table): void
86 86
     {
87
-        if (!$this->output->isVerbose()) {
87
+        if (!$this->output->isVerbose()){
88 88
             $this->output->writeln(
89 89
                 sprintf(
90 90
                     ': <fg=green>%s</fg=green> change(s) detected',
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
         $this->output->write("\n");
98 98
 
99 99
 
100
-        if (!$table->exists()) {
100
+        if (!$table->exists()){
101 101
             $this->output->writeln('    - create table');
102 102
         }
103 103
 
104
-        if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED) {
104
+        if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED){
105 105
             $this->output->writeln('    - drop table');
106 106
             return;
107 107
         }
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
      */
119 119
     protected function describeColumns(Comparator $cmp): void
120 120
     {
121
-        foreach ($cmp->addedColumns() as $column) {
121
+        foreach ($cmp->addedColumns() as $column){
122 122
             $this->output->writeln("    - add column <fg=yellow>{$column->getName()}</fg=yellow>");
123 123
         }
124 124
 
125
-        foreach ($cmp->droppedColumns() as $column) {
125
+        foreach ($cmp->droppedColumns() as $column){
126 126
             $this->output->writeln("    - drop column <fg=yellow>{$column->getName()}</fg=yellow>");
127 127
         }
128 128
 
129
-        foreach ($cmp->alteredColumns() as $column) {
129
+        foreach ($cmp->alteredColumns() as $column){
130 130
             $column = $column[0];
131 131
             $this->output->writeln("    - alter column <fg=yellow>{$column->getName()}</fg=yellow>");
132 132
         }
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
      */
138 138
     protected function describeIndexes(Comparator $cmp): void
139 139
     {
140
-        foreach ($cmp->addedIndexes() as $index) {
140
+        foreach ($cmp->addedIndexes() as $index){
141 141
             $index = implode(', ', $index->getColumns());
142 142
             $this->output->writeln("    - add index on <fg=yellow>[{$index}]</fg=yellow>");
143 143
         }
144 144
 
145
-        foreach ($cmp->droppedIndexes() as $index) {
145
+        foreach ($cmp->droppedIndexes() as $index){
146 146
             $index = implode(', ', $index->getColumns());
147 147
             $this->output->writeln("    - drop index on <fg=yellow>[{$index}]</fg=yellow>");
148 148
         }
149 149
 
150
-        foreach ($cmp->alteredIndexes() as $index) {
150
+        foreach ($cmp->alteredIndexes() as $index){
151 151
             $index = $index[0];
152 152
             $index = implode(', ', $index->getColumns());
153 153
             $this->output->writeln("    - alter index on <fg=yellow>[{$index}]</fg=yellow>");
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
      */
160 160
     protected function describeFKs(Comparator $cmp): void
161 161
     {
162
-        foreach ($cmp->addedForeignKeys() as $fk) {
162
+        foreach ($cmp->addedForeignKeys() as $fk){
163 163
             $fkColumns = implode(', ', $fk->getColumns());
164 164
             $this->output->writeln("    - add foreign key on <fg=yellow>{$fkColumns}</fg=yellow>");
165 165
         }
166 166
 
167
-        foreach ($cmp->droppedForeignKeys() as $fk) {
167
+        foreach ($cmp->droppedForeignKeys() as $fk){
168 168
             $fkColumns = implode(', ', $fk->getColumns());
169 169
             $this->output->writeln("    - drop foreign key <fg=yellow>{$fkColumns}</fg=yellow>");
170 170
         }
171 171
 
172
-        foreach ($cmp->alteredForeignKeys() as $fk) {
172
+        foreach ($cmp->alteredForeignKeys() as $fk){
173 173
             $fk = $fk[0];
174 174
             $fkColumns = implode(', ', $fk->getColumns());
175 175
             $this->output->writeln("    - alter foreign key <fg=yellow>{$fkColumns}</fg=yellow>");
Please login to merge, or discard this patch.
Braces   +34 added lines, -17 removed lines patch added patch discarded remove patch
@@ -42,11 +42,14 @@  discard block
 block discarded – undo
42 42
         $this->output->writeln('<info>Detecting schema changes:</info>');
43 43
 
44 44
         $this->changes = [];
45
-        foreach ($registry->getIterator() as $e) {
46
-            if ($registry->hasTable($e)) {
45
+        foreach ($registry->getIterator() as $e)
46
+        {
47
+            if ($registry->hasTable($e))
48
+            {
47 49
                 $table = $registry->getTableSchema($e);
48 50
 
49
-                if ($table->getComparator()->hasChanges()) {
51
+                if ($table->getComparator()->hasChanges())
52
+                {
50 53
                     $key = $registry->getDatabase($e) . ':' . $registry->getTable($e);
51 54
                     $this->changes[$key] = [
52 55
                         'database' => $registry->getDatabase($e),
@@ -57,13 +60,15 @@  discard block
 block discarded – undo
57 60
             }
58 61
         }
59 62
 
60
-        if ($this->changes === []) {
63
+        if ($this->changes === [])
64
+        {
61 65
             $this->output->writeln('<fg=yellow>no database changes has been detected</fg=yellow>');
62 66
 
63 67
             return $registry;
64 68
         }
65 69
 
66
-        foreach ($this->changes as $change) {
70
+        foreach ($this->changes as $change)
71
+        {
67 72
             $this->output->write(sprintf('• <fg=cyan>%s.%s</fg=cyan>', $change['database'], $change['table']));
68 73
             $this->describeChanges($change['schema']);
69 74
         }
@@ -84,7 +89,8 @@  discard block
 block discarded – undo
84 89
      */
85 90
     protected function describeChanges(AbstractTable $table): void
86 91
     {
87
-        if (!$this->output->isVerbose()) {
92
+        if (!$this->output->isVerbose())
93
+        {
88 94
             $this->output->writeln(
89 95
                 sprintf(
90 96
                     ': <fg=green>%s</fg=green> change(s) detected',
@@ -97,11 +103,13 @@  discard block
 block discarded – undo
97 103
         $this->output->write("\n");
98 104
 
99 105
 
100
-        if (!$table->exists()) {
106
+        if (!$table->exists())
107
+        {
101 108
             $this->output->writeln('    - create table');
102 109
         }
103 110
 
104
-        if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED) {
111
+        if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED)
112
+        {
105 113
             $this->output->writeln('    - drop table');
106 114
             return;
107 115
         }
@@ -118,15 +126,18 @@  discard block
 block discarded – undo
118 126
      */
119 127
     protected function describeColumns(Comparator $cmp): void
120 128
     {
121
-        foreach ($cmp->addedColumns() as $column) {
129
+        foreach ($cmp->addedColumns() as $column)
130
+        {
122 131
             $this->output->writeln("    - add column <fg=yellow>{$column->getName()}</fg=yellow>");
123 132
         }
124 133
 
125
-        foreach ($cmp->droppedColumns() as $column) {
134
+        foreach ($cmp->droppedColumns() as $column)
135
+        {
126 136
             $this->output->writeln("    - drop column <fg=yellow>{$column->getName()}</fg=yellow>");
127 137
         }
128 138
 
129
-        foreach ($cmp->alteredColumns() as $column) {
139
+        foreach ($cmp->alteredColumns() as $column)
140
+        {
130 141
             $column = $column[0];
131 142
             $this->output->writeln("    - alter column <fg=yellow>{$column->getName()}</fg=yellow>");
132 143
         }
@@ -137,17 +148,20 @@  discard block
 block discarded – undo
137 148
      */
138 149
     protected function describeIndexes(Comparator $cmp): void
139 150
     {
140
-        foreach ($cmp->addedIndexes() as $index) {
151
+        foreach ($cmp->addedIndexes() as $index)
152
+        {
141 153
             $index = implode(', ', $index->getColumns());
142 154
             $this->output->writeln("    - add index on <fg=yellow>[{$index}]</fg=yellow>");
143 155
         }
144 156
 
145
-        foreach ($cmp->droppedIndexes() as $index) {
157
+        foreach ($cmp->droppedIndexes() as $index)
158
+        {
146 159
             $index = implode(', ', $index->getColumns());
147 160
             $this->output->writeln("    - drop index on <fg=yellow>[{$index}]</fg=yellow>");
148 161
         }
149 162
 
150
-        foreach ($cmp->alteredIndexes() as $index) {
163
+        foreach ($cmp->alteredIndexes() as $index)
164
+        {
151 165
             $index = $index[0];
152 166
             $index = implode(', ', $index->getColumns());
153 167
             $this->output->writeln("    - alter index on <fg=yellow>[{$index}]</fg=yellow>");
@@ -159,17 +173,20 @@  discard block
 block discarded – undo
159 173
      */
160 174
     protected function describeFKs(Comparator $cmp): void
161 175
     {
162
-        foreach ($cmp->addedForeignKeys() as $fk) {
176
+        foreach ($cmp->addedForeignKeys() as $fk)
177
+        {
163 178
             $fkColumns = implode(', ', $fk->getColumns());
164 179
             $this->output->writeln("    - add foreign key on <fg=yellow>{$fkColumns}</fg=yellow>");
165 180
         }
166 181
 
167
-        foreach ($cmp->droppedForeignKeys() as $fk) {
182
+        foreach ($cmp->droppedForeignKeys() as $fk)
183
+        {
168 184
             $fkColumns = implode(', ', $fk->getColumns());
169 185
             $this->output->writeln("    - drop foreign key <fg=yellow>{$fkColumns}</fg=yellow>");
170 186
         }
171 187
 
172
-        foreach ($cmp->alteredForeignKeys() as $fk) {
188
+        foreach ($cmp->alteredForeignKeys() as $fk)
189
+        {
173 190
             $fk = $fk[0];
174 191
             $fkColumns = implode(', ', $fk->getColumns());
175 192
             $this->output->writeln("    - alter foreign key <fg=yellow>{$fkColumns}</fg=yellow>");
Please login to merge, or discard this patch.
src/Framework/Bootloader/Http/WebsocketsBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
             'authorizeTopics' => [],
59 59
         ]);
60 60
 
61
-        if ($env->get('RR_BROADCAST_PATH', null) !== null) {
61
+        if ($env->get('RR_BROADCAST_PATH', null) !== null){
62 62
             $http->addMiddleware(WebsocketsMiddleware::class);
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@
 block discarded – undo
58 58
             'authorizeTopics' => [],
59 59
         ]);
60 60
 
61
-        if ($env->get('RR_BROADCAST_PATH', null) !== null) {
61
+        if ($env->get('RR_BROADCAST_PATH', null) !== null)
62
+        {
62 63
             $http->addMiddleware(WebsocketsMiddleware::class);
63 64
         }
64 65
     }
Please login to merge, or discard this patch.
src/Framework/Domain/GuardPermissionsProvider.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function getPermission(string $controller, string $action): Permission
48 48
     {
49 49
         $key = sprintf('%s:%s', $controller, $action);
50
-        if (!array_key_exists($key, $this->cache)) {
50
+        if (!array_key_exists($key, $this->cache)){
51 51
             $this->cache[$key] = $this->generatePermission($controller, $action);
52 52
         }
53 53
 
@@ -56,20 +56,20 @@  discard block
 block discarded – undo
56 56
 
57 57
     private function generatePermission(string $controller, string $action): Permission
58 58
     {
59
-        try {
59
+        try{
60 60
             $method = new \ReflectionMethod($controller, $action);
61
-        } catch (\ReflectionException $e) {
61
+        }catch (\ReflectionException $e){
62 62
             return Permission::failed();
63 63
         }
64 64
 
65 65
         $guarded = $this->reader->firstFunctionMetadata($method, Guarded::class);
66
-        if (!$guarded instanceof Guarded) {
66
+        if (!$guarded instanceof Guarded){
67 67
             return Permission::failed();
68 68
         }
69 69
 
70 70
         $namespace = $this->reader->firstClassMetadata($method->getDeclaringClass(), GuardNamespace::class);
71 71
 
72
-        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)) {
72
+        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)){
73 73
             return Permission::ok(
74 74
                 $this->makePermission($guarded, $method, $namespace),
75 75
                 $this->mapFailureException($guarded),
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
     private function makePermission(Guarded $guarded, \ReflectionMethod $method, ?GuardNamespace $ns): string
93 93
     {
94 94
         $permission = [];
95
-        if ($this->namespace) {
95
+        if ($this->namespace){
96 96
             $permission[] = $this->namespace;
97 97
         }
98 98
 
99
-        if ($ns !== null && $ns->namespace) {
99
+        if ($ns !== null && $ns->namespace){
100 100
             $permission[] = $ns->namespace;
101 101
         }
102 102
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@  discard block
 block discarded – undo
47 47
     public function getPermission(string $controller, string $action): Permission
48 48
     {
49 49
         $key = sprintf('%s:%s', $controller, $action);
50
-        if (!array_key_exists($key, $this->cache)) {
50
+        if (!array_key_exists($key, $this->cache))
51
+        {
51 52
             $this->cache[$key] = $this->generatePermission($controller, $action);
52 53
         }
53 54
 
@@ -56,20 +57,25 @@  discard block
 block discarded – undo
56 57
 
57 58
     private function generatePermission(string $controller, string $action): Permission
58 59
     {
59
-        try {
60
+        try
61
+        {
60 62
             $method = new \ReflectionMethod($controller, $action);
61
-        } catch (\ReflectionException $e) {
63
+        }
64
+        catch (\ReflectionException $e)
65
+        {
62 66
             return Permission::failed();
63 67
         }
64 68
 
65 69
         $guarded = $this->reader->firstFunctionMetadata($method, Guarded::class);
66
-        if (!$guarded instanceof Guarded) {
70
+        if (!$guarded instanceof Guarded)
71
+        {
67 72
             return Permission::failed();
68 73
         }
69 74
 
70 75
         $namespace = $this->reader->firstClassMetadata($method->getDeclaringClass(), GuardNamespace::class);
71 76
 
72
-        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)) {
77
+        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace))
78
+        {
73 79
             return Permission::ok(
74 80
                 $this->makePermission($guarded, $method, $namespace),
75 81
                 $this->mapFailureException($guarded),
@@ -92,11 +98,13 @@  discard block
 block discarded – undo
92 98
     private function makePermission(Guarded $guarded, \ReflectionMethod $method, ?GuardNamespace $ns): string
93 99
     {
94 100
         $permission = [];
95
-        if ($this->namespace) {
101
+        if ($this->namespace)
102
+        {
96 103
             $permission[] = $this->namespace;
97 104
         }
98 105
 
99
-        if ($ns !== null && $ns->namespace) {
106
+        if ($ns !== null && $ns->namespace)
107
+        {
100 108
             $permission[] = $ns->namespace;
101 109
         }
102 110
 
Please login to merge, or discard this patch.