mirror of
https://github.com/silverstripe/silverstripe-environmentcheck
synced 2024-09-29 12:49:14 +02:00
b9af2d0734
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.
40 lines
834 B
PHP
40 lines
834 B
PHP
<?php
|
|
|
|
namespace SilverStripe\EnvironmentCheck\Checks;
|
|
|
|
use SilverStripe\EnvironmentCheck\EnvironmentCheck;
|
|
|
|
/**
|
|
* Check that the given function exists.
|
|
*
|
|
* @package environmentcheck
|
|
*/
|
|
class HasFunctionCheck implements EnvironmentCheck
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected $functionName;
|
|
|
|
/**
|
|
* @param string $functionName The name of the function to look for.
|
|
*/
|
|
public function __construct($functionName)
|
|
{
|
|
$this->functionName = $functionName;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*
|
|
* @return array
|
|
*/
|
|
public function check()
|
|
{
|
|
if (function_exists($this->functionName)) {
|
|
return [EnvironmentCheck::OK, $this->functionName . '() exists'];
|
|
}
|
|
return [EnvironmentCheck::ERROR, $this->functionName . '() doesn\'t exist'];
|
|
}
|
|
}
|