]> Raphaël G. Git Repositories - airbundle/commitdiff
Add start, stop, premium, rainfall, rainrisk, realfeel, realfeelmin, realfeelmax...
authorRaphaël Gertz <git@rapsys.eu>
Tue, 8 Dec 2020 00:26:10 +0000 (01:26 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Tue, 8 Dec 2020 00:26:10 +0000 (01:26 +0100)
Add start and stop getter
Add premium, rainfall, rainrisk, realfeel, realfeelmin, realfeelmax, temperature, temperaturemin, temperaturemax getters and setters

Entity/Session.php

index 6a0f13895c3331ff2680ce9a05cc61814d258c25..e2ffc7afd72584d5cfdac4a6534dbd796bd7a72d 100644 (file)
@@ -21,11 +21,66 @@ class Session {
         */
        private $begin;
 
         */
        private $begin;
 
+       /**
+        * @var \DateTime
+        */
+       private $start = null;
+
        /**
         * @var \DateTime
         */
        private $length;
 
        /**
         * @var \DateTime
         */
        private $length;
 
+       /**
+        * @var \DateTime
+        */
+       private $stop = null;
+
+       /**
+        * @var boolean
+        */
+       private $premium;
+
+       /**
+        * @var float
+        */
+       private $rainfall;
+
+       /**
+        * @var float
+        */
+       private $rainrisk;
+
+       /**
+        * @var float
+        */
+       private $realfeel;
+
+       /**
+        * @var float
+        */
+       private $realfeelmin;
+
+       /**
+        * @var float
+        */
+       private $realfeelmax;
+
+       /**
+        * @var integer
+        */
+       private $temperature;
+
+       /**
+        * @var integer
+        */
+       private $temperaturemin;
+
+       /**
+        * @var integer
+        */
+       private $temperaturemax;
+
        /**
         * @var \DateTime
         */
        /**
         * @var \DateTime
         */
@@ -116,6 +171,30 @@ class Session {
                return $this->begin;
        }
 
                return $this->begin;
        }
 
+       /**
+        * Get start
+        *
+        * @return \DateTime
+        */
+       public function getStart() {
+               //Check start
+               if ($this->start !== null) {
+                       return $this->start;
+               }
+
+               //Clone date
+               $this->start = clone $this->date;
+
+               //Check if after slot
+               if ($this->slot->getTitle() == 'After') {
+                       //Add one day
+                       $this->start->add(new \DateInterval('P1D'));
+               }
+
+               //Return date
+               return $this->start->setTime($this->begin->format('H'), $this->begin->format('i'), $this->begin->format('s'));
+       }
+
        /**
         * Set length
         *
        /**
         * Set length
         *
@@ -138,6 +217,222 @@ class Session {
                return $this->length;
        }
 
                return $this->length;
        }
 
+       /**
+        * Get stop
+        *
+        * @return \DateTime
+        */
+       public function getStop() {
+               //Check start
+               if ($this->stop !== null) {
+                       return $this->stop;
+               }
+
+               //Get start clone
+               $this->stop = clone $this->getStart();
+
+               //Return date
+               return $this->stop->add(new \DateInterval('PT'.$this->length->format('H').'H'.$this->length->format('i').'M'.$this->length->format('s').'S'));
+       }
+
+       /**
+        * Set premium
+        *
+        * @param boolean $premium
+        *
+        * @return Session
+        */
+       public function setPremium($premium) {
+               $this->premium = $premium;
+
+               return $this;
+       }
+
+       /**
+        * Get premium
+        *
+        * @return boolean
+        */
+       public function getPremium() {
+               return $this->premium;
+       }
+
+       /**
+        * Set rainfall
+        *
+        * @param boolean $rainfall
+        *
+        * @return Session
+        */
+       public function setRainfall($rainfall) {
+               $this->rainfall = $rainfall;
+
+               return $this;
+       }
+
+       /**
+        * Get rainfall
+        *
+        * @return boolean
+        */
+       public function getRainfall() {
+               return $this->rainfall;
+       }
+
+       /**
+        * Set rainrisk
+        *
+        * @param boolean $rainrisk
+        *
+        * @return Session
+        */
+       public function setRainrisk($rainrisk) {
+               $this->rainrisk = $rainrisk;
+
+               return $this;
+       }
+
+       /**
+        * Get rainrisk
+        *
+        * @return boolean
+        */
+       public function getRainrisk() {
+               return $this->rainrisk;
+       }
+
+       /**
+        * Set realfeel
+        *
+        * @param integer $realfeel
+        *
+        * @return Session
+        */
+       public function setRealfeel($realfeel) {
+               $this->realfeel = $realfeel;
+
+               return $this;
+       }
+
+       /**
+        * Get realfeel
+        *
+        * @return integer
+        */
+       public function getRealfeel() {
+               return $this->realfeel;
+       }
+
+       /**
+        * Set realfeelmin
+        *
+        * @param integer $realfeelmin
+        *
+        * @return Session
+        */
+       public function setRealfeelmin($realfeelmin) {
+               $this->realfeelmin = $realfeelmin;
+
+               return $this;
+       }
+
+       /**
+        * Get realfeelmin
+        *
+        * @return integer
+        */
+       public function getRealfeelmin() {
+               return $this->realfeelmin;
+       }
+
+       /**
+        * Set realfeelmax
+        *
+        * @param integer $realfeelmax
+        *
+        * @return Session
+        */
+       public function setRealfeelmax($realfeelmax) {
+               $this->realfeelmax = $realfeelmax;
+
+               return $this;
+       }
+
+       /**
+        * Get realfeelmax
+        *
+        * @return integer
+        */
+       public function getRealfeelmax() {
+               return $this->realfeelmax;
+       }
+
+       /**
+        * Set temperature
+        *
+        * @param integer $temperature
+        *
+        * @return Session
+        */
+       public function setTemperature($temperature) {
+               $this->temperature = $temperature;
+
+               return $this;
+       }
+
+       /**
+        * Get temperature
+        *
+        * @return integer
+        */
+       public function getTemperature() {
+               return $this->temperature;
+       }
+
+       /**
+        * Set temperaturemin
+        *
+        * @param integer $temperaturemin
+        *
+        * @return Session
+        */
+       public function setTemperaturemin($temperaturemin) {
+               $this->temperaturemin = $temperaturemin;
+
+               return $this;
+       }
+
+       /**
+        * Get temperaturemin
+        *
+        * @return integer
+        */
+       public function getTemperaturemin() {
+               return $this->temperaturemin;
+       }
+
+       /**
+        * Set temperaturemax
+        *
+        * @param integer $temperaturemax
+        *
+        * @return Session
+        */
+       public function setTemperaturemax($temperaturemax) {
+               $this->temperaturemax = $temperaturemax;
+
+               return $this;
+       }
+
+       /**
+        * Get temperaturemax
+        *
+        * @return integer
+        */
+       public function getTemperaturemax() {
+               return $this->temperaturemax;
+       }
+
        /**
         * Set created
         *
        /**
         * Set created
         *