Completed
Push — master ( e090e4...18d79e )
by Damian
02:26
created

code/checks/HasFunctionCheck.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Check that the given function exists.
5
 */
6
class HasFunctionCheck implements EnvironmentCheck {
0 ignored issues
show
As per PSR2, the opening brace for this class should be on a new line.
Loading history...
7
	/**
8
	 * @var string
9
	 */
10
	protected $functionName;
11
12
	/**
13
	 * @param string $functionName The name of the function to look for.
14
	 */
15
	function __construct($functionName) {
16
		$this->functionName = $functionName;
17
	}
18
19
	/**
20
	 * @inheritdoc
21
	 *
22
	 * @return array
23
	 */
24
	function check() {
25
		if(function_exists($this->functionName)) return array(EnvironmentCheck::OK, $this->functionName.'() exists');
26
		else return array(EnvironmentCheck::ERROR, $this->functionName.'() doesn\'t exist');
27
	}
28
}
29