src/Frontend/Core/Engine/Frontend.php line 36

Open in your IDE?
  1. <?php
  2. namespace Frontend\Core\Engine;
  3. use ForkCMS\App\ApplicationInterface;
  4. use ForkCMS\App\KernelLoader;
  5. use Symfony\Component\HttpFoundation\Response;
  6. /**
  7.  * This class defines the frontend, it is the core. Everything starts here.
  8.  * We create all needed instances.
  9.  */
  10. class Frontend extends KernelLoader implements ApplicationInterface
  11. {
  12.     /**
  13.      * @var Page
  14.      */
  15.     private $page;
  16.     /**
  17.      * @return Response
  18.      */
  19.     public function display(): Response
  20.     {
  21.         return $this->page->display();
  22.     }
  23.     /**
  24.      * Initializes the entire frontend; preload FB, URL, template and the requested page.
  25.      *
  26.      * This method exists because the service container needs to be set before
  27.      * the page's functionality gets loaded.
  28.      */
  29.     public function initialize(): void
  30.     {
  31.         new Url($this->getKernel());
  32.         // Load the rest of the page.
  33.         $this->page = new Page($this->getKernel());
  34.         $this->page->load();
  35.     }
  36. }