Passed
Pull Request — master (#407)
by Kirill
06:59
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/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.
src/storage/src/Builder/Adapter/AbstractBuilder.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     {
36 36
         $requiredClass = static::FILE_SYSTEM_INFO_CLASS;
37 37
 
38
-        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass) {
38
+        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass){
39 39
             throw new StorageException(
40 40
                 \sprintf('Wrong filesystem info `%s` provided for `%s`', get_class($fsInfo), static::class)
41 41
             );
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@
 block discarded – undo
35 35
     {
36 36
         $requiredClass = static::FILE_SYSTEM_INFO_CLASS;
37 37
 
38
-        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass) {
38
+        if (empty($requiredClass) || !$fsInfo instanceof $requiredClass)
39
+        {
39 40
             throw new StorageException(
40 41
                 \sprintf('Wrong filesystem info `%s` provided for `%s`', get_class($fsInfo), static::class)
41 42
             );
Please login to merge, or discard this patch.