Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
12 | public function __invoke(array $options) |
||
13 | { |
||
14 | $options = array_replace([ |
||
15 | 'key' => null, |
||
16 | 'secret' => null, |
||
17 | 'region' => 'us-east-1', |
||
18 | 'version' => 'latest', |
||
19 | 'bucket' => null, |
||
20 | 'prefix' => null, |
||
21 | ], $options); |
||
22 | |||
23 | $bucket = $options['bucket']; |
||
24 | $prefix = $options['prefix']; |
||
25 | |||
26 | if (!array_key_exists('credentials', $options)) { |
||
27 | $credentials = []; |
||
28 | $credentials['key'] = $options['key']; |
||
29 | $credentials['secret'] = $options['secret']; |
||
30 | $options['credentials'] = $credentials; |
||
31 | } |
||
32 | |||
33 | $client = new S3Client($options); |
||
34 | |||
35 | return new AwsS3Adapter($client, $bucket, $prefix); |
||
36 | } |
||
37 | } |
||
38 |