src/Entity/MailProvider.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Dictionary\MailProviderStatus;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use JMS\Serializer\Annotation\Groups;
  6. /**
  7.  * @ORM\Table("MailProvider")
  8.  *
  9.  * @ORM\HasLifecycleCallbacks()
  10.  *
  11.  * @ORM\Entity(repositoryClass="App\Repository\MailProviderRepository")
  12.  */
  13. class MailProvider
  14. {
  15.     /**
  16.      * @Groups({"adminindex"})
  17.      *
  18.      * @ORM\Id()
  19.      *
  20.      * @ORM\GeneratedValue()
  21.      *
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @Groups({"adminindex"})
  27.      *
  28.      * @ORM\Column(type="string", length=100, unique=true)
  29.      */
  30.     private $name;
  31.     /**
  32.      * @Groups({"admindetail"})
  33.      *
  34.      * @ORM\Column(type="string", length=100, nullable=true)
  35.      */
  36.     private $contact_phone;
  37.     /**
  38.      * @Groups({"admindetail"})
  39.      *
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private $contact_url;
  43.     /**
  44.      * @Groups({"admindetail"})
  45.      *
  46.      * @ORM\Column(type="string", length=100, nullable=true)
  47.      */
  48.     private $contact_email;
  49.     /**
  50.      * @Groups({"admindetail"})
  51.      *
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private $guideline_url;
  55.     /**
  56.      * @Groups({"adminindex"})
  57.      *
  58.      * @ORM\Column(name="bounceStatus", type="smallint")
  59.      */
  60.     private $bounceStatus;
  61.     /**
  62.      * @Groups({"admindetail"})
  63.      *
  64.      * @ORM\Column(type="text")
  65.      */
  66.     private $domains;
  67.     /**
  68.      * @Groups({"adminindex"})
  69.      *
  70.      * @ORM\Column(name="createdAt", type="datetime")
  71.      */
  72.     private $created_at;
  73.     /**
  74.      * @Groups({"adminindex"})
  75.      */
  76.     private int $bounceCount = -1;
  77.     /**
  78.      * @Groups({"adminindex"})
  79.      * @ORM\Column(name="accountCount", type="integer")
  80.      */
  81.     private int $accountCount 0;
  82.     /**
  83.      * @Groups({"adminindex"})
  84.      *
  85.      * @ORM\Column(name="antiSpamLoginDelay", type="integer")
  86.      */
  87.     private $antiSpamLoginDelay;
  88.     /**
  89.      * @ORM\PrePersist()
  90.      */
  91.     public function prePersist()
  92.     {
  93.         $this->setCreatedAt(new \DateTime());
  94.     }
  95.     public function getId()
  96.     {
  97.         return $this->id;
  98.     }
  99.     public function getName(): ?string
  100.     {
  101.         return $this->name;
  102.     }
  103.     public function setName(string $name): self
  104.     {
  105.         $this->name $name;
  106.         return $this;
  107.     }
  108.     public function getContactPhone(): ?string
  109.     {
  110.         return $this->contact_phone;
  111.     }
  112.     public function setContactPhone(?string $contactPhone): self
  113.     {
  114.         $this->contact_phone $contactPhone;
  115.         return $this;
  116.     }
  117.     public function getContactUrl(): ?string
  118.     {
  119.         return $this->contact_url;
  120.     }
  121.     public function setContactUrl(?string $contact_url): self
  122.     {
  123.         $this->contact_url $contact_url;
  124.         return $this;
  125.     }
  126.     public function getContactEmail(): ?string
  127.     {
  128.         return $this->contact_email;
  129.     }
  130.     public function setContactEmail(?string $contact_email): self
  131.     {
  132.         $this->contact_email $contact_email;
  133.         return $this;
  134.     }
  135.     public function getGuidelineUrl(): ?string
  136.     {
  137.         return $this->guideline_url;
  138.     }
  139.     public function setGuidelineUrl(?string $guideline_url): self
  140.     {
  141.         $this->guideline_url $guideline_url;
  142.         return $this;
  143.     }
  144.     public function getBounceStatus(): ?int
  145.     {
  146.         return $this->bounceStatus;
  147.     }
  148.     public function setBounceStatus(int $bounceStatus): self
  149.     {
  150.         $this->bounceStatus $bounceStatus;
  151.         return $this;
  152.     }
  153.     public function getDomains(): ?string
  154.     {
  155.         return $this->domains;
  156.     }
  157.     public function setDomains(string $domains): self
  158.     {
  159.         $this->domains $domains;
  160.         return $this;
  161.     }
  162.     public function getCreatedAt(): ?\DateTimeInterface
  163.     {
  164.         return $this->created_at;
  165.     }
  166.     public function setCreatedAt(\DateTimeInterface $created_at): self
  167.     {
  168.         $this->created_at $created_at;
  169.         return $this;
  170.     }
  171.     /**
  172.      * @return int[]
  173.      */
  174.     public static function getBounceStates(): array
  175.     {
  176.         return [
  177.             MailProviderStatus::OK,
  178.             MailProviderStatus::BLOCKED,
  179.             MailProviderStatus::TEMP_ISSUES,
  180.             MailProviderStatus::MOGELMAIL,
  181.             MailProviderStatus::SPAMTRAP,
  182.             MailProviderStatus::TRASHMAIL,
  183.             MailProviderStatus::ANTI_SPAM,
  184.         ];
  185.     }
  186.     public static function getBounceStateChoices(): array
  187.     {
  188.         $keys self::getBounceStates();
  189.         return array_combine($keys, [
  190.             'OK',
  191.             'Blockiert',
  192.             'Temporäres Problem',
  193.             'Fehler lt. mogelmail.de',
  194.             'Spam Trap',
  195.             'Trashmail Anbieter',
  196.             'Double Opt-In',
  197.         ]);
  198.     }
  199.     /**
  200.      * @return mixed
  201.      */
  202.     public function getAntiSpamLoginDelay(): int {
  203.         return (int)$this->antiSpamLoginDelay;
  204.     }
  205.     
  206.     /**
  207.      * @param mixed $antiSpamLoginDelay 
  208.      * @return self
  209.      */
  210.     public function setAntiSpamLoginDelay(?int $antiSpamLoginDelay): self {
  211.         $this->antiSpamLoginDelay $antiSpamLoginDelay;
  212.         return $this;
  213.     }
  214.     /**
  215.      * @return int
  216.      */
  217.     public function getBounceCount(): int {
  218.         return $this->bounceCount;
  219.     }
  220.     
  221.     /**
  222.      * @param int $bounceCount 
  223.      * @return self
  224.      */
  225.     public function setBounceCount(int $bounceCount): self {
  226.         $this->bounceCount $bounceCount;
  227.         return $this;
  228.     }
  229.     /**
  230.      * @return int
  231.      */
  232.     public function getAccountCount(): int {
  233.         return $this->accountCount;
  234.     }
  235.     /**
  236.      * @param int $accountCount 
  237.      * @return self
  238.      */
  239.     public function setAccountCount(int $accountCount): self {
  240.         $this->accountCount $accountCount;
  241.         return $this;
  242.     }
  243. }