public function parse($remaining_metar, $cavok = false)
 {
     $result = $this->consume($remaining_metar);
     $found = $result['found'];
     $new_remaining_metar = $result['remaining'];
     // handle the case where nothing has been found
     if ($found == null) {
         $result = null;
     } else {
         // retrieve found params
         $weather = new WeatherPhenomenon();
         $weather->setCharacteristics($found[1]);
         for ($k = 2; $k <= 4; $k++) {
             if ($found[$k] != null) {
                 $weather->addType($found[$k]);
             }
         }
         $result = array('recentWeather' => $weather);
     }
     // return result + remaining metar
     return array('result' => $result, 'remaining_metar' => $new_remaining_metar);
 }
 public function parse($remaining_metar, $cavok = false)
 {
     $result = $this->consume($remaining_metar);
     $found = $result['found'];
     $new_remaining_metar = $result['remaining'];
     $present_weather = array();
     for ($i = 1; $i <= 13; $i += 6) {
         if ($found[$i] != null && $found[$i + 3] != '//') {
             $weather = new WeatherPhenomenon();
             $weather->setIntensityProximity($found[$i + 1]);
             $weather->setCharacteristics($found[$i + 2]);
             for ($k = 3; $k <= 5; $k++) {
                 if ($found[$i + $k] != null) {
                     $weather->addType($found[$i + $k]);
                 }
             }
             $present_weather[] = $weather;
         }
     }
     $result = array('presentWeather' => $present_weather);
     // return result + remaining metar
     return array('result' => $result, 'remaining_metar' => $new_remaining_metar);
 }