Passed
Pull Request — master (#656)
by Abdul Malik
14:10 queued 04:21
created
src/Http/src/Traits/JsonTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
      */
30 30
     private function writeJson(ResponseInterface $response, $payload, int $code = 200): ResponseInterface
31 31
     {
32
-        if ($payload instanceof JsonSerializable) {
32
+        if ($payload instanceof JsonSerializable){
33 33
             $payload = $payload->jsonSerialize();
34 34
         }
35 35
 
36
-        if (is_array($payload) && isset($payload['status']) && is_int($payload['status'])) {
36
+        if (is_array($payload) && isset($payload['status']) && is_int($payload['status'])){
37 37
             $code = $payload['status'];
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,13 @@
 block discarded – undo
29 29
      */
30 30
     private function writeJson(ResponseInterface $response, $payload, int $code = 200): ResponseInterface
31 31
     {
32
-        if ($payload instanceof JsonSerializable) {
32
+        if ($payload instanceof JsonSerializable)
33
+        {
33 34
             $payload = $payload->jsonSerialize();
34 35
         }
35 36
 
36
-        if (is_array($payload) && isset($payload['status']) && is_int($payload['status'])) {
37
+        if (is_array($payload) && isset($payload['status']) && is_int($payload['status']))
38
+        {
37 39
             $code = $payload['status'];
38 40
         }
39 41
 
Please login to merge, or discard this patch.
src/Console/src/Traits/LazyTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
                 ? $class::DESCRIPTION
43 43
                 : '',
44 44
             false,
45
-            function () use ($class): SymfonyCommand {
45
+            function () use ($class) : SymfonyCommand {
46 46
                 $command = $this->container->get($class);
47 47
                 $command->setContainer($this->container);
48 48
 
Please login to merge, or discard this patch.
src/Console/src/StaticLocator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     public function locateCommands(): array
42 42
     {
43 43
         $commands = [];
44
-        foreach ($this->commands as $command) {
44
+        foreach ($this->commands as $command){
45 45
             $commands[] = $this->supportsLazyLoading($command)
46 46
                 ? $this->createLazyCommand($command)
47 47
                 : $this->container->get($command);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@
 block discarded – undo
41 41
     public function locateCommands(): array
42 42
     {
43 43
         $commands = [];
44
-        foreach ($this->commands as $command) {
44
+        foreach ($this->commands as $command)
45
+        {
45 46
             $commands[] = $this->supportsLazyLoading($command)
46 47
                 ? $this->createLazyCommand($command)
47 48
                 : $this->container->get($command);
Please login to merge, or discard this patch.
src/Framework/Validation/Checker/EntityChecker.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
     public function exists($value, string $role, ?string $field = null, bool $ignoreCase = false): bool
43 43
     {
44 44
         $repository = $this->orm->getRepository($role);
45
-        if ($field === null) {
45
+        if ($field === null){
46 46
             return $repository->findByPK($value) !== null;
47 47
         }
48 48
 
49
-        if ($ignoreCase && $repository instanceof Repository) {
49
+        if ($ignoreCase && $repository instanceof Repository){
50 50
             return $this
51 51
                 ->addCaseInsensitiveWhere($repository->select(), $field, $value)
52 52
                 ->fetchOne() !== null;
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
         $values = $this->withValues($withFields);
69 69
         $values[$field] = $value;
70 70
 
71
-        if ($this->isProvidedByContext($role, $values)) {
71
+        if ($this->isProvidedByContext($role, $values)){
72 72
             return true;
73 73
         }
74 74
 
75 75
         $repository = $this->orm->getRepository($role);
76 76
 
77
-        if ($ignoreCase && $repository instanceof Repository) {
77
+        if ($ignoreCase && $repository instanceof Repository){
78 78
             $select = $repository->select();
79 79
 
80
-            foreach ($values as $field => $fieldValue) {
80
+            foreach ($values as $field => $fieldValue){
81 81
                 $this->addCaseInsensitiveWhere($select, $field, $fieldValue);
82 82
             }
83 83
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
     private function withValues(array $fields): array
95 95
     {
96 96
         $values = [];
97
-        foreach ($fields as $field) {
98
-            if ($this->getValidator()->hasValue($field)) {
97
+        foreach ($fields as $field){
98
+            if ($this->getValidator()->hasValue($field)){
99 99
                 $values[$field] = $this->getValidator()->getValue($field);
100 100
             }
101 101
         }
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
     private function isProvidedByContext(string $role, array $values): bool
112 112
     {
113 113
         $entity = $this->getValidator()->getContext();
114
-        if (!is_object($entity) || !$this->orm->getHeap()->has($entity)) {
114
+        if (!is_object($entity) || !$this->orm->getHeap()->has($entity)){
115 115
             return false;
116 116
         }
117 117
 
118 118
         $extract = $this->orm->getMapper($role)->extract($entity);
119
-        foreach ($values as $field => $value) {
120
-            if (!isset($extract[$field]) || $extract[$field] !== $value) {
119
+        foreach ($values as $field => $value){
120
+            if (!isset($extract[$field]) || $extract[$field] !== $value){
121 121
                 return false;
122 122
             }
123 123
         }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     private function addCaseInsensitiveWhere(Select $select, string $field, $value): Select
135 135
     {
136
-        if (!is_string($value)) {
136
+        if (!is_string($value)){
137 137
             return $select->where($field, $value);
138 138
         }
139 139
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,11 +42,13 @@  discard block
 block discarded – undo
42 42
     public function exists($value, string $role, ?string $field = null, bool $ignoreCase = false): bool
43 43
     {
44 44
         $repository = $this->orm->getRepository($role);
45
-        if ($field === null) {
45
+        if ($field === null)
46
+        {
46 47
             return $repository->findByPK($value) !== null;
47 48
         }
48 49
 
49
-        if ($ignoreCase && $repository instanceof Repository) {
50
+        if ($ignoreCase && $repository instanceof Repository)
51
+        {
50 52
             return $this
51 53
                 ->addCaseInsensitiveWhere($repository->select(), $field, $value)
52 54
                 ->fetchOne() !== null;
@@ -68,16 +70,19 @@  discard block
 block discarded – undo
68 70
         $values = $this->withValues($withFields);
69 71
         $values[$field] = $value;
70 72
 
71
-        if ($this->isProvidedByContext($role, $values)) {
73
+        if ($this->isProvidedByContext($role, $values))
74
+        {
72 75
             return true;
73 76
         }
74 77
 
75 78
         $repository = $this->orm->getRepository($role);
76 79
 
77
-        if ($ignoreCase && $repository instanceof Repository) {
80
+        if ($ignoreCase && $repository instanceof Repository)
81
+        {
78 82
             $select = $repository->select();
79 83
 
80
-            foreach ($values as $field => $fieldValue) {
84
+            foreach ($values as $field => $fieldValue)
85
+            {
81 86
                 $this->addCaseInsensitiveWhere($select, $field, $fieldValue);
82 87
             }
83 88
 
@@ -94,8 +99,10 @@  discard block
 block discarded – undo
94 99
     private function withValues(array $fields): array
95 100
     {
96 101
         $values = [];
97
-        foreach ($fields as $field) {
98
-            if ($this->getValidator()->hasValue($field)) {
102
+        foreach ($fields as $field)
103
+        {
104
+            if ($this->getValidator()->hasValue($field))
105
+            {
99 106
                 $values[$field] = $this->getValidator()->getValue($field);
100 107
             }
101 108
         }
@@ -111,13 +118,16 @@  discard block
 block discarded – undo
111 118
     private function isProvidedByContext(string $role, array $values): bool
112 119
     {
113 120
         $entity = $this->getValidator()->getContext();
114
-        if (!is_object($entity) || !$this->orm->getHeap()->has($entity)) {
121
+        if (!is_object($entity) || !$this->orm->getHeap()->has($entity))
122
+        {
115 123
             return false;
116 124
         }
117 125
 
118 126
         $extract = $this->orm->getMapper($role)->extract($entity);
119
-        foreach ($values as $field => $value) {
120
-            if (!isset($extract[$field]) || $extract[$field] !== $value) {
127
+        foreach ($values as $field => $value)
128
+        {
129
+            if (!isset($extract[$field]) || $extract[$field] !== $value)
130
+            {
121 131
                 return false;
122 132
             }
123 133
         }
@@ -133,7 +143,8 @@  discard block
 block discarded – undo
133 143
      */
134 144
     private function addCaseInsensitiveWhere(Select $select, string $field, $value): Select
135 145
     {
136
-        if (!is_string($value)) {
146
+        if (!is_string($value))
147
+        {
137 148
             return $select->where($field, $value);
138 149
         }
139 150
 
Please login to merge, or discard this patch.
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/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/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.