| Conditions | 2 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2.686 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 54 | public function register(DiInterface $container) |
|
| 18 | { |
||
| 19 | 54 | $config = $container->getShared('config'); |
|
| 20 | |||
| 21 | 54 | $container->setShared( |
|
| 22 | 54 | 'filesystem', |
|
| 23 | function ($filesystem = 'local') use ($config) { |
||
| 24 | if ($filesystem === 'local') { |
||
| 25 | //create directory |
||
| 26 | $adapter = new Local($config->filesystem->local->path); |
||
| 27 | } else { |
||
| 28 | //s3 |
||
| 29 | $client = new S3Client($config->filesystem->s3->info->toArray()); |
||
| 30 | $adapter = new AwsS3Adapter($client, $config->filesystem->s3->bucket, null, ['ACL' => 'public-read']); |
||
| 31 | } |
||
| 32 | return new Filesystem($adapter); |
||
| 33 | 54 | } |
|
| 37 |