* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; // @codingStandardsIgnoreStart require_once dirname(__FILE__). '/ApplicationBootstrap.php'; require_once dirname(__FILE__). '/../Exception/ProgrammingError.php'; // @codingStandardsIgnoreStop use Icinga\Exception\ProgrammingError; /** * Bootstrapping on cli environment */ class Cli extends ApplicationBootstrap { protected $isCli = true; protected function bootstrap() { $this->assertRunningOnCli(); return $this->setupConfig() ->setupErrorHandling() ->setupTimezone(); } /** * Fail if Icinga has not been called on CLI * * @throws \Exception */ private function assertRunningOnCli() { if (Platform::isCli()) { return; } throw new ProgrammingError('Icinga is not running on CLI'); } }