@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | |
78 | 78 | private function bootStorages(array $config): void |
79 | 79 | { |
80 | - foreach ($config['buckets'] as $name => $bucket) { |
|
81 | - if (!\is_string($name)) { |
|
80 | + foreach ($config['buckets'] as $name => $bucket){ |
|
81 | + if (!\is_string($name)){ |
|
82 | 82 | throw new InvalidArgumentException( |
83 | 83 | \vsprintf('Storage bucket config key must be a string, but %s defined', [ |
84 | 84 | \get_debug_type($name), |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | $serverName = $bucket['server'] ?? null; |
90 | - if (!\is_string($serverName)) { |
|
90 | + if (!\is_string($serverName)){ |
|
91 | 91 | throw new InvalidArgumentException( |
92 | 92 | \vsprintf('Storage bucket `%s.server` config key required and must be a string, but %s defined', [ |
93 | 93 | $name, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $server = $config['servers'][$serverName] ?? null; |
100 | - if (!\is_array($server)) { |
|
100 | + if (!\is_array($server)){ |
|
101 | 101 | throw new InvalidArgumentException( |
102 | 102 | \vsprintf('Storage bucket `%s` relates to non-existing server `%s`', [ |
103 | 103 | $name, |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | $adapter = $server['adapter'] ?? null; |
110 | - if (!\is_string($adapter)) { |
|
110 | + if (!\is_string($adapter)){ |
|
111 | 111 | throw new InvalidArgumentException( |
112 | 112 | \vsprintf('Storage server `%s.adapter` config key required and must be a string, but %s defined', [ |
113 | 113 | $serverName, |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $this->adapters[$name] = $adapter; |
122 | 122 | |
123 | - if (isset($bucket['distribution'])) { |
|
123 | + if (isset($bucket['distribution'])){ |
|
124 | 124 | $this->distributions[$name] = $bucket['distribution']; |
125 | 125 | } |
126 | 126 | } |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | |
139 | 139 | private function createS3Adapter(string $serverName, array $bucket, array $server, bool $async): FilesystemAdapter |
140 | 140 | { |
141 | - if (!$async && !\class_exists(Credentials::class)) { |
|
141 | + if (!$async && !\class_exists(Credentials::class)){ |
|
142 | 142 | throw new ConfigException( |
143 | - 'Can not create AWS credentials while creating "' . $serverName . '" server. ' |
|
143 | + 'Can not create AWS credentials while creating "'.$serverName.'" server. ' |
|
144 | 144 | . 'Perhaps you forgot to install the "league/flysystem-aws-s3-v3" package?' |
145 | 145 | ); |
146 | 146 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | $name = $bucket['bucket'] ?? $server['bucket']; |
149 | 149 | $visibility = $bucket['visibility'] ?? $server['visibility'] ?? Visibility::VISIBILITY_PUBLIC; |
150 | 150 | |
151 | - if ($async) { |
|
152 | - if (!\class_exists(AsyncAwsS3Adapter::class)) { |
|
151 | + if ($async){ |
|
152 | + if (!\class_exists(AsyncAwsS3Adapter::class)){ |
|
153 | 153 | throw new InvalidArgumentException( |
154 | 154 | 'Can not create async S3 client, please install "league/flysystem-async-aws-s3"' |
155 | 155 | ); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ); |
164 | 164 | } |
165 | 165 | |
166 | - if (!\class_exists(AwsS3V3Adapter::class)) { |
|
166 | + if (!\class_exists(AwsS3V3Adapter::class)){ |
|
167 | 167 | throw new InvalidArgumentException( |
168 | 168 | 'Can not create S3 client, please install "league/flysystem-aws-s3-v3"' |
169 | 169 | ); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | private function createLocalAdapter(string $serverName, array $bucket, array $server): FilesystemAdapter |
181 | 181 | { |
182 | - if (!\is_string($server['directory'] ?? null)) { |
|
182 | + if (!\is_string($server['directory'] ?? null)){ |
|
183 | 183 | throw new InvalidArgumentException( |
184 | 184 | \vsprintf('Storage server `%s.directory` config key required and must be a string, but %s defined', [ |
185 | 185 | $serverName, |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $adapter = $server['adapter']; |
210 | 210 | $isFilesystemAdapter = \is_subclass_of($adapter, FilesystemAdapter::class, true); |
211 | 211 | |
212 | - if (!$isFilesystemAdapter) { |
|
212 | + if (!$isFilesystemAdapter){ |
|
213 | 213 | throw new InvalidArgumentException( |
214 | 214 | \vsprintf('Storage server `%s` must be a class string of %s, but `%s` defined', [ |
215 | 215 | $serverName, |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | ); |
220 | 220 | } |
221 | 221 | |
222 | - try { |
|
222 | + try{ |
|
223 | 223 | return new $adapter(...\array_values($server['options'] ?? [])); |
224 | - } catch (\Throwable $e) { |
|
224 | + }catch (\Throwable $e){ |
|
225 | 225 | $message = 'An error occurred while server `%s` initializing: %s'; |
226 | 226 | throw new InvalidArgumentException(\sprintf($message, $serverName, $e->getMessage()), 0, $e); |
227 | 227 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | 'endpoint' => $server['endpoint'] ?? null, |
235 | 235 | ] + ($server['options'] ?? []); |
236 | 236 | |
237 | - if (!$async) { |
|
237 | + if (!$async){ |
|
238 | 238 | $config['version'] = $server['version'] ?? 'latest'; |
239 | 239 | $config['credentials'] = new Credentials( |
240 | 240 | $server['key'] ?? null, |