silverstripe-environmentcheck/src/Checks/HasFunctionCheck.php
Robbie Averill b9af2d0734 FIX Update config API, Logger alias, dotenv config, remove PHP 5.5, other fixes
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.
2017-05-04 16:11:25 +12:00

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'];
}
}