2015-02-25 13:39:59 +01:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
|
2015-02-25 13:39:59 +01:00
|
|
|
|
|
|
|
namespace Icinga\Module\Setup\Requirement;
|
|
|
|
|
|
|
|
use Icinga\Application\Platform;
|
|
|
|
use Icinga\Module\Setup\Requirement;
|
|
|
|
|
|
|
|
class ClassRequirement extends Requirement
|
|
|
|
{
|
|
|
|
protected function evaluate()
|
|
|
|
{
|
2016-12-13 13:46:01 +01:00
|
|
|
return Platform::classExists($this->getCondition());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getStateText()
|
|
|
|
{
|
|
|
|
$stateText = parent::getStateText();
|
|
|
|
if ($stateText === null) {
|
|
|
|
$alias = $this->getAlias();
|
|
|
|
if ($this->getState()) {
|
|
|
|
$stateText = $alias === null
|
2017-01-27 14:48:59 +01:00
|
|
|
? sprintf(
|
|
|
|
mt('setup', 'The %s class is available.', 'setup.requirement.class'),
|
|
|
|
$this->getCondition()
|
|
|
|
)
|
|
|
|
: sprintf(
|
|
|
|
mt('setup', 'The %s is available.', 'setup.requirement.class'),
|
|
|
|
$alias
|
|
|
|
);
|
2016-12-13 13:46:01 +01:00
|
|
|
} else {
|
|
|
|
$stateText = $alias === null
|
2017-01-27 14:48:59 +01:00
|
|
|
? sprintf(
|
|
|
|
mt('setup', 'The %s class is missing.', 'setup.requirement.class'),
|
|
|
|
$this->getCondition()
|
|
|
|
)
|
|
|
|
: sprintf(
|
|
|
|
mt('setup', 'The %s is missing.', 'setup.requirement.class'),
|
|
|
|
$alias
|
|
|
|
);
|
2016-12-13 13:46:01 +01:00
|
|
|
}
|
2015-02-25 13:39:59 +01:00
|
|
|
}
|
2016-12-13 13:46:01 +01:00
|
|
|
return $stateText;
|
2015-02-25 13:39:59 +01:00
|
|
|
}
|
|
|
|
}
|