Passed
Push — master ( e997b4...814bec )
by Sébastien
02:46
created

VideoFilterChain::getFFmpegCLIValue()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 10
cts 10
cp 1
rs 9.7333
c 0
b 0
f 0
cc 4
nc 6
nop 0
crap 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video\Filter;
6
7
class VideoFilterChain extends AbstractVideoFilter
8
{
9
    /** @var VideoFilterInterface[] */
10
    protected $filters = [];
11
12 4
    public function __construct()
13
    {
14 4
    }
15
16 3
    public function getFilters(): array
17
    {
18 3
        return $this->filters;
19
    }
20
21 4
    public function addFilter(VideoFilterInterface $filter): void
22
    {
23 4
        $this->filters[] = $filter;
24 4
    }
25
26 3
    public function getFFmpegCLIValue(): string
27
    {
28 3
        $values = [];
29 3
        foreach ($this->filters as $filter) {
30 3
            $val = $filter->getFFmpegCLIValue();
31 3
            if ($val === '') {
32 3
                continue;
33
            }
34
35 2
            $values[] = $val;
36
        }
37 3
        if (count($values) === 0) {
38 1
            return '';
39
        }
40
41 2
        return implode(',', $values);
42
    }
43
}
44