PhpConsoleConfigFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A decode() 0 7 2
1
<?php
2
3
/**
4
 * This file is part of PhpUnitGen.
5
 *
6
 * (c) 2017-2018 Paul Thébaud <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PhpUnitGen\Configuration;
13
14
use PhpUnitGen\Exception\InvalidConfigException;
15
16
/**
17
 * Class PhpConsoleConfigFactory.
18
 *
19
 * @author     Paul Thébaud <[email protected]>.
20
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
21
 * @license    https://opensource.org/licenses/MIT The MIT license.
22
 * @link       https://github.com/paul-thebaud/phpunit-generator
23
 * @since      Class available since Release 2.0.0.
24
 */
25
class PhpConsoleConfigFactory extends AbstractConsoleConfigFactory
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function decode(string $configPath): array
31
    {
32
        $configArray = require $configPath;
33
        if (! is_array($configArray)) {
34
            throw new InvalidConfigException('Invalid PHP config');
35
        }
36
        return $configArray;
37
    }
38
}
39