| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function run() |
||
| 26 | { |
||
| 27 | $result = $this->getCheck()->run(); |
||
| 28 | |||
| 29 | // @todo handle metric aware checks |
||
| 30 | |||
| 31 | if ($result->getStatus() == Result::STATUS_FAIL) { |
||
| 32 | $currentErrorsInARow = (int)$this->cache->get('errorsInARow'); |
||
| 33 | $currentErrorsInARow++; |
||
| 34 | |||
| 35 | $this->cache->set('errorsInARow', $currentErrorsInARow); |
||
| 36 | |||
| 37 | if ($currentErrorsInARow >= $this->maxErrorsInARow) { |
||
| 38 | return $result; |
||
| 39 | } else { |
||
| 40 | if ($result instanceof MetricAwareResult) { |
||
| 41 | $metricResult = new MetricAwareResult(Result::STATUS_PASS, 'Passed because non-strict mode is activated. Failed with message: ' . $result->getMessage()); |
||
| 42 | $metricResult->setMetric($result->getMetricValue(), $result->getMetricUnit()); |
||
| 43 | return $metricResult; |
||
| 44 | } else { |
||
| 45 | return new Result(Result::STATUS_PASS, 'Passed because non-strict mode is activated. Failed with message: ' . $result->getMessage()); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } else { |
||
| 49 | $this->cache->set('errorsInARow', 0); |
||
| 50 | return $result; |
||
| 51 | } |
||
| 59 |