Test Failed
Pull Request — master (#38)
by Maximo
04:24
created

library/Providers/FileSystemProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Gewaer\Providers;
4
5
use Phalcon\Di\ServiceProviderInterface;
6
use Phalcon\DiInterface;
7
use League\Flysystem\Adapter\Local;
8
use League\Flysystem\AwsS3v3\AwsS3Adapter;
9
use League\Flysystem\Filesystem;
10
11
class FileSystemProvider implements ServiceProviderInterface
12
{
13
    /**
14
     * @param DiInterface $container
15
     */
16 54
    public function register(DiInterface $container)
17
    {
18 54
        $config = $container->getShared('config');
19
20 54
        $container->setShared(
21 54
            'filesystem',
22
            function ($filesystem = 'local') use ($config) {
23
                if ($filesystem === 'local') {
24
                    //create directory
25
                    $adapter = new Local($config->filesystem->local->path);
26
                } else {
27
                    //s3
28
                    $client = S3Client::factory($config->filesystem->s3->info->toArray());
0 ignored issues
show
The type Gewaer\Providers\S3Client was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
                    $adapter = new AwsS3Adapter($client, $config->filesystem->s3->bucket, null, ['ACL' => 'public-read']);
30
                }
31
                return new Filesystem($adapter);
32 54
            }
33
        );
34 54
    }
35
}
36