mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-10-22 17:05:40 +02:00
29 lines
596 B
PHP
29 lines
596 B
PHP
<?php
|
|
|
|
/**
|
|
* Check that the given function exists.
|
|
*/
|
|
class HasFunctionCheck implements EnvironmentCheck {
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $functionName;
|
|
|
|
/**
|
|
* @param string $functionName The name of the function to look for.
|
|
*/
|
|
function __construct($functionName) {
|
|
$this->functionName = $functionName;
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*
|
|
* @return array
|
|
*/
|
|
function check() {
|
|
if(function_exists($this->functionName)) return array(EnvironmentCheck::OK, $this->functionName.'() exists');
|
|
else return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist');
|
|
}
|
|
}
|