Completed
Push — develop ( 2993ce...48a3ec )
by Mike
09:32
created

FlySystemCollector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getFiles() 0 14 2
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\Parser;
17
18
use phpDocumentor\Dsn;
19
20
final class FlySystemCollector implements FileCollector
21
{
22
    /**
23
     * @var SpecificationFactoryInterface
24
     */
25
    private $specificationFactory;
26
27
    /**
28
     * @var FlySystemFactory
29
     */
30
    private $flySystemFactory;
31
32
    /**
33
     * FlySystemCollector constructor.
34
     */
35
    public function __construct(SpecificationFactoryInterface $specificationFactory, FlySystemFactory $flySystemFactory)
36
    {
37
        $this->specificationFactory = $specificationFactory;
38
        $this->flySystemFactory = $flySystemFactory;
39
    }
40
41 1
    public function getFiles(Dsn $dsn, array $paths, array $ignore, array $extensions): array
42
    {
43 1
        $specs = $this->specificationFactory->create($paths, $ignore, $extensions);
44
45 1
        $fileSystem = $this->flySystemFactory->create($dsn);
46
47 1
        $files = [];
48
49 1
        foreach ($fileSystem->find($specs) as $file) {
50 1
            $files[] = new FlySystemFile($fileSystem, $file['path']);
51
        }
52
53 1
        return $files;
54
    }
55
}
56