/** * Create the notification instance */ private final function __construct() { if (Platform::isCli()) { $this->isCli = true; return; } $this->session = Session::getSession(); $messages = $this->session->get(self::SESSION_KEY); if (is_array($messages)) { $this->messages = $messages; $this->session->delete(self::SESSION_KEY); $this->session->write(); } }
private final function __construct() { if (Platform::isCli()) { $this->isCli = true; return; } $this->session = Session::getSession(); $stored = $this->session->get('messages'); if (is_array($stored)) { $this->messages = $stored; $this->session->set('messages', array()); $this->session->write(); } }
/** * Create new object and try to identify the timezone */ public function __construct() { if (self::$success !== null) { return; } if (Platform::isCli() === false && array_key_exists(self::$cookieName, $_COOKIE)) { list($offset, $dst) = explode(',', $_COOKIE[self::$cookieName]); $timezoneName = timezone_name_from_abbr('', (int) $offset, (int) $dst); self::$success = (bool) $timezoneName; if (self::$success === true) { self::$offset = $offset; self::$timezoneName = $timezoneName; } } }
private final function __construct() { $session = Session::getSession(); if (!is_array($session->get('messages'))) { $session->messages = array(); } if (Platform::isCli()) { $this->is_cli = true; } }
/** * Fail if Icinga has not been called on CLI * * @throws ProgrammingError * @return void */ private function assertRunningOnCli() { if (Platform::isCli()) { return; } throw new ProgrammingError('Icinga is not running on CLI'); }