Passed
Pull Request — master (#407)
by Kirill
06:33
created
src/storage/src/Config/DTO/FileSystemInfo/FileSystemInfo.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
         $this->checkClass($info[static::ADAPTER_KEY], \sprintf('Filesystem %s adapter', $this->name));
58 58
         $this->adapter = $info[static::ADAPTER_KEY];
59 59
 
60
-        if (array_key_exists(static::RESOLVER_KEY, $info)) {
60
+        if (array_key_exists(static::RESOLVER_KEY, $info)){
61 61
             $this->checkClass($info[static::RESOLVER_KEY], \sprintf('Filesystem %s resolver', $this->name));
62 62
             $this->resolver = $info[static::RESOLVER_KEY];
63 63
         }
64 64
 
65 65
         $this->prepareOptions($info[OptionsBasedInterface::OPTIONS_KEY]);
66 66
 
67
-        if ($this instanceof SpecificConfigurableFileSystemInfo) {
67
+        if ($this instanceof SpecificConfigurableFileSystemInfo){
68 68
             $this->constructSpecific($info);
69 69
         }
70 70
     }
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function isAdvancedUsage(): bool
100 100
     {
101
-        foreach (static::ADDITIONAL_OPTIONS as $optionalOption => $type) {
102
-            if ($this->hasOption($optionalOption)) {
101
+        foreach (static::ADDITIONAL_OPTIONS as $optionalOption => $type){
102
+            if ($this->hasOption($optionalOption)){
103 103
                 return true;
104 104
             }
105 105
         }
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
             \sprintf(' for filesystem `%s`', $this->getName())
123 123
         );
124 124
 
125
-        foreach ($options as $optionKey => $option) {
126
-            if (($type = $this->getOptionType($optionKey)) === null) {
125
+        foreach ($options as $optionKey => $option){
126
+            if (($type = $this->getOptionType($optionKey)) === null){
127 127
                 continue;
128 128
             }
129 129
 
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
      */
144 144
     protected function validateInfoSufficient(string $fs, array $info): void
145 145
     {
146
-        if (!array_key_exists(static::ADAPTER_KEY, $info)) {
146
+        if (!array_key_exists(static::ADAPTER_KEY, $info)){
147 147
             throw new ConfigException(
148 148
                 \sprintf('Filesystem `%s` needs adapter class defined', $fs)
149 149
             );
150 150
         }
151 151
 
152
-        if (!array_key_exists(OptionsBasedInterface::OPTIONS_KEY, $info)) {
152
+        if (!array_key_exists(OptionsBasedInterface::OPTIONS_KEY, $info)){
153 153
             throw new ConfigException(
154 154
                 \sprintf('Filesystem `%s` needs options defined', $fs)
155 155
             );
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      */
168 168
     protected function validateOptionByType(string $optionLabel, string $optionType, $optionVal): void
169 169
     {
170
-        if (!$this->isOptionHasRequiredType($optionLabel, $optionVal, $optionType)) {
170
+        if (!$this->isOptionHasRequiredType($optionLabel, $optionVal, $optionType)){
171 171
             throw new ConfigException(
172 172
                 \sprintf(
173 173
                     'Option `%s` defined in wrong format for filesystem `%s`, %s expected',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     protected function getOptionType(string $option): ?string
190 190
     {
191
-        if (array_key_exists($option, static::REQUIRED_OPTIONS)) {
191
+        if (array_key_exists($option, static::REQUIRED_OPTIONS)){
192 192
             return static::REQUIRED_OPTIONS[$option];
193 193
         }
194 194
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,14 +57,16 @@  discard block
 block discarded – undo
57 57
         $this->checkClass($info[static::ADAPTER_KEY], \sprintf('Filesystem %s adapter', $this->name));
58 58
         $this->adapter = $info[static::ADAPTER_KEY];
59 59
 
60
-        if (array_key_exists(static::RESOLVER_KEY, $info)) {
60
+        if (array_key_exists(static::RESOLVER_KEY, $info))
61
+        {
61 62
             $this->checkClass($info[static::RESOLVER_KEY], \sprintf('Filesystem %s resolver', $this->name));
62 63
             $this->resolver = $info[static::RESOLVER_KEY];
63 64
         }
64 65
 
65 66
         $this->prepareOptions($info[OptionsBasedInterface::OPTIONS_KEY]);
66 67
 
67
-        if ($this instanceof SpecificConfigurableFileSystemInfo) {
68
+        if ($this instanceof SpecificConfigurableFileSystemInfo)
69
+        {
68 70
             $this->constructSpecific($info);
69 71
         }
70 72
     }
@@ -98,8 +100,10 @@  discard block
 block discarded – undo
98 100
      */
99 101
     public function isAdvancedUsage(): bool
100 102
     {
101
-        foreach (static::ADDITIONAL_OPTIONS as $optionalOption => $type) {
102
-            if ($this->hasOption($optionalOption)) {
103
+        foreach (static::ADDITIONAL_OPTIONS as $optionalOption => $type)
104
+        {
105
+            if ($this->hasOption($optionalOption))
106
+            {
103 107
                 return true;
104 108
             }
105 109
         }
@@ -122,8 +126,10 @@  discard block
 block discarded – undo
122 126
             \sprintf(' for filesystem `%s`', $this->getName())
123 127
         );
124 128
 
125
-        foreach ($options as $optionKey => $option) {
126
-            if (($type = $this->getOptionType($optionKey)) === null) {
129
+        foreach ($options as $optionKey => $option)
130
+        {
131
+            if (($type = $this->getOptionType($optionKey)) === null)
132
+            {
127 133
                 continue;
128 134
             }
129 135
 
@@ -143,13 +149,15 @@  discard block
 block discarded – undo
143 149
      */
144 150
     protected function validateInfoSufficient(string $fs, array $info): void
145 151
     {
146
-        if (!array_key_exists(static::ADAPTER_KEY, $info)) {
152
+        if (!array_key_exists(static::ADAPTER_KEY, $info))
153
+        {
147 154
             throw new ConfigException(
148 155
                 \sprintf('Filesystem `%s` needs adapter class defined', $fs)
149 156
             );
150 157
         }
151 158
 
152
-        if (!array_key_exists(OptionsBasedInterface::OPTIONS_KEY, $info)) {
159
+        if (!array_key_exists(OptionsBasedInterface::OPTIONS_KEY, $info))
160
+        {
153 161
             throw new ConfigException(
154 162
                 \sprintf('Filesystem `%s` needs options defined', $fs)
155 163
             );
@@ -167,7 +175,8 @@  discard block
 block discarded – undo
167 175
      */
168 176
     protected function validateOptionByType(string $optionLabel, string $optionType, $optionVal): void
169 177
     {
170
-        if (!$this->isOptionHasRequiredType($optionLabel, $optionVal, $optionType)) {
178
+        if (!$this->isOptionHasRequiredType($optionLabel, $optionVal, $optionType))
179
+        {
171 180
             throw new ConfigException(
172 181
                 \sprintf(
173 182
                     'Option `%s` defined in wrong format for filesystem `%s`, %s expected',
@@ -188,7 +197,8 @@  discard block
 block discarded – undo
188 197
      */
189 198
     protected function getOptionType(string $option): ?string
190 199
     {
191
-        if (array_key_exists($option, static::REQUIRED_OPTIONS)) {
200
+        if (array_key_exists($option, static::REQUIRED_OPTIONS))
201
+        {
192 202
             return static::REQUIRED_OPTIONS[$option];
193 203
         }
194 204
 
Please login to merge, or discard this patch.
src/storage/src/Config/StorageConfig.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -143,19 +143,19 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function buildFileSystemInfo(string $fs, ?bool $force = false): FileSystemInfoInterface
145 145
     {
146
-        if (!$this->hasBucket($fs)) {
146
+        if (!$this->hasBucket($fs)){
147 147
             throw new ConfigException(
148 148
                 \sprintf('Bucket `%s` was not found', $fs)
149 149
             );
150 150
         }
151 151
 
152
-        if (!$force && array_key_exists($fs, $this->fileSystemsInfoList)) {
152
+        if (!$force && array_key_exists($fs, $this->fileSystemsInfoList)){
153 153
             return $this->fileSystemsInfoList[$fs];
154 154
         }
155 155
 
156 156
         $bucketInfo = $this->buildBucketInfo($fs);
157 157
 
158
-        if (!$this->hasServer($bucketInfo->getServer())) {
158
+        if (!$this->hasServer($bucketInfo->getServer())){
159 159
             throw new ConfigException(
160 160
                 \sprintf(
161 161
                     'Server `%s` info for filesystem `%s` was not detected',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
         $serverInfo = $this->config[self::SERVERS_KEY][$bucketInfo->getServer()];
169 169
 
170
-        switch ($this->extractServerAdapter($serverInfo)) {
170
+        switch ($this->extractServerAdapter($serverInfo)){
171 171
             case \League\Flysystem\Local\LocalFilesystemAdapter::class:
172 172
                 $fsInfoDTO = new FileSystemInfo\LocalInfo($fs, $serverInfo);
173 173
                 break;
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function buildBucketInfo(string $bucketLabel, ?bool $force = false): BucketInfoInterface
203 203
     {
204
-        if (!$this->hasBucket($bucketLabel)) {
204
+        if (!$this->hasBucket($bucketLabel)){
205 205
             throw new StorageException(
206 206
                 \sprintf('Bucket `%s` was not found', $bucketLabel)
207 207
             );
208 208
         }
209 209
 
210
-        if (!$force && array_key_exists($bucketLabel, $this->bucketsInfoList)) {
210
+        if (!$force && array_key_exists($bucketLabel, $this->bucketsInfoList)){
211 211
             return $this->bucketsInfoList[$bucketLabel];
212 212
         }
213 213
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     private function normalizeServers(array $config): array
248 248
     {
249
-        if (!isset($config[self::SERVERS_KEY])) {
249
+        if (!isset($config[self::SERVERS_KEY])){
250 250
             $config[self::SERVERS_KEY] = [];
251 251
 
252 252
             return $config;
@@ -254,20 +254,20 @@  discard block
 block discarded – undo
254 254
 
255 255
         $servers = $config[self::SERVERS_KEY];
256 256
 
257
-        if (!\is_array($servers)) {
257
+        if (!\is_array($servers)){
258 258
             $message = 'Storage servers list must be an array, but `%s` defined';
259 259
             throw new ConfigException(\sprintf($message, $this->valueToString($servers)), 0x01);
260 260
         }
261 261
 
262
-        foreach ($servers as $name => $server) {
263
-            if (!\is_string($name)) {
262
+        foreach ($servers as $name => $server){
263
+            if (!\is_string($name)){
264 264
                 $message = 'Storage server name must be a string, but %s defined';
265 265
                 $message = \sprintf($message, $this->valueToString($name));
266 266
 
267 267
                 throw new ConfigException($message, 0x02);
268 268
             }
269 269
 
270
-            if (!\is_array($server)) {
270
+            if (!\is_array($server)){
271 271
                 $message = 'Storage server `%s` config must be an array, but %s defined';
272 272
                 $message = \sprintf($message, $name, $this->valueToString($server));
273 273
 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 
277 277
             $adapter = $server['adapter'] ?? null;
278 278
 
279
-            if (!\is_string($adapter) || !\is_subclass_of($adapter, FilesystemAdapter::class, true)) {
280
-                $message = 'Storage server `%s` adapter must be a class ' .
279
+            if (!\is_string($adapter) || !\is_subclass_of($adapter, FilesystemAdapter::class, true)){
280
+                $message = 'Storage server `%s` adapter must be a class '.
281 281
                     'string that implements %s interface, but %s defined'
282 282
                 ;
283 283
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 throw new ConfigException($message, 0x04);
287 287
             }
288 288
 
289
-            if (isset($server['options']) && !\is_array($server['options'])) {
289
+            if (isset($server['options']) && !\is_array($server['options'])){
290 290
                 $message = 'Storage server `%s` options must be an array, but %s defined';
291 291
                 $message = \sprintf($message, $name, $this->valueToString($server['options']));
292 292
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      */
308 308
     private function normalizeBuckets(array $config): array
309 309
     {
310
-        if (!isset($config[self::BUCKETS_KEY])) {
310
+        if (!isset($config[self::BUCKETS_KEY])){
311 311
             $config[self::BUCKETS_KEY] = [];
312 312
 
313 313
             return $config;
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
 
316 316
         $buckets = $config[self::BUCKETS_KEY];
317 317
 
318
-        if (!\is_array($buckets)) {
318
+        if (!\is_array($buckets)){
319 319
             $message = 'Storage buckets list must be an array, but `%s` defined';
320 320
             throw new ConfigException(\sprintf($message, $this->valueToString($buckets)), 0x06);
321 321
         }
322 322
 
323
-        foreach ($buckets as $name => $bucket) {
324
-            if (!\is_string($name)) {
323
+        foreach ($buckets as $name => $bucket){
324
+            if (!\is_string($name)){
325 325
                 $message = 'Storage bucket name must be a string, but %s defined';
326 326
                 $message = \sprintf($message, $this->valueToString($name));
327 327
 
328 328
                 throw new ConfigException($message, 0x07);
329 329
             }
330 330
 
331
-            if (!\is_array($bucket)) {
331
+            if (!\is_array($bucket)){
332 332
                 $message = 'Storage bucket `%s` config must be an array, but %s defined';
333 333
                 $message = \sprintf($message, $name, $this->valueToString($bucket));
334 334
 
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
 
338 338
             $server = $bucket['server'] ?? null;
339 339
 
340
-            if (!\is_string($server)) {
340
+            if (!\is_string($server)){
341 341
                 $message = 'Storage server of bucket `%s` must be a string, but %s defined';
342 342
                 $message = \sprintf($message, $name, $this->valueToString($server));
343 343
 
344 344
                 throw new ConfigException($message, 0x09);
345 345
             }
346 346
 
347
-            if (!isset($config[self::SERVERS_KEY][$server])) {
347
+            if (!isset($config[self::SERVERS_KEY][$server])){
348 348
                 $variants = \implode(', ', \array_keys($config[self::SERVERS_KEY] ?? []));
349 349
                 $message = 'Storage server `%s` of bucket `%s` has not been defined, one of [%s] required';
350 350
                 $message = \sprintf($message, $server, $name, $variants);
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                 throw new ConfigException($message, 0x0A);
353 353
             }
354 354
 
355
-            if (isset($bucket['options']) && !\is_array($bucket['options'])) {
355
+            if (isset($bucket['options']) && !\is_array($bucket['options'])){
356 356
                 $message = 'Storage bucket `%s` options must be an array, but %s defined';
357 357
                 $message = \sprintf($message, $name, $this->valueToString($bucket['options']));
358 358
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      */
374 374
     private function normalizeTemporaryDirectory(array $config): array
375 375
     {
376
-        if (!isset($config[self::TMP_DIR_KEY])) {
376
+        if (!isset($config[self::TMP_DIR_KEY])){
377 377
             $config[self::TMP_DIR_KEY] = \sys_get_temp_dir();
378 378
 
379 379
             return $config;
@@ -381,17 +381,17 @@  discard block
 block discarded – undo
381 381
 
382 382
         $directory = $config[self::TMP_DIR_KEY];
383 383
 
384
-        if (!\is_string($directory)) {
384
+        if (!\is_string($directory)){
385 385
             $message = 'Storage temporary directory must be a string, but `%s` defined';
386 386
             throw new ConfigException(\sprintf($message, $this->valueToString($directory)), 0x0C);
387 387
         }
388 388
 
389
-        if (!\is_dir($directory)) {
389
+        if (!\is_dir($directory)){
390 390
             $message = 'Storage temporary directory `%s` must be a valid directory';
391 391
             throw new ConfigException(\sprintf($message, $directory), 0x0D);
392 392
         }
393 393
 
394
-        if (!\is_writable($directory)) {
394
+        if (!\is_writable($directory)){
395 395
             $message = 'Storage temporary directory `%s` must be writable';
396 396
             throw new ConfigException(\sprintf($message, $directory), 0x0E);
397 397
         }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     {
408 408
         $suffix = \is_scalar($value) ? "($value)" : (string)$value;
409 409
 
410
-        return \get_debug_type($value) . $suffix;
410
+        return \get_debug_type($value).$suffix;
411 411
     }
412 412
 
413 413
     /**
Please login to merge, or discard this patch.
Braces   +50 added lines, -25 removed lines patch added patch discarded remove patch
@@ -143,19 +143,22 @@  discard block
 block discarded – undo
143 143
      */
144 144
     public function buildFileSystemInfo(string $fs, ?bool $force = false): FileSystemInfoInterface
145 145
     {
146
-        if (!$this->hasBucket($fs)) {
146
+        if (!$this->hasBucket($fs))
147
+        {
147 148
             throw new ConfigException(
148 149
                 \sprintf('Bucket `%s` was not found', $fs)
149 150
             );
150 151
         }
151 152
 
152
-        if (!$force && array_key_exists($fs, $this->fileSystemsInfoList)) {
153
+        if (!$force && array_key_exists($fs, $this->fileSystemsInfoList))
154
+        {
153 155
             return $this->fileSystemsInfoList[$fs];
154 156
         }
155 157
 
156 158
         $bucketInfo = $this->buildBucketInfo($fs);
157 159
 
158
-        if (!$this->hasServer($bucketInfo->getServer())) {
160
+        if (!$this->hasServer($bucketInfo->getServer()))
161
+        {
159 162
             throw new ConfigException(
160 163
                 \sprintf(
161 164
                     'Server `%s` info for filesystem `%s` was not detected',
@@ -167,7 +170,8 @@  discard block
 block discarded – undo
167 170
 
168 171
         $serverInfo = $this->config[self::SERVERS_KEY][$bucketInfo->getServer()];
169 172
 
170
-        switch ($this->extractServerAdapter($serverInfo)) {
173
+        switch ($this->extractServerAdapter($serverInfo))
174
+        {
171 175
             case \League\Flysystem\Local\LocalFilesystemAdapter::class:
172 176
                 $fsInfoDTO = new FileSystemInfo\LocalInfo($fs, $serverInfo);
173 177
                 break;
@@ -201,13 +205,15 @@  discard block
 block discarded – undo
201 205
      */
202 206
     public function buildBucketInfo(string $bucketLabel, ?bool $force = false): BucketInfoInterface
203 207
     {
204
-        if (!$this->hasBucket($bucketLabel)) {
208
+        if (!$this->hasBucket($bucketLabel))
209
+        {
205 210
             throw new StorageException(
206 211
                 \sprintf('Bucket `%s` was not found', $bucketLabel)
207 212
             );
208 213
         }
209 214
 
210
-        if (!$force && array_key_exists($bucketLabel, $this->bucketsInfoList)) {
215
+        if (!$force && array_key_exists($bucketLabel, $this->bucketsInfoList))
216
+        {
211 217
             return $this->bucketsInfoList[$bucketLabel];
212 218
         }
213 219
 
@@ -246,7 +252,8 @@  discard block
 block discarded – undo
246 252
      */
247 253
     private function normalizeServers(array $config): array
248 254
     {
249
-        if (!isset($config[self::SERVERS_KEY])) {
255
+        if (!isset($config[self::SERVERS_KEY]))
256
+        {
250 257
             $config[self::SERVERS_KEY] = [];
251 258
 
252 259
             return $config;
@@ -254,20 +261,24 @@  discard block
 block discarded – undo
254 261
 
255 262
         $servers = $config[self::SERVERS_KEY];
256 263
 
257
-        if (!\is_array($servers)) {
264
+        if (!\is_array($servers))
265
+        {
258 266
             $message = 'Storage servers list must be an array, but `%s` defined';
259 267
             throw new ConfigException(\sprintf($message, $this->valueToString($servers)), 0x01);
260 268
         }
261 269
 
262
-        foreach ($servers as $name => $server) {
263
-            if (!\is_string($name)) {
270
+        foreach ($servers as $name => $server)
271
+        {
272
+            if (!\is_string($name))
273
+            {
264 274
                 $message = 'Storage server name must be a string, but %s defined';
265 275
                 $message = \sprintf($message, $this->valueToString($name));
266 276
 
267 277
                 throw new ConfigException($message, 0x02);
268 278
             }
269 279
 
270
-            if (!\is_array($server)) {
280
+            if (!\is_array($server))
281
+            {
271 282
                 $message = 'Storage server `%s` config must be an array, but %s defined';
272 283
                 $message = \sprintf($message, $name, $this->valueToString($server));
273 284
 
@@ -276,7 +287,8 @@  discard block
 block discarded – undo
276 287
 
277 288
             $adapter = $server['adapter'] ?? null;
278 289
 
279
-            if (!\is_string($adapter) || !\is_subclass_of($adapter, FilesystemAdapter::class, true)) {
290
+            if (!\is_string($adapter) || !\is_subclass_of($adapter, FilesystemAdapter::class, true))
291
+            {
280 292
                 $message = 'Storage server `%s` adapter must be a class ' .
281 293
                     'string that implements %s interface, but %s defined'
282 294
                 ;
@@ -286,7 +298,8 @@  discard block
 block discarded – undo
286 298
                 throw new ConfigException($message, 0x04);
287 299
             }
288 300
 
289
-            if (isset($server['options']) && !\is_array($server['options'])) {
301
+            if (isset($server['options']) && !\is_array($server['options']))
302
+            {
290 303
                 $message = 'Storage server `%s` options must be an array, but %s defined';
291 304
                 $message = \sprintf($message, $name, $this->valueToString($server['options']));
292 305
 
@@ -307,7 +320,8 @@  discard block
 block discarded – undo
307 320
      */
308 321
     private function normalizeBuckets(array $config): array
309 322
     {
310
-        if (!isset($config[self::BUCKETS_KEY])) {
323
+        if (!isset($config[self::BUCKETS_KEY]))
324
+        {
311 325
             $config[self::BUCKETS_KEY] = [];
312 326
 
313 327
             return $config;
@@ -315,20 +329,24 @@  discard block
 block discarded – undo
315 329
 
316 330
         $buckets = $config[self::BUCKETS_KEY];
317 331
 
318
-        if (!\is_array($buckets)) {
332
+        if (!\is_array($buckets))
333
+        {
319 334
             $message = 'Storage buckets list must be an array, but `%s` defined';
320 335
             throw new ConfigException(\sprintf($message, $this->valueToString($buckets)), 0x06);
321 336
         }
322 337
 
323
-        foreach ($buckets as $name => $bucket) {
324
-            if (!\is_string($name)) {
338
+        foreach ($buckets as $name => $bucket)
339
+        {
340
+            if (!\is_string($name))
341
+            {
325 342
                 $message = 'Storage bucket name must be a string, but %s defined';
326 343
                 $message = \sprintf($message, $this->valueToString($name));
327 344
 
328 345
                 throw new ConfigException($message, 0x07);
329 346
             }
330 347
 
331
-            if (!\is_array($bucket)) {
348
+            if (!\is_array($bucket))
349
+            {
332 350
                 $message = 'Storage bucket `%s` config must be an array, but %s defined';
333 351
                 $message = \sprintf($message, $name, $this->valueToString($bucket));
334 352
 
@@ -337,14 +355,16 @@  discard block
 block discarded – undo
337 355
 
338 356
             $server = $bucket['server'] ?? null;
339 357
 
340
-            if (!\is_string($server)) {
358
+            if (!\is_string($server))
359
+            {
341 360
                 $message = 'Storage server of bucket `%s` must be a string, but %s defined';
342 361
                 $message = \sprintf($message, $name, $this->valueToString($server));
343 362
 
344 363
                 throw new ConfigException($message, 0x09);
345 364
             }
346 365
 
347
-            if (!isset($config[self::SERVERS_KEY][$server])) {
366
+            if (!isset($config[self::SERVERS_KEY][$server]))
367
+            {
348 368
                 $variants = \implode(', ', \array_keys($config[self::SERVERS_KEY] ?? []));
349 369
                 $message = 'Storage server `%s` of bucket `%s` has not been defined, one of [%s] required';
350 370
                 $message = \sprintf($message, $server, $name, $variants);
@@ -352,7 +372,8 @@  discard block
 block discarded – undo
352 372
                 throw new ConfigException($message, 0x0A);
353 373
             }
354 374
 
355
-            if (isset($bucket['options']) && !\is_array($bucket['options'])) {
375
+            if (isset($bucket['options']) && !\is_array($bucket['options']))
376
+            {
356 377
                 $message = 'Storage bucket `%s` options must be an array, but %s defined';
357 378
                 $message = \sprintf($message, $name, $this->valueToString($bucket['options']));
358 379
 
@@ -373,7 +394,8 @@  discard block
 block discarded – undo
373 394
      */
374 395
     private function normalizeTemporaryDirectory(array $config): array
375 396
     {
376
-        if (!isset($config[self::TMP_DIR_KEY])) {
397
+        if (!isset($config[self::TMP_DIR_KEY]))
398
+        {
377 399
             $config[self::TMP_DIR_KEY] = \sys_get_temp_dir();
378 400
 
379 401
             return $config;
@@ -381,17 +403,20 @@  discard block
 block discarded – undo
381 403
 
382 404
         $directory = $config[self::TMP_DIR_KEY];
383 405
 
384
-        if (!\is_string($directory)) {
406
+        if (!\is_string($directory))
407
+        {
385 408
             $message = 'Storage temporary directory must be a string, but `%s` defined';
386 409
             throw new ConfigException(\sprintf($message, $this->valueToString($directory)), 0x0C);
387 410
         }
388 411
 
389
-        if (!\is_dir($directory)) {
412
+        if (!\is_dir($directory))
413
+        {
390 414
             $message = 'Storage temporary directory `%s` must be a valid directory';
391 415
             throw new ConfigException(\sprintf($message, $directory), 0x0D);
392 416
         }
393 417
 
394
-        if (!\is_writable($directory)) {
418
+        if (!\is_writable($directory))
419
+        {
395 420
             $message = 'Storage temporary directory `%s` must be writable';
396 421
             throw new ConfigException(\sprintf($message, $directory), 0x0E);
397 422
         }
Please login to merge, or discard this patch.
src/storage/src/Resolver/AbstractAdapterResolver.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         $fsInfo = $config->buildFileSystemInfo($fs);
54 54
 
55
-        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass) {
55
+        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass){
56 56
             throw new StorageException(
57 57
                 \sprintf(
58 58
                     'Wrong filesystem info (`%s`) for resolver `%s`',
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function normalizeFilePath(string $filePath): string
80 80
     {
81
-        try {
81
+        try{
82 82
             $uri = $this->uriParser->parse($filePath);
83 83
 
84 84
             return $uri->getPath();
85
-        } catch (UriException $e) {
85
+        }catch (UriException $e){
86 86
             // if filePath is not uri we suppose it is short form of filepath - without fs part
87 87
         }
88 88
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
         $fsInfo = $config->buildFileSystemInfo($fs);
54 54
 
55
-        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass) {
55
+        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass)
56
+        {
56 57
             throw new StorageException(
57 58
                 \sprintf(
58 59
                     'Wrong filesystem info (`%s`) for resolver `%s`',
@@ -78,11 +79,14 @@  discard block
 block discarded – undo
78 79
      */
79 80
     public function normalizeFilePath(string $filePath): string
80 81
     {
81
-        try {
82
+        try
83
+        {
82 84
             $uri = $this->uriParser->parse($filePath);
83 85
 
84 86
             return $uri->getPath();
85
-        } catch (UriException $e) {
87
+        }
88
+        catch (UriException $e)
89
+        {
86 90
             // if filePath is not uri we suppose it is short form of filepath - without fs part
87 91
         }
88 92
 
Please login to merge, or discard this patch.
src/storage/src/Resolver/LocalSystemResolver.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public function buildUrl(string $uri, array $options = [])
36 36
     {
37
-        if (!$this->fsInfo->hasOption(LocalInfo::HOST_KEY)) {
37
+        if (!$this->fsInfo->hasOption(LocalInfo::HOST_KEY)){
38 38
             throw new ResolveException(
39 39
                 \sprintf('Url can\'t be built for filesystem `%s` - host was not defined', $this->fsInfo->getName())
40 40
             );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@
 block discarded – undo
34 34
      */
35 35
     public function buildUrl(string $uri, array $options = [])
36 36
     {
37
-        if (!$this->fsInfo->hasOption(LocalInfo::HOST_KEY)) {
37
+        if (!$this->fsInfo->hasOption(LocalInfo::HOST_KEY))
38
+        {
38 39
             throw new ResolveException(
39 40
                 \sprintf('Url can\'t be built for filesystem `%s` - host was not defined', $this->fsInfo->getName())
40 41
             );
Please login to merge, or discard this patch.
src/storage/src/Storage.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->config = $config;
51 51
         $this->uriParser = $uriParser;
52 52
 
53
-        foreach ($config->getBucketsKeys() as $fs) {
53
+        foreach ($config->getBucketsKeys() as $fs){
54 54
             $this->mountFilesystem($fs, new Filesystem(
55 55
                 AdapterFactory::build($this->config->buildFileSystemInfo($fs))
56 56
             ));
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function getFileSystem(string $key): FilesystemOperator
64 64
     {
65
-        if (!$this->isFileSystemExists($key)) {
65
+        if (!$this->isFileSystemExists($key)){
66 66
             throw new MountException(\sprintf('Filesystem `%s` has not been defined', $key));
67 67
         }
68 68
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
         /** @var FilesystemOperator $filesystem */
86 86
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
87 87
 
88
-        try {
88
+        try{
89 89
             return $filesystem->fileExists($path);
90
-        } catch (FilesystemException $e) {
90
+        }catch (FilesystemException $e){
91 91
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
92 92
         }
93 93
     }
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
         /** @var FilesystemOperator $filesystem */
101 101
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
102 102
 
103
-        try {
103
+        try{
104 104
             return $filesystem->read($path);
105
-        } catch (FilesystemException $e) {
105
+        }catch (FilesystemException $e){
106 106
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
107 107
         }
108 108
     }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
         /** @var FilesystemOperator $filesystem */
116 116
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
117 117
 
118
-        try {
118
+        try{
119 119
             return $filesystem->readStream($path);
120
-        } catch (FilesystemException $e) {
120
+        }catch (FilesystemException $e){
121 121
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
122 122
         }
123 123
     }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
         /** @var FilesystemOperator $filesystem */
131 131
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
132 132
 
133
-        try {
133
+        try{
134 134
             return $filesystem->lastModified($path);
135
-        } catch (FilesystemException $e) {
135
+        }catch (FilesystemException $e){
136 136
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
137 137
         }
138 138
     }
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
         /** @var FilesystemOperator $filesystem */
146 146
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
147 147
 
148
-        try {
148
+        try{
149 149
             return $filesystem->fileSize($path);
150
-        } catch (FilesystemException $e) {
150
+        }catch (FilesystemException $e){
151 151
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
152 152
         }
153 153
     }
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
         /** @var FilesystemOperator $filesystem */
161 161
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
162 162
 
163
-        try {
163
+        try{
164 164
             return $filesystem->mimeType($path);
165
-        } catch (FilesystemException $e) {
165
+        }catch (FilesystemException $e){
166 166
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
167 167
         }
168 168
     }
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
         /** @var FilesystemOperator $filesystem */
176 176
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
177 177
 
178
-        try {
178
+        try{
179 179
             return $filesystem->visibility($path);
180
-        } catch (FilesystemException $e) {
180
+        }catch (FilesystemException $e){
181 181
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
182 182
         }
183 183
     }
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function tempFilename(string $uri = null): string
189 189
     {
190
-        try {
190
+        try{
191 191
             $prefix = 'tmpStorageFile_';
192 192
 
193
-            if ($uri !== null) {
193
+            if ($uri !== null){
194 194
                 /** @var FilesystemOperator $filesystem */
195 195
                 [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
196 196
                 $content = $filesystem->readStream($path);
197
-                $prefix = basename($uri) . '_';
197
+                $prefix = basename($uri).'_';
198 198
             }
199 199
 
200 200
             $filePath = tempnam($this->config->getTmpDir(), $prefix);
201 201
 
202
-            if (isset($content)) {
202
+            if (isset($content)){
203 203
                 file_put_contents($filePath, $content);
204 204
             }
205 205
 
206 206
             return $filePath;
207
-        } catch (\Throwable $e) {
207
+        }catch (\Throwable $e){
208 208
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
209 209
         }
210 210
     }
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
         /** @var FilesystemOperator $filesystem */
220 220
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
221 221
 
222
-        try {
222
+        try{
223 223
             $filesystem->write($path, $content, $config);
224 224
 
225 225
             return $uri;
226
-        } catch (FilesystemException $e) {
226
+        }catch (FilesystemException $e){
227 227
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
228 228
         }
229 229
     }
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
         /** @var FilesystemOperator $filesystem */
239 239
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
240 240
 
241
-        try {
241
+        try{
242 242
             $filesystem->writeStream($path, $content, $config);
243 243
 
244 244
             return $uri;
245
-        } catch (FilesystemException $e) {
245
+        }catch (FilesystemException $e){
246 246
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
247 247
         }
248 248
     }
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
         /** @var FilesystemOperator $filesystem */
256 256
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
257 257
 
258
-        try {
258
+        try{
259 259
             $filesystem->setVisibility($path, $visibility);
260
-        } catch (FilesystemException $e) {
260
+        }catch (FilesystemException $e){
261 261
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
262 262
         }
263 263
     }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $destinationFilesystem = $this->getFileSystem($destinationFileSystem);
278 278
 
279
-        try {
279
+        try{
280 280
             $targetFilePath = $targetFilePath ?: $sourcePath;
281 281
 
282 282
             $sourceFilesystem === $destinationFilesystem
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                 : $this->moveAcrossFilesystems($sourceUri, $destinationFileSystem, $targetFilePath, $config);
285 285
 
286 286
             return (string)Uri::create($destinationFileSystem, $targetFilePath);
287
-        } catch (FilesystemException $e) {
287
+        }catch (FilesystemException $e){
288 288
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
289 289
         }
290 290
     }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
         $destinationFilesystem = $this->getFileSystem($destinationFileSystem);
305 305
 
306
-        try {
306
+        try{
307 307
             $targetFilePath = $targetFilePath ?: $sourcePath;
308 308
 
309 309
             $sourceFilesystem === $destinationFilesystem
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
                 );
319 319
 
320 320
             return (string)Uri::create($destinationFileSystem, $targetFilePath);
321
-        } catch (FilesystemException $e) {
321
+        }catch (FilesystemException $e){
322 322
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
323 323
         }
324 324
     }
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
         /** @var FilesystemOperator $filesystem */
332 332
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
333 333
 
334
-        try {
334
+        try{
335 335
             $filesystem->delete($path);
336
-        } catch (FilesystemException $e) {
336
+        }catch (FilesystemException $e){
337 337
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
338 338
         }
339 339
     }
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      */
350 350
     protected function mountFilesystem(string $key, FilesystemOperator $filesystem): void
351 351
     {
352
-        if ($this->isFileSystemExists($key)) {
352
+        if ($this->isFileSystemExists($key)){
353 353
             throw new MountException(\sprintf('Filesystem %s is already mounted', $key));
354 354
         }
355 355
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         string $destinationPath,
455 455
         array $config = []
456 456
     ): void {
457
-        if ($sourcePath === $destinationPath && empty($config)) {
457
+        if ($sourcePath === $destinationPath && empty($config)){
458 458
             return;
459 459
         }
460 460
 
Please login to merge, or discard this patch.
Braces   +82 added lines, -34 removed lines patch added patch discarded remove patch
@@ -50,7 +50,8 @@  discard block
 block discarded – undo
50 50
         $this->config = $config;
51 51
         $this->uriParser = $uriParser;
52 52
 
53
-        foreach ($config->getBucketsKeys() as $fs) {
53
+        foreach ($config->getBucketsKeys() as $fs)
54
+        {
54 55
             $this->mountFilesystem($fs, new Filesystem(
55 56
                 AdapterFactory::build($this->config->buildFileSystemInfo($fs))
56 57
             ));
@@ -62,7 +63,8 @@  discard block
 block discarded – undo
62 63
      */
63 64
     public function getFileSystem(string $key): FilesystemOperator
64 65
     {
65
-        if (!$this->isFileSystemExists($key)) {
66
+        if (!$this->isFileSystemExists($key))
67
+        {
66 68
             throw new MountException(\sprintf('Filesystem `%s` has not been defined', $key));
67 69
         }
68 70
 
@@ -85,9 +87,12 @@  discard block
 block discarded – undo
85 87
         /** @var FilesystemOperator $filesystem */
86 88
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
87 89
 
88
-        try {
90
+        try
91
+        {
89 92
             return $filesystem->fileExists($path);
90
-        } catch (FilesystemException $e) {
93
+        }
94
+        catch (FilesystemException $e)
95
+        {
91 96
             throw new FileOperationException($e->getMessage(), $e->getCode(), $e);
92 97
         }
93 98
     }
@@ -100,9 +105,12 @@  discard block
 block discarded – undo
100 105
         /** @var FilesystemOperator $filesystem */
101 106
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
102 107
 
103
-        try {
108
+        try
109
+        {
104 110
             return $filesystem->read($path);
105
-        } catch (FilesystemException $e) {
111
+        }
112
+        catch (FilesystemException $e)
113
+        {
106 114
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
107 115
         }
108 116
     }
@@ -115,9 +123,12 @@  discard block
 block discarded – undo
115 123
         /** @var FilesystemOperator $filesystem */
116 124
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
117 125
 
118
-        try {
126
+        try
127
+        {
119 128
             return $filesystem->readStream($path);
120
-        } catch (FilesystemException $e) {
129
+        }
130
+        catch (FilesystemException $e)
131
+        {
121 132
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
122 133
         }
123 134
     }
@@ -130,9 +141,12 @@  discard block
 block discarded – undo
130 141
         /** @var FilesystemOperator $filesystem */
131 142
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
132 143
 
133
-        try {
144
+        try
145
+        {
134 146
             return $filesystem->lastModified($path);
135
-        } catch (FilesystemException $e) {
147
+        }
148
+        catch (FilesystemException $e)
149
+        {
136 150
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
137 151
         }
138 152
     }
@@ -145,9 +159,12 @@  discard block
 block discarded – undo
145 159
         /** @var FilesystemOperator $filesystem */
146 160
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
147 161
 
148
-        try {
162
+        try
163
+        {
149 164
             return $filesystem->fileSize($path);
150
-        } catch (FilesystemException $e) {
165
+        }
166
+        catch (FilesystemException $e)
167
+        {
151 168
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
152 169
         }
153 170
     }
@@ -160,9 +177,12 @@  discard block
 block discarded – undo
160 177
         /** @var FilesystemOperator $filesystem */
161 178
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
162 179
 
163
-        try {
180
+        try
181
+        {
164 182
             return $filesystem->mimeType($path);
165
-        } catch (FilesystemException $e) {
183
+        }
184
+        catch (FilesystemException $e)
185
+        {
166 186
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
167 187
         }
168 188
     }
@@ -175,9 +195,12 @@  discard block
 block discarded – undo
175 195
         /** @var FilesystemOperator $filesystem */
176 196
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
177 197
 
178
-        try {
198
+        try
199
+        {
179 200
             return $filesystem->visibility($path);
180
-        } catch (FilesystemException $e) {
201
+        }
202
+        catch (FilesystemException $e)
203
+        {
181 204
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
182 205
         }
183 206
     }
@@ -187,10 +210,12 @@  discard block
 block discarded – undo
187 210
      */
188 211
     public function tempFilename(string $uri = null): string
189 212
     {
190
-        try {
213
+        try
214
+        {
191 215
             $prefix = 'tmpStorageFile_';
192 216
 
193
-            if ($uri !== null) {
217
+            if ($uri !== null)
218
+            {
194 219
                 /** @var FilesystemOperator $filesystem */
195 220
                 [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
196 221
                 $content = $filesystem->readStream($path);
@@ -199,12 +224,15 @@  discard block
 block discarded – undo
199 224
 
200 225
             $filePath = tempnam($this->config->getTmpDir(), $prefix);
201 226
 
202
-            if (isset($content)) {
227
+            if (isset($content))
228
+            {
203 229
                 file_put_contents($filePath, $content);
204 230
             }
205 231
 
206 232
             return $filePath;
207
-        } catch (\Throwable $e) {
233
+        }
234
+        catch (\Throwable $e)
235
+        {
208 236
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
209 237
         }
210 238
     }
@@ -219,11 +247,14 @@  discard block
 block discarded – undo
219 247
         /** @var FilesystemOperator $filesystem */
220 248
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
221 249
 
222
-        try {
250
+        try
251
+        {
223 252
             $filesystem->write($path, $content, $config);
224 253
 
225 254
             return $uri;
226
-        } catch (FilesystemException $e) {
255
+        }
256
+        catch (FilesystemException $e)
257
+        {
227 258
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
228 259
         }
229 260
     }
@@ -238,11 +269,14 @@  discard block
 block discarded – undo
238 269
         /** @var FilesystemOperator $filesystem */
239 270
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
240 271
 
241
-        try {
272
+        try
273
+        {
242 274
             $filesystem->writeStream($path, $content, $config);
243 275
 
244 276
             return $uri;
245
-        } catch (FilesystemException $e) {
277
+        }
278
+        catch (FilesystemException $e)
279
+        {
246 280
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
247 281
         }
248 282
     }
@@ -255,9 +289,12 @@  discard block
 block discarded – undo
255 289
         /** @var FilesystemOperator $filesystem */
256 290
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
257 291
 
258
-        try {
292
+        try
293
+        {
259 294
             $filesystem->setVisibility($path, $visibility);
260
-        } catch (FilesystemException $e) {
295
+        }
296
+        catch (FilesystemException $e)
297
+        {
261 298
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
262 299
         }
263 300
     }
@@ -276,7 +313,8 @@  discard block
 block discarded – undo
276 313
 
277 314
         $destinationFilesystem = $this->getFileSystem($destinationFileSystem);
278 315
 
279
-        try {
316
+        try
317
+        {
280 318
             $targetFilePath = $targetFilePath ?: $sourcePath;
281 319
 
282 320
             $sourceFilesystem === $destinationFilesystem
@@ -284,7 +322,9 @@  discard block
 block discarded – undo
284 322
                 : $this->moveAcrossFilesystems($sourceUri, $destinationFileSystem, $targetFilePath, $config);
285 323
 
286 324
             return (string)Uri::create($destinationFileSystem, $targetFilePath);
287
-        } catch (FilesystemException $e) {
325
+        }
326
+        catch (FilesystemException $e)
327
+        {
288 328
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
289 329
         }
290 330
     }
@@ -303,7 +343,8 @@  discard block
 block discarded – undo
303 343
 
304 344
         $destinationFilesystem = $this->getFileSystem($destinationFileSystem);
305 345
 
306
-        try {
346
+        try
347
+        {
307 348
             $targetFilePath = $targetFilePath ?: $sourcePath;
308 349
 
309 350
             $sourceFilesystem === $destinationFilesystem
@@ -318,7 +359,9 @@  discard block
 block discarded – undo
318 359
                 );
319 360
 
320 361
             return (string)Uri::create($destinationFileSystem, $targetFilePath);
321
-        } catch (FilesystemException $e) {
362
+        }
363
+        catch (FilesystemException $e)
364
+        {
322 365
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
323 366
         }
324 367
     }
@@ -331,9 +374,12 @@  discard block
 block discarded – undo
331 374
         /** @var FilesystemOperator $filesystem */
332 375
         [$filesystem, $path] = $this->determineFilesystemAndPath($uri);
333 376
 
334
-        try {
377
+        try
378
+        {
335 379
             $filesystem->delete($path);
336
-        } catch (FilesystemException $e) {
380
+        }
381
+        catch (FilesystemException $e)
382
+        {
337 383
             throw new FileOperationException($e->getMessage(), (int)$e->getCode(), $e);
338 384
         }
339 385
     }
@@ -349,7 +395,8 @@  discard block
 block discarded – undo
349 395
      */
350 396
     protected function mountFilesystem(string $key, FilesystemOperator $filesystem): void
351 397
     {
352
-        if ($this->isFileSystemExists($key)) {
398
+        if ($this->isFileSystemExists($key))
399
+        {
353 400
             throw new MountException(\sprintf('Filesystem %s is already mounted', $key));
354 401
         }
355 402
 
@@ -454,7 +501,8 @@  discard block
 block discarded – undo
454 501
         string $destinationPath,
455 502
         array $config = []
456 503
     ): void {
457
-        if ($sourcePath === $destinationPath && empty($config)) {
504
+        if ($sourcePath === $destinationPath && empty($config))
505
+        {
458 506
             return;
459 507
         }
460 508
 
Please login to merge, or discard this patch.
src/storage/src/Parser/UriParser.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      * @var string
21 21
      */
22 22
     private const ERROR_INVALID_URI_TYPE =
23
-        'URI argument must be a string-like ' .
23
+        'URI argument must be a string-like '.
24 24
         'or instance of one of [%s], but %s passed'
25 25
     ;
26 26
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function parse($uri): UriInterface
31 31
     {
32
-        switch (true) {
32
+        switch (true){
33 33
             case $uri instanceof UriInterface:
34 34
                 return $uri;
35 35
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@
 block discarded – undo
29 29
      */
30 30
     public function parse($uri): UriInterface
31 31
     {
32
-        switch (true) {
32
+        switch (true)
33
+        {
33 34
             case $uri instanceof UriInterface:
34 35
                 return $uri;
35 36
 
Please login to merge, or discard this patch.
src/storage/src/Parser/Uri.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function __toString(): string
53 53
     {
54
-        return $this->getFileSystem() . self::SCHEME_PATH_DELIMITER . $this->getPath();
54
+        return $this->getFileSystem().self::SCHEME_PATH_DELIMITER.$this->getPath();
55 55
     }
56 56
 
57 57
     /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function setFileSystem(string $fs): void
111 111
     {
112
-        if ($fs === '') {
112
+        if ($fs === ''){
113 113
             throw new UriException('Filesystem name can not be empty');
114 114
         }
115 115
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $path = \str_replace(['\\', '/'], self::PATH_DELIMITER, $path);
126 126
         $path = \trim(\trim($path), self::PATH_DELIMITER);
127 127
 
128
-        if ($path === '') {
128
+        if ($path === ''){
129 129
             throw new UriException('Filesystem pathname can not be empty');
130 130
         }
131 131
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,8 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function setFileSystem(string $fs): void
111 111
     {
112
-        if ($fs === '') {
112
+        if ($fs === '')
113
+        {
113 114
             throw new UriException('Filesystem name can not be empty');
114 115
         }
115 116
 
@@ -125,7 +126,8 @@  discard block
 block discarded – undo
125 126
         $path = \str_replace(['\\', '/'], self::PATH_DELIMITER, $path);
126 127
         $path = \trim(\trim($path), self::PATH_DELIMITER);
127 128
 
128
-        if ($path === '') {
129
+        if ($path === '')
130
+        {
129 131
             throw new UriException('Filesystem pathname can not be empty');
130 132
         }
131 133
 
Please login to merge, or discard this patch.
src/storage/src/UriResolver.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function resolveAll(iterable $uris): iterable
58 58
     {
59
-        foreach ($uris as $uri) {
59
+        foreach ($uris as $uri){
60 60
             yield $this->resolve($uri);
61 61
         }
62 62
     }
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function resolve($uri)
68 68
     {
69
-        try {
69
+        try{
70 70
             $uri = $this->parser->parse($uri);
71 71
 
72 72
             return $this->getResolver($uri->getFileSystem())
73 73
                 ->buildUrl($uri->getPath())
74 74
             ;
75
-        } catch (StorageException $e) {
75
+        }catch (StorageException $e){
76 76
             throw $e;
77
-        } catch (\Throwable $e) {
77
+        }catch (\Throwable $e){
78 78
             throw new ResolveException($e->getMessage(), (int)$e->getCode(), $e);
79 79
         }
80 80
     }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     protected function getResolver(string $fileSystem): AdapterResolverInterface
92 92
     {
93
-        if (!\array_key_exists($fileSystem, $this->resolvers)) {
93
+        if (!\array_key_exists($fileSystem, $this->resolvers)){
94 94
             $this->resolvers[$fileSystem] = $this->prepareResolverForFileSystem(
95 95
                 $this->config->buildFileSystemInfo($fileSystem)
96 96
             );
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function resolveAll(iterable $uris): iterable
58 58
     {
59
-        foreach ($uris as $uri) {
59
+        foreach ($uris as $uri)
60
+        {
60 61
             yield $this->resolve($uri);
61 62
         }
62 63
     }
@@ -66,15 +67,20 @@  discard block
 block discarded – undo
66 67
      */
67 68
     public function resolve($uri)
68 69
     {
69
-        try {
70
+        try
71
+        {
70 72
             $uri = $this->parser->parse($uri);
71 73
 
72 74
             return $this->getResolver($uri->getFileSystem())
73 75
                 ->buildUrl($uri->getPath())
74 76
             ;
75
-        } catch (StorageException $e) {
77
+        }
78
+        catch (StorageException $e)
79
+        {
76 80
             throw $e;
77
-        } catch (\Throwable $e) {
81
+        }
82
+        catch (\Throwable $e)
83
+        {
78 84
             throw new ResolveException($e->getMessage(), (int)$e->getCode(), $e);
79 85
         }
80 86
     }
@@ -90,7 +96,8 @@  discard block
 block discarded – undo
90 96
      */
91 97
     protected function getResolver(string $fileSystem): AdapterResolverInterface
92 98
     {
93
-        if (!\array_key_exists($fileSystem, $this->resolvers)) {
99
+        if (!\array_key_exists($fileSystem, $this->resolvers))
100
+        {
94 101
             $this->resolvers[$fileSystem] = $this->prepareResolverForFileSystem(
95 102
                 $this->config->buildFileSystemInfo($fileSystem)
96 103
             );
Please login to merge, or discard this patch.
src/storage/src/Builder/AdapterFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $builder = static::detectAdapterBuilder($info);
33 33
 
34
-        if ($info->isAdvancedUsage()) {
34
+        if ($info->isAdvancedUsage()){
35 35
             return $builder->buildAdvanced();
36 36
         }
37 37
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     private static function detectAdapterBuilder(
51 51
         FileSystemInfo\FileSystemInfoInterface $info
52 52
     ): AdapterBuilder\AdapterBuilderInterface {
53
-        switch (get_class($info)) {
53
+        switch (get_class($info)){
54 54
             case FileSystemInfo\LocalInfo::class:
55 55
                 return new AdapterBuilder\LocalBuilder($info);
56 56
             case FileSystemInfo\Aws\AwsS3Info::class:
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $builder = static::detectAdapterBuilder($info);
33 33
 
34
-        if ($info->isAdvancedUsage()) {
34
+        if ($info->isAdvancedUsage())
35
+        {
35 36
             return $builder->buildAdvanced();
36 37
         }
37 38
 
@@ -50,7 +51,8 @@  discard block
 block discarded – undo
50 51
     private static function detectAdapterBuilder(
51 52
         FileSystemInfo\FileSystemInfoInterface $info
52 53
     ): AdapterBuilder\AdapterBuilderInterface {
53
-        switch (get_class($info)) {
54
+        switch (get_class($info))
55
+        {
54 56
             case FileSystemInfo\LocalInfo::class:
55 57
                 return new AdapterBuilder\LocalBuilder($info);
56 58
             case FileSystemInfo\Aws\AwsS3Info::class:
Please login to merge, or discard this patch.