|  |  |  | 
|---|
|  |  |  | protected $xml; | 
|---|
|  |  |  | protected $dane; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | static $symbols = array( | 
|---|
|  |  |  | public static $symbols = array( | 
|---|
|  |  |  | 1 => 'Słonecznie', | 
|---|
|  |  |  | 2 => 'Lekkie zachmurzenie', | 
|---|
|  |  |  | 3 => 'Częściowe zachmurzenie', | 
|---|
|  |  |  | 
|---|
|  |  |  | 23 => 'Deszcz ze śniegiem, burze' | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | static $wind = array( | 
|---|
|  |  |  | public static $wind = array( | 
|---|
|  |  |  | 'N' => 'północny', | 
|---|
|  |  |  | 'NW' => 'północno-zachodni', | 
|---|
|  |  |  | 'W' => 'zachodni', | 
|---|
|  |  |  | 
|---|
|  |  |  | 'NE' => 'północno-wschodni', | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | static function wind($dir) { | 
|---|
|  |  |  | public static function wind($dir) { | 
|---|
|  |  |  | if(isset(self::$wind[$dir])) { | 
|---|
|  |  |  | return self::$wind[$dir]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function __construct($xml) { | 
|---|
|  |  |  | public function __construct($xml) { | 
|---|
|  |  |  | libxml_use_internal_errors(); | 
|---|
|  |  |  | $this->xml = simplexml_load_string($xml); | 
|---|
|  |  |  | libxml_clear_errors(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function mktime($time) { | 
|---|
|  |  |  | public function mktime($time) { | 
|---|
|  |  |  | return strtotime(substr($time, 0, -1)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function parseForecast() { | 
|---|
|  |  |  | public function parseForecast() { | 
|---|
|  |  |  | $this->dane = array( | 
|---|
|  |  |  | '0h' => array(), | 
|---|
|  |  |  | '3h' => array(), | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getCurrentIcon() { | 
|---|
|  |  |  | public function getCurrentIcon() { | 
|---|
|  |  |  | $now = time(); | 
|---|
|  |  |  | foreach($this->dane['3h'] as $value) { | 
|---|
|  |  |  | if($value['from'] <= $now && $now < $value['to']) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return NULL; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getCurrentWeather() { | 
|---|
|  |  |  | public function getCurrentWeather() { | 
|---|
|  |  |  | $dist = PHP_INT_MAX; | 
|---|
|  |  |  | $current = NULL; | 
|---|
|  |  |  | foreach($this->dane['0h'] as $time => $value) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return $current; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getDaypartWeather($timestamp) { | 
|---|
|  |  |  | public function getDaypartWeather($timestamp) { | 
|---|
|  |  |  | $start = strtotime('6:00', $timestamp); | 
|---|
|  |  |  | $dayend = strtotime('19:30', $timestamp); | 
|---|
|  |  |  | $end = $start + 22*3600; | 
|---|
|  |  |  | 
|---|
|  |  |  | return array('temp' => $temp, 'wind' => $wind); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getDaypartIcon($timestamp) { | 
|---|
|  |  |  | public function getDaypartIcon($timestamp) { | 
|---|
|  |  |  | $start = strtotime('6:00', $timestamp); | 
|---|
|  |  |  | $end = strtotime('24:00', $timestamp); | 
|---|
|  |  |  |  | 
|---|