Completed
Push — develop ( 8b0772...a0b2b6 )
by Paul
04:54
created

PhpConsoleConfigFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A decode() 0 7 2
1
<?php
2
3
namespace PhpUnitGen\Configuration;
4
5
use PhpUnitGen\Exception\InvalidConfigException;
6
7
/**
8
 * Class PhpConsoleConfigFactory.
9
 *
10
 * @author     Paul Thébaud <[email protected]>.
11
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
12
 * @license    https://opensource.org/licenses/MIT The MIT license.
13
 * @link       https://github.com/paul-thebaud/phpunit-generator
14
 * @since      Class available since Release 2.0.0.
15
 */
16
class PhpConsoleConfigFactory extends AbstractConsoleConfigFactory
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function decode(string $configPath): array
22
    {
23
        $configArray = require $configPath;
24
        if (! is_array($configArray)) {
25
            throw new InvalidConfigException('Unable to parse PHP config');
26
        }
27
        return $configArray;
28
    }
29
}
30