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

VideoFilterChain   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 35
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilters() 0 3 1
A addFilter() 0 3 1
A __construct() 0 2 1
A getFFmpegCLIValue() 0 16 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