vendor/roothirsch/core-bundle/Site/SiteProvider.php line 74

Open in your IDE?
  1. <?php
  2. namespace Roothirsch\CoreBundle\Site;
  3. use Roothirsch\CoreBundle\Site\Repository\SiteRepository;
  4. use Symfony\Component\HttpFoundation\RequestStack;
  5. class SiteProvider
  6. {
  7.     /**
  8.      * @var Entity\Site|null
  9.      */
  10.     private $site;
  11.     /**
  12.      * Undocumented variable
  13.      *
  14.      * @var Request
  15.      */
  16.     protected $request;
  17.     /**
  18.      * @return string
  19.      */
  20.     public function getTitle()
  21.     {
  22.         return $this->site->getTitle();
  23.     }
  24.     /**
  25.      * @return string
  26.      */
  27.     public function getLogo()
  28.     {
  29.         return $this->site->getLogo();
  30.     }
  31.     /**
  32.      * @return string
  33.      */
  34.     public function getTheme()
  35.     {
  36.         if(!$this->request){
  37.             return $this->site->getTheme();
  38.         }
  39.         $overrideTheme $this->request->get('_override_theme'false);
  40.         if ($overrideTheme !== false) {
  41.             return $overrideTheme;
  42.         }
  43.         return $this->site->getTheme();
  44.     }
  45.     public function getWebsite(){
  46.         return $this->site->getWebsite();
  47.     }
  48.     public function getHostUrl(){
  49.         return $this->request->server->get("HTTP_ORIGIN");
  50.     }
  51.     public function getAddress(){
  52.         return $this->site->getAddress();
  53.     }
  54.     public function getCompany(){
  55.         return $this->site->getCompany();
  56.     }
  57.     /**
  58.      * SettingsProvider constructor.
  59.      */
  60.     public function __construct(SiteRepository $repositoryRequestStack $requestStack)
  61.     {
  62.         $this->site $repository->findOneBy(["id"=>1]);
  63.         $this->request $requestStack->getCurrentRequest();
  64.     }
  65. }