/**
  * Remove bad results
  * @param SearchCriteria $searchCriteria
  * @param Result[] $result
  * @return Result[]
  */
 private function filter(SearchCriteria $searchCriteria, array $result)
 {
     return array_filter($result, function (Result $e) use($searchCriteria) {
         $blacklist = explode(" ", $searchCriteria->getTitleBlacklist());
         foreach ($blacklist as $term) {
             if (strpos(strtolower($e->getTitle()), strtolower($term)) !== FALSE) {
                 return false;
             }
         }
         return true;
     });
 }
 /**
  * @inheritdoc
  */
 public function fetch(SearchCriteria $searchCriteria)
 {
     $agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
     // Get form cookies
     $jar = new \Requests_Cookie_Jar();
     $url = "http://m.homegate.ch/fr";
     Requests::GET($url, ["User-Agent" => $agent], ["cookies" => $jar]);
     $response = Requests::POST($this->url, ["Referer" => $url, "User-Agent" => $agent], ["searchForm_hf_0" => "", "offerType" => "radio31", "searchIn" => $searchCriteria->getLocality(), "searchObjectCategory" => "APARTMENT", "priceRangeField:minField" => $searchCriteria->getMin(), "priceRangeField:maxField" => $searchCriteria->getMax(), "roomRangeField:minField" => $searchCriteria->getSizeMin(), "roomRangeField:maxField" => $searchCriteria->getSizeMax(), "searchButtonUpper" => "", "peripheryField:periphery" => "", "surfaceLivingRangeField:minField" => "", "surfaceLivingRangeField:maxField" => "", "yearBuiltRangeField:minField" => "", "yearBuiltRangeField:maxField" => "", "floorField:floor" => "", "availableFromField:availableFrom" => ""], ["cookies" => $jar]);
     return $response;
 }
 /**
  * @inheritdoc
  */
 protected function fetch(SearchCriteria $searchCriteria)
 {
     $url = $this->url . "?fts=" . urlencode($searchCriteria->getTerm()) . "&loc=" . urlencode($searchCriteria->getLocality()) . "&sdc=10&aidl=15221&sf=dpo&so=d&p=0";
     return Requests::POST($url);
 }