SymfonyExtractor::extract()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 4
c 0
b 0
f 0
nc 3
nop 1
dl 0
loc 8
rs 10
ccs 2
cts 2
cp 1
crap 3
1
<?php
2
3
namespace Incenteev\TranslationCheckerBundle\Translator\Extractor;
4
5
use Symfony\Component\Translation\Extractor\ExtractorInterface as SymfonyExtractorInterface;
6
use Symfony\Component\Translation\MessageCatalogue;
7
8
class SymfonyExtractor implements ExtractorInterface
9
{
10
    private SymfonyExtractorInterface $extractor;
11
    /**
12
     * @var string[]
13 3
     */
14
    private array $paths;
15 3
16 3
    /**
17 3
     * @param string[] $paths
18
     */
19 1
    public function __construct(SymfonyExtractorInterface $extractor, array $paths)
20
    {
21 1
        $this->extractor = $extractor;
22 1
        $this->paths = $paths;
23 1
    }
24
25
    public function extract(MessageCatalogue $catalogue): void
26 1
    {
27
        foreach ($this->paths as $path) {
28 1
            if (!is_dir($path)) {
29
                continue;
30
            }
31
32
            $this->extractor->extract($path, $catalogue);
33
        }
34
    }
35
}
36