OnFailureExtension::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 3
nc 3
nop 2
1
<?php
2
3
namespace whm\Smoke\Extensions\SmokeOnFailure;
4
5
use Psr\Http\Message\ResponseInterface;
6
use whm\Smoke\Rules\CheckResult;
7
8
class OnFailureExtension
9
{
10
    private $callback;
11
12
    public function init($command)
13
    {
14
        $this->callback = function () use ($command) {
15
            return eval($command);
16
        };
17
    }
18
19
    /**
20
     * @param CheckResult[] $results
21
     * @Event("Scanner.Scan.Validate")
22
     */
23
    public function process($results, ResponseInterface $response)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
    {
25
        foreach ($results as $result) {
26
            if ($result->getStatus() == CheckResult::STATUS_FAILURE) {
27
                $callback = $this->callback;
28
                $callback();
29
            }
30
        }
31
    }
32
}
33