Completed
Push — master ( 1f1747...e8aa43 )
by personal
17s queued 11s
created

ConfigValidator::validates()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Application\Config;
11
use Hal\Component\Chart\Graphviz;
12
use Hal\Component\Config\Hydrator;
13
use Hal\Component\Config\Loader;
14
use Hal\Component\Config\Validator;
15
use Symfony\Component\Console\Input\InputInterface;
16
17
/**
18
 * Config checker
19
 *
20
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
21
 */
22
class ConfigValidator
23
{
24
    /**
25
     * @param Configuration $config
26
     */
27
    public function validates(Configuration $config)
28
    {
29
        // graphviz
30
        if($config->getLogging()->getChart('bubbles')) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $config->getLogging()->getChart('bubbles') of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
31
            $graphviz = new Graphviz();
32
            if(!$graphviz->isAvailable()) {
33
                throw new \RuntimeException('Graphviz not installed');
34
            }
35
        }
36
    }
37
}