Passed
Push — develop ( 45600c...ff69f6 )
by Paul
03:16
created

JsonConsoleConfig   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
namespace PhpUnitGen\Configuration;
4
5
use PhpUnitGen\Exception\InvalidConfigException;
6
7
/**
8
 * Class JsonConsoleConfig.
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 JsonConsoleConfig extends ConsoleConfig
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function __construct($config)
22
    {
23
        $config = json_decode($config, true);
24
25
        if (! is_array($config)) {
26
            throw new InvalidConfigException('Unable to parse JSON config');
27
        }
28
29
        parent::__construct($config);
30
    }
31
}
32