2012-01-20 18:10:48 +01:00
|
|
|
<?php
|
2015-09-10 23:13:48 +02:00
|
|
|
|
2012-01-20 18:10:48 +01:00
|
|
|
/**
|
|
|
|
* Check that the given class exists.
|
|
|
|
*/
|
|
|
|
class HasClassCheck implements EnvironmentCheck {
|
2015-09-10 23:13:48 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2012-01-20 18:10:48 +01:00
|
|
|
protected $className;
|
2015-09-10 23:13:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $className The name of the class to look for.
|
|
|
|
*/
|
2012-01-20 18:10:48 +01:00
|
|
|
function __construct($className) {
|
|
|
|
$this->className = $className;
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2012-01-20 18:10:48 +01:00
|
|
|
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');
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
}
|