blob: d884c31c081b7a130c7c43576a4c24560ccf403c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Setup\Requirement;
use Icinga\Application\Platform;
use Icinga\Module\Setup\Requirement;
class ClassRequirement extends Requirement
{
protected function evaluate()
{
return Platform::classExists($this->getCondition());
}
/**
* {@inheritdoc}
*/
public function getStateText()
{
$stateText = parent::getStateText();
if ($stateText === null) {
$alias = $this->getAlias();
if ($this->getState()) {
$stateText = $alias === null
? sprintf(
mt('setup', 'The %s class is available.', 'setup.requirement.class'),
$this->getCondition()
)
: sprintf(
mt('setup', 'The %s is available.', 'setup.requirement.class'),
$alias
);
} else {
$stateText = $alias === null
? sprintf(
mt('setup', 'The %s class is missing.', 'setup.requirement.class'),
$this->getCondition()
)
: sprintf(
mt('setup', 'The %s is missing.', 'setup.requirement.class'),
$alias
);
}
}
return $stateText;
}
}
|