Version   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 14 2
1
<?php
2
namespace Health\Checks\Php;
3
4
use Health\Checks\BaseCheck;
5
use Health\Checks\HealthCheckInterface;
6
7
class Version extends BaseCheck implements HealthCheckInterface
8
{
9
10
    const DEFAULT_OPERATOR = '=';
11
12
    /**
13
     *
14
     * {@inheritdoc}
15
     * @see \Health\Checks\HealthCheckInterface::call()
16
     */
17
    public function call()
18
    {
19
        $builder = $this->getBuilder();
20
21
        $version = $this->getParam('version');
22
        $operator = $this->getParam('operator', self::DEFAULT_OPERATOR);
23
24
        if (! version_compare(PHP_VERSION, $version, $operator)) {
25
            $builder->down();
26
        }
27
28
        $builder->withData('version', PHP_VERSION);
29
30
        return $builder->build();
31
    }
32
}
33