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

PhpConsoleConfigFactory::decode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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