| Conditions | 4 | 
| Paths | 3 | 
| Total Lines | 18 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 43 | public function check() | ||
| 44 |     { | ||
| 45 | $response = Director::test($this->url); | ||
| 46 | |||
| 47 |         if ($response->getStatusCode() != 200) { | ||
| 48 | return [ | ||
| 49 | EnvironmentCheck::ERROR, | ||
| 50 |                 sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode()) | ||
| 51 | ]; | ||
| 52 |         } elseif ($this->testString && (strpos($response->getBody(), $this->testString) === false)) { | ||
| 53 | return [ | ||
| 54 | EnvironmentCheck::WARNING, | ||
| 55 |                 sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $this->testString) | ||
| 56 | ]; | ||
| 57 | } | ||
| 58 | return [ | ||
| 59 | EnvironmentCheck::OK, | ||
| 60 |             sprintf('Success retrieving "%s"', $this->url) | ||
| 61 | ]; | ||
| 64 |