silverstripe-environmentcheck/src/Checks/HasClassCheck.php
Robbie Averill b9af2d0734 FIX Update config API, Logger alias, dotenv config, remove PHP 5.5, other fixes
Remove PHP 5.5 from Travis configuration. Dotenv used for environment management now,
examples and tests updated to use putenv instead of define. Logger alias update to
LoggerInterface. Update mutable config API calls. Replace array declaration with
short version: []. Update license year.
2017-05-04 16:11:25 +12:00

40 lines
812 B
PHP

<?php
namespace SilverStripe\EnvironmentCheck\Checks;
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
/**
* Check that the given class exists.
*
* @package environmentcheck
*/
class HasClassCheck implements EnvironmentCheck
{
/**
* @var string
*/
protected $className;
/**
* @param string $className The name of the class to look for.
*/
public function __construct($className)
{
$this->className = $className;
}
/**
* {@inheritDoc}
*
* @return array
*/
public function check()
{
if (class_exists($this->className)) {
return [EnvironmentCheck::OK, 'Class ' . $this->className.' exists'];
}
return [EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist'];
}
}