OnFailureExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 6 1
A process() 0 9 3
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