public function searchOffers($mro) { try { //echo 'LMwebSoapClient search offer'; $result = $this->sc->searchOffers(array('mro' => $mro->getParamsAsArray()))->return; } catch (Exception $ex) { echo $ex->getMessage(); return null; } if ($result->offers->info == "NOHIT") { Template::errorTemplate("Keine Treffer gefunden"); return null; } if ($result->offers->offers != 0) { $cities = array(); if (is_array($result->offers->cityList)) { foreach ($result->offers->cityList as $value) { $city = new City($value->id, $value->minPrice, $value->name); $cities[$city->getId()] = $city; } } else { $city = new City($result->offers->cityList->id, $result->offers->cityList->minPrice, $result->offers->cityList->name); $cities[$city->getId()] = $city; } $offers = array(); if (is_array($result->offers->offersList)) { foreach ($result->offers->offersList as $value) { $offer = new Offer(); $offer->setParamsByArray($value); $offer->setCity($cities[$offer->getCity()]); array_push($offers, $offer); } } else { $offer = new Offer(); $offer->setParamsByArray($result->offers->offersList); $offer->setCity($cities[$offer->getCity()]); array_push($offers, $offer); } } else { Template::errorTemplate("Keine Treffer gefunden"); return null; } return $offers; }