Passed
Pull Request — master (#407)
by Kirill
09:34 queued 04:36
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/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
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.
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->getStorage() . self::SCHEME_PATH_DELIMITER . $this->getPath();
54
+        return $this->getStorage().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.
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.
src/Framework/Bootloader/StorageBootloader.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
41 41
 
42 42
         $app->bindSingleton(UriResolverInterface::class, $this->uriResolverRegistrar());
43
-        $app->bindSingleton(UriResolver::class, static function (UriResolverInterface $resolver) {
43
+        $app->bindSingleton(UriResolver::class, static function (UriResolverInterface $resolver){
44 44
             return $resolver;
45 45
         });
46 46
 
47 47
         $app->bindSingleton(StorageInterface::class, $this->storageRegistrar());
48
-        $app->bindSingleton(Storage::class, static function (StorageInterface $storage) {
48
+        $app->bindSingleton(Storage::class, static function (StorageInterface $storage){
49 49
             return $storage;
50 50
         });
51 51
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     private function storageRegistrar(): \Closure
57 57
     {
58
-        return static function (StorageConfig $config, UriParserInterface $parser) {
58
+        return static function (StorageConfig $config, UriParserInterface $parser){
59 59
             return new Storage($config, $parser);
60 60
         };
61 61
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     private function uriResolverRegistrar(): \Closure
67 67
     {
68
-        return static function (StorageConfig $config, UriParserInterface $parser) {
68
+        return static function (StorageConfig $config, UriParserInterface $parser){
69 69
             return new UriResolver($config, $parser);
70 70
         };
71 71
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,12 +40,14 @@  discard block
 block discarded – undo
40 40
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
41 41
 
42 42
         $app->bindSingleton(UriResolverInterface::class, $this->uriResolverRegistrar());
43
-        $app->bindSingleton(UriResolver::class, static function (UriResolverInterface $resolver) {
43
+        $app->bindSingleton(UriResolver::class, static function (UriResolverInterface $resolver)
44
+        {
44 45
             return $resolver;
45 46
         });
46 47
 
47 48
         $app->bindSingleton(StorageInterface::class, $this->storageRegistrar());
48
-        $app->bindSingleton(Storage::class, static function (StorageInterface $storage) {
49
+        $app->bindSingleton(Storage::class, static function (StorageInterface $storage)
50
+        {
49 51
             return $storage;
50 52
         });
51 53
     }
@@ -55,7 +57,8 @@  discard block
 block discarded – undo
55 57
      */
56 58
     private function storageRegistrar(): \Closure
57 59
     {
58
-        return static function (StorageConfig $config, UriParserInterface $parser) {
60
+        return static function (StorageConfig $config, UriParserInterface $parser)
61
+        {
59 62
             return new Storage($config, $parser);
60 63
         };
61 64
     }
@@ -65,7 +68,8 @@  discard block
 block discarded – undo
65 68
      */
66 69
     private function uriResolverRegistrar(): \Closure
67 70
     {
68
-        return static function (StorageConfig $config, UriParserInterface $parser) {
71
+        return static function (StorageConfig $config, UriParserInterface $parser)
72
+        {
69 73
             return new UriResolver($config, $parser);
70 74
         };
71 75
     }
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::STORAGES_KEY])) {
310
+        if (!isset($config[self::STORAGES_KEY])){
311 311
             $config[self::STORAGES_KEY] = [];
312 312
 
313 313
             return $config;
@@ -315,20 +315,20 @@  discard block
 block discarded – undo
315 315
 
316 316
         $buckets = $config[self::STORAGES_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::STORAGES_KEY])) {
323
+        if (!isset($config[self::STORAGES_KEY]))
324
+        {
311 325
             $config[self::STORAGES_KEY] = [];
312 326
 
313 327
             return $config;
@@ -315,20 +329,24 @@  discard block
 block discarded – undo
315 329
 
316 330
         $buckets = $config[self::STORAGES_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.