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
Coding Style
introduced
by
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) { |
||
0 ignored issues
–
show
|
|||
16 | $this->functionName = $functionName; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * @inheritdoc |
||
21 | * |
||
22 | * @return array |
||
23 | */ |
||
24 | function check() { |
||
0 ignored issues
–
show
|
|||
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 |