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 function exists.
|
|
|
|
*/
|
|
|
|
class HasFunctionCheck implements EnvironmentCheck {
|
2015-09-10 23:13:48 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2012-01-20 18:10:48 +01:00
|
|
|
protected $functionName;
|
2015-09-10 23:13:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $functionName The name of the function to look for.
|
|
|
|
*/
|
2012-01-20 18:10:48 +01:00
|
|
|
function __construct($functionName) {
|
|
|
|
$this->functionName = $functionName;
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2012-01-20 18:10:48 +01:00
|
|
|
function check() {
|
|
|
|
if(function_exists($this->functionName)) return array(EnvironmentCheck::OK, $this->functionName.'() exists');
|
|
|
|
else return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist');
|
|
|
|
}
|
2015-09-10 23:13:48 +02:00
|
|
|
}
|