Beispiel #1
0
 protected function parser($data)
 {
     $terms = new Terms();
     foreach ($data->previsao as $key => $value) {
         array_push($this->items, new Dates(Parse::toDate((string) $value->dia), (double) $value->iuv, (double) $value->minima, (double) $value->maxima, new Term((string) $value->tempo, $terms->get((string) $value->tempo))));
     }
     unset($terms);
 }
Beispiel #2
0
 public function __construct($xml, $id)
 {
     $data = simplexml_load_string($xml);
     if (is_object($data) && 'SimpleXMLElement' === get_class($data)) {
         $this->id = $id;
         $this->city = (string) $data->nome;
         $this->uf = (string) $data->uf;
         $this->updated = Parse::toDate((string) $data->atualizacao);
         $this->dates = new CollectionDates($data);
     } else {
         throw new WeatherException("Class inválid");
     }
 }
Beispiel #3
0
 public function cities($name)
 {
     $name = Parse::normalize($name);
     $xml = $this->client->download(str_replace("{0}", $name, self::citiesUrl));
     return new CollectionCities($xml);
 }