Passed
Pull Request — master (#407)
by Kirill
09:17 queued 03:56
created
src/Framework/Bootloader/Storage/StorageConfig.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function bootStorages(array $config): void
102 102
     {
103
-        foreach ($config['buckets'] as $name => $bucket) {
104
-            if (!\is_string($name)) {
103
+        foreach ($config['buckets'] as $name => $bucket){
104
+            if (!\is_string($name)){
105 105
                 throw new InvalidArgumentException(
106 106
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
107 107
                         \get_debug_type($name),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
 
112 112
             $serverName = $bucket['server'] ?? null;
113
-            if (!\is_string($serverName)) {
113
+            if (!\is_string($serverName)){
114 114
                 throw new InvalidArgumentException(
115 115
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
116 116
                         $name,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             }
121 121
 
122 122
             $server = $config['servers'][$serverName] ?? null;
123
-            if (!\is_array($server)) {
123
+            if (!\is_array($server)){
124 124
                 throw new InvalidArgumentException(
125 125
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
126 126
                         $name,
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             }
131 131
 
132 132
             $adapter = $server['adapter'] ?? null;
133
-            if (!\is_string($adapter)) {
133
+            if (!\is_string($adapter)){
134 134
                 throw new InvalidArgumentException(
135 135
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
136 136
                         $serverName,
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
             $this->adapters[$name] = $adapter;
145 145
 
146
-            if (isset($bucket['cdn'])) {
146
+            if (isset($bucket['cdn'])){
147 147
                 $this->distributions[$name] = $bucket['cdn'];
148 148
             }
149 149
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
159 159
     {
160
-        switch ($server['adapter']) {
160
+        switch ($server['adapter']){
161 161
             case 'local':
162 162
                 return $this->createLocalAdapter($serverName, $bucket, $server);
163 163
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 
195 195
         $bucket = $bucket['bucket'] ?? $server['bucket'];
196 196
 
197
-        if ($async) {
198
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
197
+        if ($async){
198
+            if (!\class_exists(AsyncAwsS3Adapter::class)){
199 199
                 throw new InvalidArgumentException(
200 200
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
201 201
                 );
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             );
208 208
         }
209 209
 
210
-        if (!\class_exists(AwsS3V3Adapter::class)) {
210
+        if (!\class_exists(AwsS3V3Adapter::class)){
211 211
             throw new InvalidArgumentException(
212 212
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
213 213
             );
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
229 229
     {
230
-        if (!\is_string($server['directory'] ?? null)) {
230
+        if (!\is_string($server['directory'] ?? null)){
231 231
             throw new InvalidArgumentException(
232 232
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
233 233
                     $serverName,
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $adapter = $server['adapter'];
263 263
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
264 264
 
265
-        if (!$isFilesystemAdapter) {
265
+        if (!$isFilesystemAdapter){
266 266
             throw new InvalidArgumentException(
267 267
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
268 268
                     $serverName,
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
             );
273 273
         }
274 274
 
275
-        try {
275
+        try{
276 276
             return new $adapter(...\array_values($server['options'] ?? []));
277
-        } catch (\Throwable $e) {
277
+        }catch (\Throwable $e){
278 278
             $message = 'An error occurred while server `%s` initializing: %s';
279 279
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
280 280
         }
Please login to merge, or discard this patch.
Braces   +29 added lines, -14 removed lines patch added patch discarded remove patch
@@ -100,8 +100,10 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function bootStorages(array $config): void
102 102
     {
103
-        foreach ($config['buckets'] as $name => $bucket) {
104
-            if (!\is_string($name)) {
103
+        foreach ($config['buckets'] as $name => $bucket)
104
+        {
105
+            if (!\is_string($name))
106
+            {
105 107
                 throw new InvalidArgumentException(
106 108
                     \vsprintf('Storage bucket config key must be a string, but %s defined', [
107 109
                         \get_debug_type($name),
@@ -110,7 +112,8 @@  discard block
 block discarded – undo
110 112
             }
111 113
 
112 114
             $serverName = $bucket['server'] ?? null;
113
-            if (!\is_string($serverName)) {
115
+            if (!\is_string($serverName))
116
+            {
114 117
                 throw new InvalidArgumentException(
115 118
                     \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [
116 119
                         $name,
@@ -120,7 +123,8 @@  discard block
 block discarded – undo
120 123
             }
121 124
 
122 125
             $server = $config['servers'][$serverName] ?? null;
123
-            if (!\is_array($server)) {
126
+            if (!\is_array($server))
127
+            {
124 128
                 throw new InvalidArgumentException(
125 129
                     \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [
126 130
                         $name,
@@ -130,7 +134,8 @@  discard block
 block discarded – undo
130 134
             }
131 135
 
132 136
             $adapter = $server['adapter'] ?? null;
133
-            if (!\is_string($adapter)) {
137
+            if (!\is_string($adapter))
138
+            {
134 139
                 throw new InvalidArgumentException(
135 140
                     \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [
136 141
                         $serverName,
@@ -143,7 +148,8 @@  discard block
 block discarded – undo
143 148
 
144 149
             $this->adapters[$name] = $adapter;
145 150
 
146
-            if (isset($bucket['cdn'])) {
151
+            if (isset($bucket['cdn']))
152
+            {
147 153
                 $this->distributions[$name] = $bucket['cdn'];
148 154
             }
149 155
         }
@@ -157,7 +163,8 @@  discard block
 block discarded – undo
157 163
      */
158 164
     private function createAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
159 165
     {
160
-        switch ($server['adapter']) {
166
+        switch ($server['adapter'])
167
+        {
161 168
             case 'local':
162 169
                 return $this->createLocalAdapter($serverName, $bucket, $server);
163 170
 
@@ -194,8 +201,10 @@  discard block
 block discarded – undo
194 201
 
195 202
         $bucket = $bucket['bucket'] ?? $server['bucket'];
196 203
 
197
-        if ($async) {
198
-            if (!\class_exists(AsyncAwsS3Adapter::class)) {
204
+        if ($async)
205
+        {
206
+            if (!\class_exists(AsyncAwsS3Adapter::class))
207
+            {
199 208
                 throw new InvalidArgumentException(
200 209
                     'Can not create async S3 client, please install "league/flysystem-async-aws-s3"'
201 210
                 );
@@ -207,7 +216,8 @@  discard block
 block discarded – undo
207 216
             );
208 217
         }
209 218
 
210
-        if (!\class_exists(AwsS3V3Adapter::class)) {
219
+        if (!\class_exists(AwsS3V3Adapter::class))
220
+        {
211 221
             throw new InvalidArgumentException(
212 222
                 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"'
213 223
             );
@@ -227,7 +237,8 @@  discard block
 block discarded – undo
227 237
      */
228 238
     private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter
229 239
     {
230
-        if (!\is_string($server['directory'] ?? null)) {
240
+        if (!\is_string($server['directory'] ?? null))
241
+        {
231 242
             throw new InvalidArgumentException(
232 243
                 \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [
233 244
                     $serverName,
@@ -262,7 +273,8 @@  discard block
 block discarded – undo
262 273
         $adapter = $server['adapter'];
263 274
         $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true);
264 275
 
265
-        if (!$isFilesystemAdapter) {
276
+        if (!$isFilesystemAdapter)
277
+        {
266 278
             throw new InvalidArgumentException(
267 279
                 \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [
268 280
                     $serverName,
@@ -272,9 +284,12 @@  discard block
 block discarded – undo
272 284
             );
273 285
         }
274 286
 
275
-        try {
287
+        try
288
+        {
276 289
             return new $adapter(...\array_values($server['options'] ?? []));
277
-        } catch (\Throwable $e) {
290
+        }
291
+        catch (\Throwable $e)
292
+        {
278 293
             $message = 'An error occurred while server `%s` initializing: %s';
279 294
             throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e);
280 295
         }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Storage/StorageBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
33 33
 
34
-        $app->bindSingleton(ManagerInterface::class, static function (StorageConfig $config, CdnInterface $cdn) {
34
+        $app->bindSingleton(ManagerInterface::class, static function (StorageConfig $config, CdnInterface $cdn){
35 35
             $manager = new Manager($config->getDefaultBucket());
36 36
 
37 37
             $distributions = $config->getDistributions();
38 38
 
39
-            foreach ($config->getAdapters() as $name => $adapter) {
39
+            foreach ($config->getAdapters() as $name => $adapter){
40 40
                 $resolver = isset($distributions[$name])
41 41
                     ? $cdn->resolver($distributions[$name])
42 42
                     : null;
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
             return $manager;
48 48
         });
49 49
 
50
-        $app->bindSingleton(Manager::class, static function (ManagerInterface $manager) {
50
+        $app->bindSingleton(Manager::class, static function (ManagerInterface $manager){
51 51
             return $manager;
52 52
         });
53 53
 
54
-        $app->bindSingleton(StorageInterface::class, static function (ManagerInterface $manager) {
54
+        $app->bindSingleton(StorageInterface::class, static function (ManagerInterface $manager){
55 55
             return $manager->storage();
56 56
         });
57 57
 
58
-        $app->bindSingleton(Storage::class, static function (StorageInterface $storage) {
58
+        $app->bindSingleton(Storage::class, static function (StorageInterface $storage){
59 59
             return $storage;
60 60
         });
61 61
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,12 +31,14 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $app->bindInjector(StorageConfig::class, ConfiguratorInterface::class);
33 33
 
34
-        $app->bindSingleton(ManagerInterface::class, static function (StorageConfig $config, CdnInterface $cdn) {
34
+        $app->bindSingleton(ManagerInterface::class, static function (StorageConfig $config, CdnInterface $cdn)
35
+        {
35 36
             $manager = new Manager($config->getDefaultBucket());
36 37
 
37 38
             $distributions = $config->getDistributions();
38 39
 
39
-            foreach ($config->getAdapters() as $name => $adapter) {
40
+            foreach ($config->getAdapters() as $name => $adapter)
41
+            {
40 42
                 $resolver = isset($distributions[$name])
41 43
                     ? $cdn->resolver($distributions[$name])
42 44
                     : null;
@@ -47,15 +49,18 @@  discard block
 block discarded – undo
47 49
             return $manager;
48 50
         });
49 51
 
50
-        $app->bindSingleton(Manager::class, static function (ManagerInterface $manager) {
52
+        $app->bindSingleton(Manager::class, static function (ManagerInterface $manager)
53
+        {
51 54
             return $manager;
52 55
         });
53 56
 
54
-        $app->bindSingleton(StorageInterface::class, static function (ManagerInterface $manager) {
57
+        $app->bindSingleton(StorageInterface::class, static function (ManagerInterface $manager)
58
+        {
55 59
             return $manager->storage();
56 60
         });
57 61
 
58
-        $app->bindSingleton(Storage::class, static function (StorageInterface $storage) {
62
+        $app->bindSingleton(Storage::class, static function (StorageInterface $storage)
63
+        {
59 64
             return $storage;
60 65
         });
61 66
     }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Distribution/DistributionBootloader.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
      */
55 55
     private function registerResolver(Container $app): void
56 56
     {
57
-        $app->bindSingleton(ResolverInterface::class, static function (ManagerInterface $manager) {
57
+        $app->bindSingleton(ResolverInterface::class, static function (ManagerInterface $manager){
58 58
             return $manager->resolver();
59 59
         });
60 60
 
61
-        $app->bindSingleton(Resolver::class, static function (Container $app) {
61
+        $app->bindSingleton(Resolver::class, static function (Container $app){
62 62
             return $app->get(ResolverInterface::class);
63 63
         });
64 64
     }
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
      */
69 69
     private function registerManager(Container $app): void
70 70
     {
71
-        $app->bindSingleton(ManagerInterface::class, static function (DistributionConfig $config) {
71
+        $app->bindSingleton(ManagerInterface::class, static function (DistributionConfig $config){
72 72
             $manager = new Manager($config->getDefaultDriver());
73 73
 
74
-            foreach ($config->getResolvers() as $name => $resolver) {
74
+            foreach ($config->getResolvers() as $name => $resolver){
75 75
                 $manager->add($name, $resolver);
76 76
             }
77 77
 
78 78
             return $manager;
79 79
         });
80 80
 
81
-        $app->bindSingleton(MutableManagerInterface::class, static function (Container $app) {
81
+        $app->bindSingleton(MutableManagerInterface::class, static function (Container $app){
82 82
             return $app->get(ManagerInterface::class);
83 83
         });
84 84
 
85
-        $app->bindSingleton(Manager::class, static function (Container $app) {
85
+        $app->bindSingleton(Manager::class, static function (Container $app){
86 86
             return $app->get(ManagerInterface::class);
87 87
         });
88 88
     }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,11 +54,13 @@  discard block
 block discarded – undo
54 54
      */
55 55
     private function registerResolver(Container $app): void
56 56
     {
57
-        $app->bindSingleton(ResolverInterface::class, static function (ManagerInterface $manager) {
57
+        $app->bindSingleton(ResolverInterface::class, static function (ManagerInterface $manager)
58
+        {
58 59
             return $manager->resolver();
59 60
         });
60 61
 
61
-        $app->bindSingleton(Resolver::class, static function (Container $app) {
62
+        $app->bindSingleton(Resolver::class, static function (Container $app)
63
+        {
62 64
             return $app->get(ResolverInterface::class);
63 65
         });
64 66
     }
@@ -68,21 +70,25 @@  discard block
 block discarded – undo
68 70
      */
69 71
     private function registerManager(Container $app): void
70 72
     {
71
-        $app->bindSingleton(ManagerInterface::class, static function (DistributionConfig $config) {
73
+        $app->bindSingleton(ManagerInterface::class, static function (DistributionConfig $config)
74
+        {
72 75
             $manager = new Manager($config->getDefaultDriver());
73 76
 
74
-            foreach ($config->getResolvers() as $name => $resolver) {
77
+            foreach ($config->getResolvers() as $name => $resolver)
78
+            {
75 79
                 $manager->add($name, $resolver);
76 80
             }
77 81
 
78 82
             return $manager;
79 83
         });
80 84
 
81
-        $app->bindSingleton(MutableManagerInterface::class, static function (Container $app) {
85
+        $app->bindSingleton(MutableManagerInterface::class, static function (Container $app)
86
+        {
82 87
             return $app->get(ManagerInterface::class);
83 88
         });
84 89
 
85
-        $app->bindSingleton(Manager::class, static function (Container $app) {
90
+        $app->bindSingleton(Manager::class, static function (Container $app)
91
+        {
86 92
             return $app->get(ManagerInterface::class);
87 93
         });
88 94
     }
Please login to merge, or discard this patch.
src/Framework/Bootloader/Distribution/DistributionConfig.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
121 121
      */
122 122
     private function createResolver(string $name, array $config): ResolverInterface
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
 block discarded – undo
150 150
      */
151 151
     private function createCustomResolver(string $type, string $name, array $config): ResolverInterface
152 152
     {
153
-        if (!\is_subclass_of($type, ResolverInterface::class, true)) {
153
+        if (!\is_subclass_of($type, ResolverInterface::class, true)){
154 154
             throw $this->invalidConfigKey($name, 'type', ResolverInterface::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
 block discarded – undo
174 174
     private function createS3Resolver(string $name, array $config): ResolverInterface
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
 
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
      */
225 225
     private function createCloudFrontResolver(string $name, array $config): ResolverInterface
226 226
     {
227
-        if (!isset($config['key']) || !\is_string($config['key'])) {
227
+        if (!isset($config['key']) || !\is_string($config['key'])){
228 228
             throw $this->invalidConfigKey($name, 'key', 'string');
229 229
         }
230 230
 
231
-        if (!isset($config['private']) || !\is_string($config['private'])) {
231
+        if (!isset($config['private']) || !\is_string($config['private'])){
232 232
             throw $this->invalidConfigKey($name, 'private', 'string value or path to key file');
233 233
         }
234 234
 
235
-        if (!isset($config['domain']) || !\is_string($config['domain'])) {
235
+        if (!isset($config['domain']) || !\is_string($config['domain'])){
236 236
             throw $this->invalidConfigKey($name, 'domain', 'string');
237 237
         }
238 238
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     private function createStaticResolver(string $name, array $config): ResolverInterface
252 252
     {
253
-        if (!isset($config['uri']) || !\is_string($config['uri'])) {
253
+        if (!isset($config['uri']) || !\is_string($config['uri'])){
254 254
             throw $this->invalidConfigKey($name, 'uri', 'string');
255 255
         }
256 256
 
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
      */
266 266
     private function createUri(string $name, string $uri, array $config): UriInterface
267 267
     {
268
-        if (!\is_string($config['factory'] ?? '')) {
268
+        if (!\is_string($config['factory'] ?? '')){
269 269
             throw $this->invalidConfigKey($name, 'factory', 'string (PSR-7 uri factory implementation)');
270 270
         }
271 271
 
272
-        switch (true) {
272
+        switch (true){
273 273
             case isset($config['factory']):
274 274
                 /** @var UriFactoryInterface $factory */
275 275
                 $factory = new $config['factory']();
276 276
 
277
-                if (!$factory instanceof UriFactoryInterface) {
278
-                    $message = 'Distribution config driver `%s` should contain class that must be a valid PSR-7 ' .
277
+                if (!$factory instanceof UriFactoryInterface){
278
+                    $message = 'Distribution config driver `%s` should contain class that must be a valid PSR-7 '.
279 279
                         'uri factory implementation, but `%s` given';
280 280
                     throw new InvalidArgumentException(\sprintf($message, $name, $config['factory']));
281 281
                 }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                 return new GuzzleUri($uri);
290 290
 
291 291
             default:
292
-                $message = 'Can not resolve available PSR-7 UriFactory implementation; ' .
292
+                $message = 'Can not resolve available PSR-7 UriFactory implementation; '.
293 293
                     'Please define `factory` config section in `%s` distribution driver config';
294 294
                 throw new InvalidArgumentException(\sprintf($message, $name));
295 295
         }
Please login to merge, or discard this patch.
Braces   +51 added lines, -25 removed lines patch added patch discarded remove patch
@@ -71,8 +71,10 @@  discard block
 block discarded – undo
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
+        {
76
+            if (!\is_string($name))
77
+            {
76 78
                 throw new InvalidArgumentException(
77 79
                     \vsprintf('Distribution driver config key must be a string, but %s given', [
78 80
                         \get_debug_type($child),
@@ -80,7 +82,8 @@  discard block
 block discarded – undo
80 82
                 );
81 83
             }
82 84
 
83
-            if (!\is_array($child)) {
85
+            if (!\is_array($child))
86
+            {
84 87
                 throw new InvalidArgumentException(
85 88
                     \vsprintf('Distribution driver config `%s` must be an array, but %s given', [
86 89
                         $name,
@@ -100,9 +103,11 @@  discard block
 block discarded – undo
100 103
     {
101 104
         $default = $config['default'] ?? null;
102 105
 
103
-        if ($default !== null) {
106
+        if ($default !== null)
107
+        {
104 108
             // Validate config
105
-            if (!\is_string($default)) {
109
+            if (!\is_string($default))
110
+            {
106 111
                 throw new InvalidArgumentException(
107 112
                     \vsprintf('Distribution config default driver must be a string, but %s given', [
108 113
                         \get_debug_type($default),
@@ -121,13 +126,15 @@  discard block
 block discarded – undo
121 126
      */
122 127
     private function createResolver(string $name, array $config): ResolverInterface
123 128
     {
124
-        if (!isset($config['type']) || !\is_string($config['type'])) {
129
+        if (!isset($config['type']) || !\is_string($config['type']))
130
+        {
125 131
             throw $this->invalidConfigKey($name, 'type', 'string');
126 132
         }
127 133
 
128 134
         $type = $config['type'];
129 135
 
130
-        switch ($type) {
136
+        switch ($type)
137
+        {
131 138
             case 'static':
132 139
                 return $this->createStaticResolver($name, $config);
133 140
 
@@ -150,17 +157,22 @@  discard block
 block discarded – undo
150 157
      */
151 158
     private function createCustomResolver(string $type, string $name, array $config): ResolverInterface
152 159
     {
153
-        if (!\is_subclass_of($type, ResolverInterface::class, true)) {
160
+        if (!\is_subclass_of($type, ResolverInterface::class, true))
161
+        {
154 162
             throw $this->invalidConfigKey($name, 'type', ResolverInterface::class);
155 163
         }
156 164
 
157
-        if (isset($config['options']) && !\is_array($config['options'])) {
165
+        if (isset($config['options']) && !\is_array($config['options']))
166
+        {
158 167
             throw $this->invalidConfigKey($name, 'options', 'array');
159 168
         }
160 169
 
161
-        try {
170
+        try
171
+        {
162 172
             return new $type(...\array_values($config['options'] ?? []));
163
-        } catch (\Throwable $e) {
173
+        }
174
+        catch (\Throwable $e)
175
+        {
164 176
             $message = 'An error occurred while resolver `%s` initializing: %s';
165 177
             throw new InvalidArgumentException(\sprintf($message, $name, $e->getMessage()), 0, $e);
166 178
         }
@@ -174,32 +186,39 @@  discard block
 block discarded – undo
174 186
     private function createS3Resolver(string $name, array $config): ResolverInterface
175 187
     {
176 188
         // Required config options
177
-        if (!isset($config['region']) || !\is_string($config['region'])) {
189
+        if (!isset($config['region']) || !\is_string($config['region']))
190
+        {
178 191
             throw $this->invalidConfigKey($name, 'region', 'string');
179 192
         }
180 193
 
181
-        if (!isset($config['key']) || !\is_string($config['key'])) {
194
+        if (!isset($config['key']) || !\is_string($config['key']))
195
+        {
182 196
             throw $this->invalidConfigKey($name, 'key', 'string');
183 197
         }
184 198
 
185
-        if (!isset($config['secret']) || !\is_string($config['secret'])) {
199
+        if (!isset($config['secret']) || !\is_string($config['secret']))
200
+        {
186 201
             throw $this->invalidConfigKey($name, 'secret', 'string');
187 202
         }
188 203
 
189
-        if (!isset($config['bucket']) || !\is_string($config['bucket'])) {
204
+        if (!isset($config['bucket']) || !\is_string($config['bucket']))
205
+        {
190 206
             throw $this->invalidConfigKey($name, 'bucket', 'string');
191 207
         }
192 208
 
193 209
         // Optional config options
194
-        if (!\is_string($config['version'] ?? '')) {
210
+        if (!\is_string($config['version'] ?? ''))
211
+        {
195 212
             throw $this->invalidConfigKey($name, 'version', 'string or null');
196 213
         }
197 214
 
198
-        if (!\is_string($config['token'] ?? '')) {
215
+        if (!\is_string($config['token'] ?? ''))
216
+        {
199 217
             throw $this->invalidConfigKey($name, 'token', 'string or null');
200 218
         }
201 219
 
202
-        if (!\is_int($config['expires'] ?? 0)) {
220
+        if (!\is_int($config['expires'] ?? 0))
221
+        {
203 222
             throw $this->invalidConfigKey($name, 'expires', 'positive int (unix timestamp)');
204 223
         }
205 224
 
@@ -224,15 +243,18 @@  discard block
 block discarded – undo
224 243
      */
225 244
     private function createCloudFrontResolver(string $name, array $config): ResolverInterface
226 245
     {
227
-        if (!isset($config['key']) || !\is_string($config['key'])) {
246
+        if (!isset($config['key']) || !\is_string($config['key']))
247
+        {
228 248
             throw $this->invalidConfigKey($name, 'key', 'string');
229 249
         }
230 250
 
231
-        if (!isset($config['private']) || !\is_string($config['private'])) {
251
+        if (!isset($config['private']) || !\is_string($config['private']))
252
+        {
232 253
             throw $this->invalidConfigKey($name, 'private', 'string value or path to key file');
233 254
         }
234 255
 
235
-        if (!isset($config['domain']) || !\is_string($config['domain'])) {
256
+        if (!isset($config['domain']) || !\is_string($config['domain']))
257
+        {
236 258
             throw $this->invalidConfigKey($name, 'domain', 'string');
237 259
         }
238 260
 
@@ -250,7 +272,8 @@  discard block
 block discarded – undo
250 272
      */
251 273
     private function createStaticResolver(string $name, array $config): ResolverInterface
252 274
     {
253
-        if (!isset($config['uri']) || !\is_string($config['uri'])) {
275
+        if (!isset($config['uri']) || !\is_string($config['uri']))
276
+        {
254 277
             throw $this->invalidConfigKey($name, 'uri', 'string');
255 278
         }
256 279
 
@@ -265,16 +288,19 @@  discard block
 block discarded – undo
265 288
      */
266 289
     private function createUri(string $name, string $uri, array $config): UriInterface
267 290
     {
268
-        if (!\is_string($config['factory'] ?? '')) {
291
+        if (!\is_string($config['factory'] ?? ''))
292
+        {
269 293
             throw $this->invalidConfigKey($name, 'factory', 'string (PSR-7 uri factory implementation)');
270 294
         }
271 295
 
272
-        switch (true) {
296
+        switch (true)
297
+        {
273 298
             case isset($config['factory']):
274 299
                 /** @var UriFactoryInterface $factory */
275 300
                 $factory = new $config['factory']();
276 301
 
277
-                if (!$factory instanceof UriFactoryInterface) {
302
+                if (!$factory instanceof UriFactoryInterface)
303
+                {
278 304
                     $message = 'Distribution config driver `%s` should contain class that must be a valid PSR-7 ' .
279 305
                         'uri factory implementation, but `%s` given';
280 306
                     throw new InvalidArgumentException(\sprintf($message, $name, $config['factory']));
Please login to merge, or discard this patch.
src/Distribution/src/Manager.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $name = $name ?? $this->default;
67 67
 
68
-        if (!isset($this->resolvers[$name])) {
68
+        if (!isset($this->resolvers[$name])){
69 69
             throw new \InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
70 70
         }
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function add(string $name, ResolverInterface $resolver, bool $overwrite = false): void
79 79
     {
80
-        if ($overwrite === false && isset($this->resolvers[$name])) {
80
+        if ($overwrite === false && isset($this->resolvers[$name])){
81 81
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
82 82
         }
83 83
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,8 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $name = $name ?? $this->default;
67 67
 
68
-        if (!isset($this->resolvers[$name])) {
68
+        if (!isset($this->resolvers[$name]))
69
+        {
69 70
             throw new \InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name));
70 71
         }
71 72
 
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
      */
78 79
     public function add(string $name, ResolverInterface $resolver, bool $overwrite = false): void
79 80
     {
80
-        if ($overwrite === false && isset($this->resolvers[$name])) {
81
+        if ($overwrite === false && isset($this->resolvers[$name]))
82
+        {
81 83
             throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name));
82 84
         }
83 85
 
Please login to merge, or discard this patch.
src/Distribution/src/Resolver/ExpirationAwareResolver.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
      */
114 114
     private function resolveExpirationInterval($expiration): \DateInterval
115 115
     {
116
-        if ($expiration === null) {
116
+        if ($expiration === null){
117 117
             return $this->expiration;
118 118
         }
119 119
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,8 @@
 block discarded – undo
113 113
      */
114 114
     private function resolveExpirationInterval($expiration): \DateInterval
115 115
     {
116
-        if ($expiration === null) {
116
+        if ($expiration === null)
117
+        {
117 118
             return $this->expiration;
118 119
         }
119 120
 
Please login to merge, or discard this patch.
src/Distribution/src/Resolver/CloudFrontResolver.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
      */
79 79
     protected function assertCloudFrontAvailable(): void
80 80
     {
81
-        if (\class_exists(UrlSigner::class)) {
81
+        if (\class_exists(UrlSigner::class)){
82 82
             return;
83 83
         }
84 84
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,8 @@
 block discarded – undo
78 78
      */
79 79
     protected function assertCloudFrontAvailable(): void
80 80
     {
81
-        if (\class_exists(UrlSigner::class)) {
81
+        if (\class_exists(UrlSigner::class))
82
+        {
82 83
             return;
83 84
         }
84 85
 
Please login to merge, or discard this patch.
src/Distribution/src/Internal/AmazonUriFactory.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
      * @var string
22 22
      */
23 23
     private const ERROR_NOT_AVAILABLE =
24
-        'The "aws/aws-sdk-php" package is supplied with the Guzzle PSR-7 ' .
25
-        'implementation, but it is not available. Please install the ' .
24
+        'The "aws/aws-sdk-php" package is supplied with the Guzzle PSR-7 '.
25
+        'implementation, but it is not available. Please install the '.
26 26
         '"aws/aws-sdk-php" package or use any other implementation of PSR-17 factories.'
27 27
     ;
28 28
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     private function assertAvailable(): void
50 50
     {
51
-        if (\class_exists(Uri::class)) {
51
+        if (\class_exists(Uri::class)){
52 52
             return;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@
 block discarded – undo
48 48
      */
49 49
     private function assertAvailable(): void
50 50
     {
51
-        if (\class_exists(Uri::class)) {
51
+        if (\class_exists(Uri::class))
52
+        {
52 53
             return;
53 54
         }
54 55
 
Please login to merge, or discard this patch.
src/Distribution/src/Internal/DateTimeIntervalFactory.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function create($duration): \DateInterval
41 41
     {
42
-        try {
42
+        try{
43 43
             return $this->createOrFail($duration);
44
-        } catch (\InvalidArgumentException $e) {
44
+        }catch (\InvalidArgumentException $e){
45 45
             throw $e;
46
-        } catch (\Throwable $e) {
46
+        }catch (\Throwable $e){
47 47
             throw new \InvalidArgumentException($e->getMessage(), (int)$e->getCode(), $e);
48 48
         }
49 49
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     private function createOrFail($duration): \DateInterval
67 67
     {
68
-        switch (true) {
68
+        switch (true){
69 69
             case $duration instanceof \DateInterval:
70 70
                 return $duration;
71 71
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 return new \DateInterval($duration);
77 77
 
78 78
             case \is_int($duration):
79
-                return new \DateInterval('PT' . $duration . 'S');
79
+                return new \DateInterval('PT'.$duration.'S');
80 80
 
81 81
             case $duration === null:
82 82
                 return new \DateInterval('PT0S');
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,11 +39,16 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function create($duration): \DateInterval
41 41
     {
42
-        try {
42
+        try
43
+        {
43 44
             return $this->createOrFail($duration);
44
-        } catch (\InvalidArgumentException $e) {
45
+        }
46
+        catch (\InvalidArgumentException $e)
47
+        {
45 48
             throw $e;
46
-        } catch (\Throwable $e) {
49
+        }
50
+        catch (\Throwable $e)
51
+        {
47 52
             throw new \InvalidArgumentException($e->getMessage(), (int)$e->getCode(), $e);
48 53
         }
49 54
     }
@@ -65,7 +70,8 @@  discard block
 block discarded – undo
65 70
      */
66 71
     private function createOrFail($duration): \DateInterval
67 72
     {
68
-        switch (true) {
73
+        switch (true)
74
+        {
69 75
             case $duration instanceof \DateInterval:
70 76
                 return $duration;
71 77
 
Please login to merge, or discard this patch.