Passed
Push — master ( 4a80fe...22f802 )
by Sébastien
01:51
created

VideoInfoReaderFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 13
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @see       https://github.com/soluble-io/soluble-mediatools for the canonical repository
7
 *
8
 * @copyright Copyright (c) 2018-2019 Sébastien Vanvelthem. (https://github.com/belgattitude)
9
 * @license   https://github.com/soluble-io/soluble-mediatools/blob/master/LICENSE.md MIT
10
 */
11
12
namespace Soluble\MediaTools\Video;
13
14
use Psr\Container\ContainerInterface;
15
use Psr\Log\NullLogger;
16
use Soluble\MediaTools\Video\Config\FFProbeConfigInterface;
17
use Soluble\MediaTools\Video\Config\LoggerConfigInterface;
18
19
class VideoInfoReaderFactory
20
{
21 12
    public function __invoke(ContainerInterface $container): VideoInfoReaderInterface
22
    {
23 12
        if ($container->has(LoggerConfigInterface::class)) {
24 1
            $logger = $container->get(LoggerConfigInterface::class)->getLogger();
25
        } else {
26 11
            $logger = new NullLogger();
27
        }
28
29 12
        return new VideoInfoReader(
30 12
            $container->get(FFProbeConfigInterface::class),
31
            $logger
32
        );
33
    }
34
}
35