Passed
Pull Request — master (#413)
by Kirill
07:07
created
src/Distribution/src/Manager.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $name = $name ?? $this->default;
67 67
 
68
-        if (!isset($this->resolvers[$name])) {
68
+        if (!isset($this->resolvers[$name])){
69 69
             throw new \InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
70 70
         }
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function add(string $name, UriResolverInterface $resolver, bool $overwrite = false): void
79 79
     {
80
-        if ($overwrite === false && isset($this->resolvers[$name])) {
80
+        if ($overwrite === false && isset($this->resolvers[$name])){
81 81
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
82 82
         }
83 83
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,8 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $name = $name ?? $this->default;
67 67
 
68
-        if (!isset($this->resolvers[$name])) {
68
+        if (!isset($this->resolvers[$name]))
69
+        {
69 70
             throw new \InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
70 71
         }
71 72
 
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
      */
78 79
     public function add(string $name, UriResolverInterface $resolver, bool $overwrite = false): void
79 80
     {
80
-        if ($overwrite === false && isset($this->resolvers[$name])) {
81
+        if ($overwrite === false && isset($this->resolvers[$name]))
82
+        {
81 83
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
82 84
         }
83 85
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Storage/StorageConfig.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function bootStorages(array $config): void
104 104
     {
105
-        foreach ($config['buckets'] as $name => $bucket) {
106
-            if (!\is_string($name)) {
105
+        foreach ($config['buckets'] as $name => $bucket){
106
+            if (!\is_string($name)){
107 107
                 throw new InvalidArgumentException(
108 108
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
109 109
                         \get_debug_type($name),
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             }
113 113
 
114 114
             $serverName = $bucket['server'] ?? null;
115
-            if (!\is_string($serverName)) {
115
+            if (!\is_string($serverName)){
116 116
                 throw new InvalidArgumentException(
117 117
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
118 118
                         $name,
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             }
123 123
 
124 124
             $server = $config['servers'][$serverName] ?? null;
125
-            if (!\is_array($server)) {
125
+            if (!\is_array($server)){
126 126
                 throw new InvalidArgumentException(
127 127
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
128 128
                         $name,
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             }
133 133
 
134 134
             $adapter = $server['adapter'] ?? null;
135
-            if (!\is_string($adapter)) {
135
+            if (!\is_string($adapter)){
136 136
                 throw new InvalidArgumentException(
137 137
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
138 138
                         $serverName,
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
             $this->adapters[$name] = $adapter;
147 147
 
148
-            if (isset($bucket['distribution'])) {
148
+            if (isset($bucket['distribution'])){
149 149
                 $this->distributions[$name] = $bucket['distribution'];
150 150
             }
151 151
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
161 161
     {
162
-        switch ($server['adapter']) {
162
+        switch ($server['adapter']){
163 163
             case 'local':
164 164
                 return $this->createLocalAdapter($serverName, $bucket, $server);
165 165
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
         $name = $bucket['bucket'] ?? $server['bucket'];
198 198
         $visibility = $bucket['visibility'] ?? $server['bucket'] ?? Visibility::VISIBILITY_PUBLIC;
199 199
 
200
-        if ($async) {
201
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
200
+        if ($async){
201
+            if (!\class_exists(AsyncAwsS3Adapter::class)){
202 202
                 throw new InvalidArgumentException(
203 203
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
204 204
                 );
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             );
215 215
         }
216 216
 
217
-        if (!\class_exists(AwsS3V3Adapter::class)) {
217
+        if (!\class_exists(AwsS3V3Adapter::class)){
218 218
             throw new InvalidArgumentException(
219 219
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
220 220
             );
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
240 240
     {
241
-        if (!\is_string($server['directory'] ?? null)) {
241
+        if (!\is_string($server['directory'] ?? null)){
242 242
             throw new InvalidArgumentException(
243 243
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
244 244
                     $serverName,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         $adapter = $server['adapter'];
274 274
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
275 275
 
276
-        if (!$isFilesystemAdapter) {
276
+        if (!$isFilesystemAdapter){
277 277
             throw new InvalidArgumentException(
278 278
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
279 279
                     $serverName,
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
             );
284 284
         }
285 285
 
286
-        try {
286
+        try{
287 287
             return new $adapter(...\array_values($server['options'] ?? []));
288
-        } catch (\Throwable $e) {
288
+        }catch (\Throwable $e){
289 289
             $message = 'An error occurred while server `%s` initializing: %s';
290 290
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
291 291
         }
Please login to merge, or discard this patch.
Braces   +29 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,8 +102,10 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function bootStorages(array $config): void
104 104
     {
105
-        foreach ($config['buckets'] as $name => $bucket) {
106
-            if (!\is_string($name)) {
105
+        foreach ($config['buckets'] as $name => $bucket)
106
+        {
107
+            if (!\is_string($name))
108
+            {
107 109
                 throw new InvalidArgumentException(
108 110
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
109 111
                         \get_debug_type($name),
@@ -112,7 +114,8 @@  discard block
 block discarded – undo
112 114
             }
113 115
 
114 116
             $serverName = $bucket['server'] ?? null;
115
-            if (!\is_string($serverName)) {
117
+            if (!\is_string($serverName))
118
+            {
116 119
                 throw new InvalidArgumentException(
117 120
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
118 121
                         $name,
@@ -122,7 +125,8 @@  discard block
 block discarded – undo
122 125
             }
123 126
 
124 127
             $server = $config['servers'][$serverName] ?? null;
125
-            if (!\is_array($server)) {
128
+            if (!\is_array($server))
129
+            {
126 130
                 throw new InvalidArgumentException(
127 131
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
128 132
                         $name,
@@ -132,7 +136,8 @@  discard block
 block discarded – undo
132 136
             }
133 137
 
134 138
             $adapter = $server['adapter'] ?? null;
135
-            if (!\is_string($adapter)) {
139
+            if (!\is_string($adapter))
140
+            {
136 141
                 throw new InvalidArgumentException(
137 142
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
138 143
                         $serverName,
@@ -145,7 +150,8 @@  discard block
 block discarded – undo
145 150
 
146 151
             $this->adapters[$name] = $adapter;
147 152
 
148
-            if (isset($bucket['distribution'])) {
153
+            if (isset($bucket['distribution']))
154
+            {
149 155
                 $this->distributions[$name] = $bucket['distribution'];
150 156
             }
151 157
         }
@@ -159,7 +165,8 @@  discard block
 block discarded – undo
159 165
      */
160 166
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
161 167
     {
162
-        switch ($server['adapter']) {
168
+        switch ($server['adapter'])
169
+        {
163 170
             case 'local':
164 171
                 return $this->createLocalAdapter($serverName, $bucket, $server);
165 172
 
@@ -197,8 +204,10 @@  discard block
 block discarded – undo
197 204
         $name = $bucket['bucket'] ?? $server['bucket'];
198 205
         $visibility = $bucket['visibility'] ?? $server['bucket'] ?? Visibility::VISIBILITY_PUBLIC;
199 206
 
200
-        if ($async) {
201
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
207
+        if ($async)
208
+        {
209
+            if (!\class_exists(AsyncAwsS3Adapter::class))
210
+            {
202 211
                 throw new InvalidArgumentException(
203 212
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
204 213
                 );
@@ -214,7 +223,8 @@  discard block
 block discarded – undo
214 223
             );
215 224
         }
216 225
 
217
-        if (!\class_exists(AwsS3V3Adapter::class)) {
226
+        if (!\class_exists(AwsS3V3Adapter::class))
227
+        {
218 228
             throw new InvalidArgumentException(
219 229
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
220 230
             );
@@ -238,7 +248,8 @@  discard block
 block discarded – undo
238 248
      */
239 249
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
240 250
     {
241
-        if (!\is_string($server['directory'] ?? null)) {
251
+        if (!\is_string($server['directory'] ?? null))
252
+        {
242 253
             throw new InvalidArgumentException(
243 254
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
244 255
                     $serverName,
@@ -273,7 +284,8 @@  discard block
 block discarded – undo
273 284
         $adapter = $server['adapter'];
274 285
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
275 286
 
276
-        if (!$isFilesystemAdapter) {
287
+        if (!$isFilesystemAdapter)
288
+        {
277 289
             throw new InvalidArgumentException(
278 290
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
279 291
                     $serverName,
@@ -283,9 +295,12 @@  discard block
 block discarded – undo
283 295
             );
284 296
         }
285 297
 
286
-        try {
298
+        try
299
+        {
287 300
             return new $adapter(...\array_values($server['options'] ?? []));
288
-        } catch (\Throwable $e) {
301
+        }
302
+        catch (\Throwable $e)
303
+        {
289 304
             $message = 'An error occurred while server `%s` initializing: %s';
290 305
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
291 306
         }
Please login to merge, or discard this patch.
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.