| @@ -71,8 +71,8 @@ discard block | ||
| 71 | 71 | */ | 
| 72 | 72 | private function bootResolvers(array $config): void | 
| 73 | 73 |      { | 
| 74 | -        foreach ($config['resolvers'] ?? [] as $name => $child) { | |
| 75 | -            if (!\is_string($name)) { | |
| 74 | +        foreach ($config['resolvers'] ?? [] as $name => $child){ | |
| 75 | +            if (!\is_string($name)){ | |
| 76 | 76 | throw new InvalidArgumentException( | 
| 77 | 77 |                      \vsprintf('Distribution driver config key must be a string, but %s given', [ | 
| 78 | 78 | \get_debug_type($child), | 
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | ); | 
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | -            if (!\is_array($child)) { | |
| 83 | +            if (!\is_array($child)){ | |
| 84 | 84 | throw new InvalidArgumentException( | 
| 85 | 85 |                      \vsprintf('Distribution driver config `%s` must be an array, but %s given', [ | 
| 86 | 86 | $name, | 
| @@ -100,9 +100,9 @@ discard block | ||
| 100 | 100 |      { | 
| 101 | 101 | $default = $config['default'] ?? null; | 
| 102 | 102 | |
| 103 | -        if ($default !== null) { | |
| 103 | +        if ($default !== null){ | |
| 104 | 104 | // Validate config | 
| 105 | -            if (!\is_string($default)) { | |
| 105 | +            if (!\is_string($default)){ | |
| 106 | 106 | throw new InvalidArgumentException( | 
| 107 | 107 |                      \vsprintf('Distribution config default driver must be a string, but %s given', [ | 
| 108 | 108 | \get_debug_type($default), | 
| @@ -121,13 +121,13 @@ discard block | ||
| 121 | 121 | */ | 
| 122 | 122 | private function createResolver(string $name, array $config): UriResolverInterface | 
| 123 | 123 |      { | 
| 124 | -        if (!isset($config['type']) || !\is_string($config['type'])) { | |
| 124 | +        if (!isset($config['type']) || !\is_string($config['type'])){ | |
| 125 | 125 | throw $this->invalidConfigKey($name, 'type', 'string'); | 
| 126 | 126 | } | 
| 127 | 127 | |
| 128 | 128 | $type = $config['type']; | 
| 129 | 129 | |
| 130 | -        switch ($type) { | |
| 130 | +        switch ($type){ | |
| 131 | 131 | case 'static': | 
| 132 | 132 | return $this->createStaticResolver($name, $config); | 
| 133 | 133 | |
| @@ -150,17 +150,17 @@ discard block | ||
| 150 | 150 | */ | 
| 151 | 151 | private function createCustomResolver(string $type, string $name, array $config): UriResolverInterface | 
| 152 | 152 |      { | 
| 153 | -        if (!\is_subclass_of($type, UriResolverInterface::class, true)) { | |
| 153 | +        if (!\is_subclass_of($type, UriResolverInterface::class, true)){ | |
| 154 | 154 | throw $this->invalidConfigKey($name, 'type', UriResolverInterface::class); | 
| 155 | 155 | } | 
| 156 | 156 | |
| 157 | -        if (isset($config['options']) && !\is_array($config['options'])) { | |
| 157 | +        if (isset($config['options']) && !\is_array($config['options'])){ | |
| 158 | 158 | throw $this->invalidConfigKey($name, 'options', 'array'); | 
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | -        try { | |
| 161 | +        try{ | |
| 162 | 162 | return new $type(...\array_values($config['options'] ?? [])); | 
| 163 | -        } catch (\Throwable $e) { | |
| 163 | +        }catch (\Throwable $e){ | |
| 164 | 164 | $message = 'An error occurred while resolver `%s` initializing: %s'; | 
| 165 | 165 | throw new InvalidArgumentException(\sprintf($message, $name, $e->getMessage()), 0, $e); | 
| 166 | 166 | } | 
| @@ -174,32 +174,32 @@ discard block | ||
| 174 | 174 | private function createS3Resolver(string $name, array $config): UriResolverInterface | 
| 175 | 175 |      { | 
| 176 | 176 | // Required config options | 
| 177 | -        if (!isset($config['region']) || !\is_string($config['region'])) { | |
| 177 | +        if (!isset($config['region']) || !\is_string($config['region'])){ | |
| 178 | 178 | throw $this->invalidConfigKey($name, 'region', 'string'); | 
| 179 | 179 | } | 
| 180 | 180 | |
| 181 | -        if (!isset($config['key']) || !\is_string($config['key'])) { | |
| 181 | +        if (!isset($config['key']) || !\is_string($config['key'])){ | |
| 182 | 182 | throw $this->invalidConfigKey($name, 'key', 'string'); | 
| 183 | 183 | } | 
| 184 | 184 | |
| 185 | -        if (!isset($config['secret']) || !\is_string($config['secret'])) { | |
| 185 | +        if (!isset($config['secret']) || !\is_string($config['secret'])){ | |
| 186 | 186 | throw $this->invalidConfigKey($name, 'secret', 'string'); | 
| 187 | 187 | } | 
| 188 | 188 | |
| 189 | -        if (!isset($config['bucket']) || !\is_string($config['bucket'])) { | |
| 189 | +        if (!isset($config['bucket']) || !\is_string($config['bucket'])){ | |
| 190 | 190 | throw $this->invalidConfigKey($name, 'bucket', 'string'); | 
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | 193 | // Optional config options | 
| 194 | -        if (!\is_string($config['version'] ?? '')) { | |
| 194 | +        if (!\is_string($config['version'] ?? '')){ | |
| 195 | 195 | throw $this->invalidConfigKey($name, 'version', 'string or null'); | 
| 196 | 196 | } | 
| 197 | 197 | |
| 198 | -        if (!\is_string($config['token'] ?? '')) { | |
| 198 | +        if (!\is_string($config['token'] ?? '')){ | |
| 199 | 199 | throw $this->invalidConfigKey($name, 'token', 'string or null'); | 
| 200 | 200 | } | 
| 201 | 201 | |
| 202 | -        if (!\is_int($config['expires'] ?? 0)) { | |
| 202 | +        if (!\is_int($config['expires'] ?? 0)){ | |
| 203 | 203 | throw $this->invalidConfigKey($name, 'expires', 'positive int (unix timestamp)'); | 
| 204 | 204 | } | 
| 205 | 205 | |
| @@ -213,7 +213,7 @@ discard block | ||
| 213 | 213 | $config['token'] ?? null, | 
| 214 | 214 | $config['expires'] ?? null | 
| 215 | 215 | ), | 
| 216 | - ]+ ($config['options'] ?? [])); | |
| 216 | + ] + ($config['options'] ?? [])); | |
| 217 | 217 | |
| 218 | 218 | return new S3SignedResolver($client, $config['bucket']); | 
| 219 | 219 | } | 
| @@ -225,15 +225,15 @@ discard block | ||
| 225 | 225 | */ | 
| 226 | 226 | private function createCloudFrontResolver(string $name, array $config): UriResolverInterface | 
| 227 | 227 |      { | 
| 228 | -        if (!isset($config['key']) || !\is_string($config['key'])) { | |
| 228 | +        if (!isset($config['key']) || !\is_string($config['key'])){ | |
| 229 | 229 | throw $this->invalidConfigKey($name, 'key', 'string'); | 
| 230 | 230 | } | 
| 231 | 231 | |
| 232 | -        if (!isset($config['private']) || !\is_string($config['private'])) { | |
| 232 | +        if (!isset($config['private']) || !\is_string($config['private'])){ | |
| 233 | 233 | throw $this->invalidConfigKey($name, 'private', 'string value or path to key file'); | 
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | -        if (!isset($config['domain']) || !\is_string($config['domain'])) { | |
| 236 | +        if (!isset($config['domain']) || !\is_string($config['domain'])){ | |
| 237 | 237 | throw $this->invalidConfigKey($name, 'domain', 'string'); | 
| 238 | 238 | } | 
| 239 | 239 | |
| @@ -251,7 +251,7 @@ discard block | ||
| 251 | 251 | */ | 
| 252 | 252 | private function createStaticResolver(string $name, array $config): UriResolverInterface | 
| 253 | 253 |      { | 
| 254 | -        if (!isset($config['uri']) || !\is_string($config['uri'])) { | |
| 254 | +        if (!isset($config['uri']) || !\is_string($config['uri'])){ | |
| 255 | 255 | throw $this->invalidConfigKey($name, 'uri', 'string'); | 
| 256 | 256 | } | 
| 257 | 257 | |
| @@ -266,17 +266,17 @@ discard block | ||
| 266 | 266 | */ | 
| 267 | 267 | private function createUri(string $name, string $uri, array $config): UriInterface | 
| 268 | 268 |      { | 
| 269 | -        if (!\is_string($config['factory'] ?? '')) { | |
| 269 | +        if (!\is_string($config['factory'] ?? '')){ | |
| 270 | 270 | throw $this->invalidConfigKey($name, 'factory', 'string (PSR-7 uri factory implementation)'); | 
| 271 | 271 | } | 
| 272 | 272 | |
| 273 | -        switch (true) { | |
| 273 | +        switch (true){ | |
| 274 | 274 | case isset($config['factory']): | 
| 275 | 275 | /** @var UriFactoryInterface $factory */ | 
| 276 | 276 | $factory = new $config['factory'](); | 
| 277 | 277 | |
| 278 | -                if (!$factory instanceof UriFactoryInterface) { | |
| 279 | - $message = 'Distribution config driver `%s` should contain class that must be a valid PSR-7 ' . | |
| 278 | +                if (!$factory instanceof UriFactoryInterface){ | |
| 279 | + $message = 'Distribution config driver `%s` should contain class that must be a valid PSR-7 '. | |
| 280 | 280 | 'uri factory implementation, but `%s` given'; | 
| 281 | 281 | throw new InvalidArgumentException(\sprintf($message, $name, $config['factory'])); | 
| 282 | 282 | } | 
| @@ -290,7 +290,7 @@ discard block | ||
| 290 | 290 | return new GuzzleUri($uri); | 
| 291 | 291 | |
| 292 | 292 | default: | 
| 293 | - $message = 'Can not resolve available PSR-7 UriFactory implementation; ' . | |
| 293 | + $message = 'Can not resolve available PSR-7 UriFactory implementation; '. | |
| 294 | 294 | 'Please define `factory` config section in `%s` distribution driver config'; | 
| 295 | 295 | throw new InvalidArgumentException(\sprintf($message, $name)); | 
| 296 | 296 | } |