ConfigOptions::call()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 18
rs 9.9666
cc 4
nc 6
nop 0
1
<?php
2
namespace Health\Checks\Php;
3
4
use Health\Checks\BaseCheck;
5
use Health\Checks\HealthCheckInterface;
6
7
class ConfigOptions extends BaseCheck implements HealthCheckInterface
8
{
9
10
    /**
11
     *
12
     * {@inheritdoc}
13
     * @see \Health\Checks\HealthCheckInterface::call()
14
     */
15
    public function call()
16
    {
17
        $builder = $this->getBuilder();
18
19
        $options = $this->getParam('options', []);
20
        $errors = [];
21
22
        foreach ($options as $option => $value) {
23
            if (ini_get($option) != $value) {
24
                $errors[] = $option;
25
            }
26
        }
27
28
        if ($errors) {
29
            $builder->down()->withData('errors', $errors);
30
        }
31
32
        return $builder->build();
33
    }
34
}
35