/**
  * Weather object
  * @return \Runalyze\Data\Weather
  */
 public function Weather()
 {
     if (is_null($this->Weather)) {
         $id = $this->hasProperty('weatherid') ? $this->get('weatherid') : \Runalyze\Data\Weather\Condition::UNKNOWN;
         $temp = $this->hasProperty('temperature') ? $this->get('temperature') : null;
         $windSpeed = $this->hasProperty('wind_speed') ? $this->get('wind_speed') : null;
         $windDegree = $this->hasProperty('wind_deg') ? $this->get('wind_deg') : null;
         $humidity = $this->hasProperty('humidity') ? $this->get('humidity') : null;
         $pressure = $this->hasProperty('pressure') ? $this->get('pressure') : null;
         $sourceId = $this->hasProperty('weather_source') ? $this->get('weather_source') : null;
         $this->Weather = new \Runalyze\Data\Weather(new \Runalyze\Data\Weather\Temperature($temp), new \Runalyze\Data\Weather\Condition($id), new \Runalyze\Data\Weather\WindSpeed($windSpeed), new \Runalyze\Data\Weather\WindDegree($windDegree), new \Runalyze\Data\Weather\Humidity($humidity), new \Runalyze\Data\Weather\Pressure($pressure));
         $this->Weather->setSource($sourceId);
     }
     return $this->Weather;
 }
Exemple #2
0
 /**
  * Weather
  * @return \Runalyze\Data\Weather
  */
 public function weather()
 {
     if (is_null($this->Weather)) {
         $this->Weather = new Weather(new Weather\Temperature($this->Data[self::TEMPERATURE]), new Weather\Condition($this->Data[self::WEATHERID]), new Weather\WindSpeed($this->Data[self::WINDSPEED]), new Weather\WindDegree($this->Data[self::WINDDEG]), new Weather\Humidity($this->Data[self::HUMIDITY]), new Weather\Pressure($this->Data[self::PRESSURE]));
         $this->Weather->setSource($this->Data[self::WEATHER_SOURCE]);
     }
     return $this->Weather;
 }