From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- library/Icinga/Application/EmbeddedWeb.php | 114 +++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 library/Icinga/Application/EmbeddedWeb.php (limited to 'library/Icinga/Application/EmbeddedWeb.php') diff --git a/library/Icinga/Application/EmbeddedWeb.php b/library/Icinga/Application/EmbeddedWeb.php new file mode 100644 index 0000000..8d03e11 --- /dev/null +++ b/library/Icinga/Application/EmbeddedWeb.php @@ -0,0 +1,114 @@ + + * use Icinga\Application\EmbeddedWeb; + * EmbeddedWeb::start(); + * + */ +class EmbeddedWeb extends ApplicationBootstrap +{ + /** + * Request + * + * @var Request + */ + protected $request; + + /** + * Response + * + * @var Response + */ + protected $response; + + /** + * Get the request + * + * @return Request + */ + public function getRequest() + { + return $this->request; + } + + /** + * Get the response + * + * @return Response + */ + public function getResponse() + { + return $this->response; + } + + /** + * Embedded bootstrap parts + * + * @see ApplicationBootstrap::bootstrap + * + * @return $this + */ + protected function bootstrap() + { + return $this + ->setupErrorHandling() + ->loadLibraries() + ->loadConfig() + ->setupLogging() + ->setupLogger() + ->setupRequest() + ->setupResponse() + ->setupTimezone() + ->prepareFakeInternationalization() + ->setupModuleManager() + ->loadEnabledModules(); + } + + /** + * Set the request + * + * @return $this + */ + protected function setupRequest() + { + $this->request = new Request(); + return $this; + } + + /** + * Set the response + * + * @return $this + */ + protected function setupResponse() + { + $this->response = new Response(); + return $this; + } + + /** + * Prepare fake internationalization + * + * @return $this + */ + protected function prepareFakeInternationalization() + { + StaticTranslator::$instance = new NoopTranslator(); + + return $this; + } +} -- cgit v1.2.3