mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
35 lines
707 B
PHP
35 lines
707 B
PHP
<?php
|
|
|
|
/**
|
|
* Check that the given class exists.
|
|
*/
|
|
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 array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists');
|
|
} else {
|
|
return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist');
|
|
}
|
|
}
|
|
}
|