Completed
Push — master ( 359fe7...152344 )
by Sébastien
03:49
created

PresetLocator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 27
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isSupported() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Preset;
6
7
use Soluble\MediaTools\Preset\MP4\StreamableH264Preset;
8
use Soluble\MediaTools\Preset\Prod\ResolvePreset;
9
use Soluble\MediaTools\Preset\WebM\GoogleVod2019Preset;
10
11
class PresetLocator
12
{
13
    public const BUILTIN_PRESETS = [
14
        ResolvePreset::class,
15
        StreamableH264Preset::class,
16
        GoogleVod2019Preset::class
17
    ];
18
19
    /**
20
     * @var string[]
21
     */
22
    private $paths = [];
23
24
    /**
25
     * @var string[]
26
     */
27
    private $presets;
28
29 2
    public function __construct(array $paths = [])
30
    {
31 2
        $this->paths   = array_merge($paths, [__DIR__]);
32 2
        $this->presets = self::BUILTIN_PRESETS;
33 2
    }
34
35
    public function isSupported(string $name): bool
36
    {
37
        return in_array($name, $this->presets, true);
38
    }
39
}
40