2015-02-25 07:39:59 -05:00
|
|
|
<?php
|
2026-03-26 12:46:27 -04:00
|
|
|
|
|
|
|
|
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2015-02-25 07:39:59 -05: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 07:46:01 -05: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 08:48:59 -05: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 07:46:01 -05:00
|
|
|
} else {
|
|
|
|
|
$stateText = $alias === null
|
2017-01-27 08:48:59 -05: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 07:46:01 -05:00
|
|
|
}
|
2015-02-25 07:39:59 -05:00
|
|
|
}
|
2016-12-13 07:46:01 -05:00
|
|
|
return $stateText;
|
2015-02-25 07:39:59 -05:00
|
|
|
}
|
|
|
|
|
}
|