Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
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 |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @param Contents $contents |
||
43 | */ |
||
44 | abstract public function processContents(Contents $contents): void; |
||
45 | } |
||
46 |