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

code/checks/HasClassCheck.php (3 issues)

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 class exists.
5
 */
6
class HasClassCheck 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 $className;
11
12
	/**
13
	 * @param string $className The name of the class to look for.
14
	 */
15
	function __construct($className) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16
		$this->className = $className;
17
	}
18
19
	/**
20
	 * @inheritdoc
21
	 *
22
	 * @return array
23
	 */
24
	function check() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
25
		if(class_exists($this->className)) return array(EnvironmentCheck::OK, 'Class ' . $this->className.' exists');
26
		else return array(EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist');
27
	}
28
}
29