vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/Entity/Analytics.php line 19

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\WebsiteBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use JMS\Serializer\Annotation\Exclude;
  14. use JMS\Serializer\Annotation\VirtualProperty;
  15. class Analytics implements AnalyticsInterface
  16. {
  17.     /**
  18.      * @var int
  19.      */
  20.     private $id;
  21.     /**
  22.      * @var string
  23.      */
  24.     private $title;
  25.     /**
  26.      * @var bool
  27.      */
  28.     private $allDomains;
  29.     /**
  30.      * @var mixed
  31.      *
  32.      * @Exclude
  33.      */
  34.     private $content;
  35.     /**
  36.      * @var string
  37.      */
  38.     private $type;
  39.     /**
  40.      * @var string
  41.      */
  42.     private $webspaceKey;
  43.     /**
  44.      * @var Collection|Domain[]
  45.      *
  46.      * @Exclude
  47.      */
  48.     private $domains;
  49.     public function __construct()
  50.     {
  51.         $this->domains = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function setTitle(string $title): AnalyticsInterface
  58.     {
  59.         $this->title $title;
  60.         return $this;
  61.     }
  62.     public function getTitle(): string
  63.     {
  64.         return $this->title;
  65.     }
  66.     public function setAllDomains(bool $allDomains): AnalyticsInterface
  67.     {
  68.         $this->allDomains $allDomains;
  69.         return $this;
  70.     }
  71.     public function isAllDomains(): bool
  72.     {
  73.         return $this->allDomains;
  74.     }
  75.     public function setContent($content): AnalyticsInterface
  76.     {
  77.         $this->content $content;
  78.         return $this;
  79.     }
  80.     public function getContent()
  81.     {
  82.         return $this->content;
  83.     }
  84.     public function setType(string $type): AnalyticsInterface
  85.     {
  86.         $this->type $type;
  87.         return $this;
  88.     }
  89.     public function getType(): string
  90.     {
  91.         return $this->type;
  92.     }
  93.     public function setWebspaceKey(string $webspaceKey): AnalyticsInterface
  94.     {
  95.         $this->webspaceKey $webspaceKey;
  96.         return $this;
  97.     }
  98.     public function getWebspaceKey(): string
  99.     {
  100.         return $this->webspaceKey;
  101.     }
  102.     public function addDomain(Domain $domain): AnalyticsInterface
  103.     {
  104.         if ($this->domains->contains($domain)) {
  105.             return $this;
  106.         }
  107.         $this->domains[] = $domain;
  108.         return $this;
  109.     }
  110.     public function removeDomain(Domain $domain): AnalyticsInterface
  111.     {
  112.         $this->domains->removeElement($domain);
  113.         return $this;
  114.     }
  115.     public function clearDomains(): AnalyticsInterface
  116.     {
  117.         $this->domains->clear();
  118.         return $this;
  119.     }
  120.     /**
  121.      * @VirtualProperty
  122.      */
  123.     public function getDomains(): ?Collection
  124.     {
  125.         if (=== \count($this->domains)) {
  126.             return null;
  127.         }
  128.         return $this->domains->map(function(Domain $domain) {
  129.             return $domain->getUrl();
  130.         });
  131.     }
  132. }