src/Model/AutoresponderAdvRule.php line 446

Open in your IDE?
  1. <?php
  2. namespace App\Model;
  3. class AutoresponderAdvRule implements \JsonSerializable
  4. {
  5.     const NOT_ACTIVE_PREFIX '_NA_';
  6.     
  7.     private $id;
  8.     private $idAutoresponder;
  9.     private $userName;
  10.     private $userDomain;
  11.     private $fromName;
  12.     private $fromEmail;
  13.     private $subject// type of subject prefix (Re: / Odp: / Reception of message: / user's prefix) or null if user has his own subject (kept in ownSubject variable)
  14.     private $ownSubject// user'a own subject
  15.     private $message;
  16.     private $copy;
  17.     private $copyLines;
  18.     private $activationType;
  19.     private $activeFrom;
  20.     private $activeFromHour;
  21.     private $activeFromMinute;
  22.     private $activeTo;
  23.     private $activeToHour;
  24.     private $activeToMinute;
  25.     private $periodWeeks;
  26.     private $periodDays;
  27.     private $periodHours;
  28.     private $messagesLimit;
  29.     private $active;
  30.     private $activationHour;
  31.     private $activationMinute;
  32.     private $activeOnce;
  33.     private $activeOnceConsumed;
  34.     private $activeDay1;
  35.     private $activeDay2;
  36.     private $activeDay3;
  37.     private $activeDay4;
  38.     private $activeDay5;
  39.     private $activeDay6;
  40.     private $activeDay7;
  41.     private $ruleType;
  42.     
  43.     /**
  44.      * @return mixed
  45.      */
  46.     public function getIdAutoresponder()
  47.     {
  48.         return $this->idAutoresponder;
  49.     }
  50.     public function getActivationHour() {
  51.         return $this->activationHour;
  52.     }
  53.     public function getActivationMinute() {
  54.         return $this->activationMinute;
  55.     }
  56.     public function getActiveOnce() {
  57.         return $this->activeOnce;
  58.     }
  59.     public function getActiveOnceConsumed() {
  60.         return $this->activeOnceConsumed;
  61.     }
  62.     public function getActiveDay1() {
  63.         return $this->activeDay1;
  64.     }
  65.     public function getActiveDay2() {
  66.         return $this->activeDay2;
  67.     }
  68.     public function getActiveDay3() {
  69.         return $this->activeDay3;
  70.     }
  71.     public function getActiveDay4() {
  72.         return $this->activeDay4;
  73.     }
  74.     public function getActiveDay5() {
  75.         return $this->activeDay5;
  76.     }
  77.     public function getActiveDay6() {
  78.         return $this->activeDay6;
  79.     }
  80.     public function getActiveDay7() {
  81.         return $this->activeDay7;
  82.     }
  83.     public function getRuleType() {
  84.         return $this->ruleType;
  85.     }
  86.     public function getMessage() {
  87.         return $this->message;
  88.     }
  89.     public function setActivationHour($activationHour) {
  90.         $this->activationHour $activationHour;
  91.     }
  92.     public function setActivationMinute($activationMinute) {
  93.         $this->activationMinute $activationMinute;
  94.     }
  95.     public function setActiveOnce($activeOnce) {
  96.         $this->activeOnce $activeOnce;
  97.     }
  98.     public function setActiveOnceConsumed($activeOnceConsumed) {
  99.         $this->activeOnceConsumed $activeOnceConsumed;
  100.     }
  101.     public function setActiveDay1($activeDay1) {
  102.         $this->activeDay1 $activeDay1;
  103.     }
  104.     public function setActiveDay2($activeDay2) {
  105.         $this->activeDay2 $activeDay2;
  106.     }
  107.     public function setActiveDay3($activeDay3) {
  108.         $this->activeDay3 $activeDay3;
  109.     }
  110.     public function setActiveDay4($activeDay4) {
  111.         $this->activeDay4 $activeDay4;
  112.     }
  113.     public function setActiveDay5($activeDay5) {
  114.         $this->activeDay5 $activeDay5;
  115.     }
  116.     public function setActiveDay6($activeDay6) {
  117.         $this->activeDay6 $activeDay6;
  118.     }
  119.     public function setActiveDay7($activeDay7) {
  120.         $this->activeDay7 $activeDay7;
  121.     }
  122.     public function setRuleType($ruleType) {
  123.         $this->ruleType $ruleType;
  124.     }
  125.     public function setMessage($message) {
  126.         $this->message $message;
  127.     }
  128.     
  129.     /**
  130.      * @return mixed
  131.      */
  132.     public function getActiveFromHour()
  133.     {
  134.         return $this->activeFromHour;
  135.     }
  136.     /**
  137.      * @return mixed
  138.      */
  139.     public function getActiveFromMinute()
  140.     {
  141.         return $this->activeFromMinute;
  142.     }
  143.     /**
  144.      * @return mixed
  145.      */
  146.     public function getActiveToHour()
  147.     {
  148.         return $this->activeToHour;
  149.     }
  150.     /**
  151.      * @return mixed
  152.      */
  153.     public function getActiveToMinute()
  154.     {
  155.         return $this->activeToMinute;
  156.     }
  157.     /**
  158.      * @param mixed $activeFromHour
  159.      */
  160.     public function setActiveFromHour($activeFromHour)
  161.     {
  162.         $this->activeFromHour $activeFromHour;
  163.     }
  164.     /**
  165.      * @param mixed $activeFromMinute
  166.      */
  167.     public function setActiveFromMinute($activeFromMinute)
  168.     {
  169.         $this->activeFromMinute $activeFromMinute;
  170.     }
  171.     /**
  172.      * @param mixed $activeToHour
  173.      */
  174.     public function setActiveToHour($activeToHour)
  175.     {
  176.         $this->activeToHour $activeToHour;
  177.     }
  178.     /**
  179.      * @param mixed $activeToMinute
  180.      */
  181.     public function setActiveToMinute($activeToMinute)
  182.     {
  183.         $this->activeToMinute $activeToMinute;
  184.     }
  185.     public function __construct()
  186.     {
  187.         $this->active false;
  188.     }
  189.     public function getId() : int
  190.     {
  191.         return $this->id;
  192.     }
  193.     
  194.     public function setId($id): self
  195.     {
  196.         $this->id $id;
  197.         return $this;
  198.     }
  199.     
  200.     public function getUserName(): ?string
  201.     {
  202.         return $this->userName;
  203.     }
  204.     
  205.     public function setUserName(string $userName): self
  206.     {
  207.         $this->userName $userName;
  208.         
  209.         return $this;
  210.     }
  211.     
  212.     public function getUserDomain(): ?string
  213.     {
  214.         return $this->userDomain;
  215.     }
  216.     
  217.     public function setUserDomain(string $userDomain): self
  218.     {
  219.         $this->userDomain $userDomain;
  220.         
  221.         return $this;
  222.     }
  223.     
  224.     public function getFromName(): ?string
  225.     {
  226.         return $this->fromName;
  227.     }
  228.     
  229.     public function setFromName(string $fromName): self
  230.     {
  231.         $this->fromName $fromName;
  232.         
  233.         return $this;
  234.     }
  235.     
  236.     public function getFromEmail(): ?string
  237.     {
  238.         return $this->fromEmail;
  239.     }
  240.     
  241.     public function setFromEmail(string $fromEmail): self
  242.     {
  243.         $this->fromEmail $fromEmail;
  244.         
  245.         return $this;
  246.     }
  247.     
  248.     public function getSubject(): ?string
  249.     {
  250.         return $this->subject;
  251.     }
  252.     
  253.     public function setSubject(string $subject): self
  254.     {
  255.         $this->subject $subject;
  256.         
  257.         return $this;
  258.     }
  259.     
  260.     public function getOwnSubject(): ?string
  261.     {
  262.         return $this->ownSubject;
  263.     }
  264.     
  265.     public function setOwnSubject(string $subject): self
  266.     {
  267.         $this->ownSubject $subject;
  268.         
  269.         return $this;
  270.     }
  271.     public function getCopy(): ?bool
  272.     {
  273.         return $this->copy;
  274.     }
  275.     
  276.     public function setCopy(bool $copy): self
  277.     {
  278.         $this->copy $copy;
  279.         
  280.         return $this;
  281.     }
  282.     
  283.     public function getCopyLines(): ?int
  284.     {
  285.         return $this->copyLines;
  286.     }
  287.     
  288.     public function setCopyLines(int $copyLines): self
  289.     {
  290.         $this->copyLines $copyLines;
  291.         return $this;
  292.     }
  293.     
  294.     public function getActivationType(): ?string
  295.     {
  296.         return $this->activationType;
  297.     }
  298.     
  299.     public function setActivationType(string $activationType): self
  300.     {
  301.         $this->activationType $activationType;
  302.         
  303.         return $this;
  304.     }
  305.     
  306.     public function getActiveFrom(): ?\DateTime
  307.     {
  308.         return $this->activeFrom;
  309.     }
  310.     
  311.     public function setActiveFrom(?\DateTime $activeFrom): self
  312.     {
  313.         $this->activeFrom $activeFrom;
  314.         
  315.         return $this;
  316.     }
  317.     
  318.     public function getActiveTo(): ?\DateTime
  319.     {
  320.         return $this->activeTo;
  321.     }
  322.     
  323.     public function setActiveTo(?\DateTime $activeTo): self
  324.     {
  325.         $this->activeTo $activeTo;
  326.         
  327.         return $this;
  328.     }
  329.     
  330.     public function getPeriodWeeks(): ?int
  331.     {
  332.         return $this->periodWeeks;
  333.     }
  334.     
  335.     public function setPeriodWeeks(int $periodWeeks): self
  336.     {
  337.         $this->periodWeeks $periodWeeks;
  338.         
  339.         return $this;
  340.     }
  341.     
  342.     public function getPeriodDays(): ?int
  343.     {
  344.         return $this->periodDays;
  345.     }
  346.     
  347.     public function setPeriodDays(int $periodDays): self
  348.     {
  349.         $this->periodDays $periodDays;
  350.         
  351.         return $this;
  352.     }
  353.     
  354.     public function getPeriodHours(): ?int
  355.     {
  356.         return $this->periodHours;
  357.     }
  358.     
  359.     public function setPeriodHours(int $periodHours): self
  360.     {
  361.         $this->periodHours $periodHours;
  362.         
  363.         return $this;
  364.     }
  365.     
  366.     public function getMessagesLimit(): ?int
  367.     {
  368.         return $this->messagesLimit;
  369.     }
  370.     
  371.     public function setMessagesLimit(int $messagesLimit): self
  372.     {
  373.         $this->messagesLimit $messagesLimit;
  374.         
  375.         return $this;
  376.     }
  377.     
  378.     public function getActive(): ?bool
  379.     {
  380.         return $this->active;
  381.     }
  382.     
  383.     public function setActive(bool $active): self
  384.     {
  385.         $this->active $active;
  386.         
  387.         return $this;
  388.     }
  389.     
  390.     public function timeLimit()
  391.     {
  392.         return ($this->periodWeeks 24 $this->periodDays 24 $this->periodHours) * 3600;
  393.     }
  394.     
  395.     public function jsonSerialize()
  396.     {
  397.         $vars get_object_vars($this);
  398.         return $vars;
  399.     }
  400.     
  401.     public function getActiveFromWithMinutes()
  402.     {
  403.         $af $this->getActiveFrom();
  404.         $af->setTime($this->getActiveFromHour(), $this->getActiveFromMinute());
  405.         return $af;
  406.     }
  407.     
  408.     public function getActiveToWithMinutes()
  409.     {
  410.         $at $this->getActiveTo();
  411.         $at->setTime($this->getActiveToHour(), $this->getActiveToMinute());
  412.         return $at;
  413.     }
  414.     
  415.     public static function timelimitSplit(int $timelimit) : Array
  416.     {
  417.         $hours $timelimit 3600;
  418.         $days 0;
  419.         $weeks 0;
  420.         
  421.         if($hours >= 24) {
  422.             $days = (int) ($hours 24);
  423.         }
  424.         
  425.         if($days >= 7) {
  426.             $weeks = (int)($days 7);
  427.             $days $days - ($weeks 7);
  428.         }
  429.         
  430.         $hours $hours - ($days 24) - ($weeks 24 7);
  431.         
  432.         $arr = [];
  433.         $arr['weeks'] = $weeks;
  434.         $arr['days'] = $days;
  435.         $arr['hours'] = $hours;
  436.         
  437.         return $arr;
  438.     }
  439.     
  440.     
  441.     
  442. }