for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Check that a given URL is functioning, by default, the homepage.
*
* Note that Director::test() will be used rather than a CURL check.
*/
class URLCheck implements EnvironmentCheck
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
* @var string
protected $url;
protected $testString;
/*
* @param string $url The URL to check, relative to the site (homepage is '').
* @param string $testString An optional piece of text to search for on the homepage.
public function __construct($url = '', $testString = '')
$this->url = $url;
$this->testString = $testString;
}
* @inheritdoc
* @return array
* @throws SS_HTTPResponse_Exception
public function check()
$response = Director::test($this->url);
if ($response->getStatusCode() != 200) {
return array(
EnvironmentCheck::ERROR,
sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode())
);
} elseif ($this->testString && (strpos($response->getBody(), $this->testString) === false)) {
EnvironmentCheck::WARNING,
sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $this->testString)
} else {
EnvironmentCheck::OK,
sprintf('Success retrieving "%s"', $this->url)
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.