Conditions | 5 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function run() |
||
21 | { |
||
22 | $result = $this->getCheck()->run(); |
||
23 | |||
24 | $currentHour = (int)date('H'); |
||
25 | |||
26 | if ($result->getStatus() == Result::STATUS_FAIL) { |
||
27 | if ($currentHour == $this->hour) { |
||
28 | if ($this->reason) { |
||
29 | $message = $this->reason . ' (fail reason was: ' . $result->getMessage() . ')'; |
||
|
|||
30 | } else { |
||
31 | $message = 'Passed due daily filter (fail reason was: ' . $result->getMessage() . ')'; |
||
32 | } |
||
33 | |||
34 | if ($result instanceof MetricAwareResult) { |
||
35 | $newResult = new MetricAwareResult(Result::STATUS_PASS, $message); |
||
36 | $newResult->setMetric($result->getMetricValue(), $result->getMetricUnit()); |
||
37 | } else { |
||
38 | $newResult = new Result(Result::STATUS_PASS, $message); |
||
39 | } |
||
40 | |||
41 | return $newResult; |
||
42 | } else { |
||
43 | return $result; |
||
44 | } |
||
45 | } else { |
||
46 | return $result; |
||
47 | } |
||
50 |