* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team * */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; use Icinga\Exception\ProgrammingError; /** * Icinga application container */ class Icinga { /** * @var ApplicationBootstrap */ private static $app; /** * Getter for an application environment * * @return ApplicationBootstrap|Web * @throws ProgrammingError */ public static function app() { if (self::$app == null) { throw new ProgrammingError('Icinga has never been started'); } return self::$app; } /** * Setter for an application environment * * @param ApplicationBootstrap $app * @throws ProgrammingError */ public static function setApp(ApplicationBootstrap $app) { if (self::$app !== null) { throw new ProgrammingError('Cannot start Icinga twice'); } self::$app = $app; } }