Completed
Push — develop ( 0b8425...c51867 )
by Jaap
15s queued 11s
created

Infrastructure/Parser/FlySystemCollector.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Infrastructure\Parser;
17
18
use phpDocumentor\DomainModel\Dsn;
19
use phpDocumentor\DomainModel\Parser\FileCollector;
20
use phpDocumentor\Infrastructure\FlySystemFactory;
21
use phpDocumentor\Infrastructure\SpecificationFactory;
22
23
final class FlySystemCollector implements FileCollector
24
{
25
    /**
26
     * @var SpecificationFactory
27
     */
28
    private $specificationFactory;
29
30
    /**
31
     * @var FlySystemFactory
32
     */
33
    private $flySystemFactory;
34
35
    /**
36
     * FlySystemCollector constructor.
37
     */
38
    public function __construct(SpecificationFactory $specificationFactory, FlySystemFactory $flySystemFactory)
39
    {
40
        $this->specificationFactory = $specificationFactory;
41
        $this->flySystemFactory = $flySystemFactory;
42
    }
43
44 1
    public function getFiles(Dsn $dsn, array $paths, array $ignore, array $extensions): array
45
    {
46 1
        $specs = $this->specificationFactory->create($paths, $ignore, $extensions);
47
48 1
        $fileSystem = $this->flySystemFactory->create($dsn);
49
50 1
        $files = [];
51
52 1
        foreach ($fileSystem->find($specs) as $file) {
0 ignored issues
show
The method find() does not seem to exist on object<League\Flysystem\FilesystemInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53 1
            $files[] = new FlySystemFile($fileSystem, $file['path']);
54
        }
55
56 1
        return $files;
57
    }
58
}
59