Passed
Pull Request — master (#30)
by De Cramer
08:52
created

ExternalFileFinderFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 4
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Oliverde8\Component\PhpEtl\Builder\Factories\Extract;
5
6
use Oliverde8\Component\PhpEtl\Builder\Factories\AbstractFactory;
7
use Oliverde8\Component\PhpEtl\ChainOperation\ChainOperationInterface;
8
use Oliverde8\Component\PhpEtl\Model\File\FileSystemInterface;
9
use Symfony\Component\Validator\Constraint;
10
use Symfony\Component\Validator\Constraints as Assert;
11
12
class ExternalFileFinderFactory extends AbstractFactory
13
{
14
    protected FileSystemInterface $fileSystem;
15
16
    public function __construct(string $operation, string $class, FileSystemInterface $fileSystem)
17
    {
18
        parent::__construct($operation, $class);
19
        $this->fileSystem = $fileSystem;
20
    }
21
22
23
    protected function build(string $operation, array $options): ChainOperationInterface
24
    {
25
        return $this->create($this->fileSystem, $options['directory']);
26
    }
27
28
    protected function configureValidator(): Constraint
29
    {
30
        return new Assert\Collection([
31
            'directory' => new Assert\NotBlank(),
32
        ]);
33
    }
34
}