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

code/checks/HasClassCheck.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 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) {
16
		$this->className = $className;
17
	}
18
19
	/**
20
	 * @inheritdoc
21
	 *
22
	 * @return array
23
	 */
24
	function check() {
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