ContentsProcessor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigFilePath() 0 3 1
A __construct() 0 9 2
1
<?php declare(strict_types=1);
2
3
namespace App\Domain;
4
5
use App\UI\UserInterface;
6
use Symfony\Component\Yaml\Yaml;
7
8
abstract class ContentsProcessor
9
{
10
    /** @var \App\UI\UserInterface */
11
    protected $ui;
12
13
    /** @var array */
14
    protected $config;
15
16
    /**
17
     * {@inheritdoc}
18
     * @param array $config
19
     *
20
     * @throws \Symfony\Component\Yaml\Exception\ParseException
21
     */
22
    public function __construct(UserInterface $ui, array $config = [])
23
    {
24
        $this->ui = $ui;
25
26
        if (!empty($configFilePath = $this->getConfigFilePath())) {
27
            $config = array_replace_recursive((array) Yaml::parseFile($configFilePath), $config);
28
        }
29
30
        $this->config = $config;
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    protected function getConfigFilePath(): string
37
    {
38
        return '';
39
    }
40
41
    /**
42
     * @param Contents $contents
43
     */
44
    abstract public function processContents(Contents $contents): void;
45
}
46