SymfonyRequirements   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 28.57%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 3
dl 0
loc 31
ccs 4
cts 14
cp 0.2857
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A check() 0 14 3
A getLabel() 0 4 1
1
<?php
2
3
namespace Liip\MonitorBundle\Check;
4
5
use Laminas\Diagnostics\Check\CheckInterface;
6
use Laminas\Diagnostics\Result\Failure;
7
use Laminas\Diagnostics\Result\Success;
8
use Laminas\Diagnostics\Result\Warning;
9
10
/**
11
 * @author Kevin Bond <[email protected]>
12
 */
13
class SymfonyRequirements implements CheckInterface
14
{
15 1
    public function __construct($file)
16
    {
17 1
        if (!file_exists($file)) {
18
            throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $file));
19
        }
20
21 1
        require $file;
22 1
    }
23
24
    public function check()
25
    {
26
        $symfonyRequirements = new \SymfonyRequirements();
27
28
        if (count($symfonyRequirements->getFailedRequirements())) {
29
            return new Failure('Some Symfony2 requirements are not met.');
30
        }
31
32
        if (count($symfonyRequirements->getFailedRecommendations())) {
33
            return new Warning('Some Symfony2 recommendations are not met.');
34
        }
35
36
        return new Success();
37
    }
38
39
    public function getLabel()
40
    {
41
        return 'Symfony2 Requirements';
42
    }
43
}
44