Conditions | 7 |
Paths | 1 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 0 |
1 | <?php |
||
19 | public function boot() |
||
20 | { |
||
21 | Storage::extend('fortrabbit', function ($app, $config) { |
||
22 | $s3Config = $config + ['version' => 'latest']; |
||
23 | |||
24 | if ($s3Config['key'] && $s3Config['secret']) { |
||
25 | $s3Config['credentials'] = Arr::only($s3Config, ['key', 'secret']); |
||
26 | } |
||
27 | |||
28 | $root = isset($s3Config['root']) ? $s3Config['root'] : null; |
||
29 | |||
30 | $options = isset($config['options']) ? $config['options'] : []; |
||
31 | |||
32 | $storageUrl = isset($s3Config['storage_url']) ? $s3Config['storage_url'] : null; |
||
33 | |||
34 | $config = Arr::only($config, ['visibility', 'disable_asserts']); |
||
35 | |||
36 | return new Filesystem( |
||
37 | new FortrabbitAdapter(new S3Client($s3Config), $s3Config['bucket'], $root, $options, $storageUrl), |
||
38 | count($config) > 0 ? $config : null |
||
39 | ); |
||
40 | }); |
||
41 | } |
||
42 | |||
53 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.