Example #1
0
 /**
  * {@inheritdoc}
  *
  * TODO: a simple if does the job for now, in future this should move to a
  * chain of responsibility pattern or something similar.
  */
 public function find(Query $queryObject)
 {
     if ($queryObject instanceof SearchStringQuery) {
         if ($this->queryLogger->isEnabled()) {
             $this->queryLogger->logStringQuery($queryObject->getSearchTerm(), $queryObject->getRemoteAddress());
         }
         return $this->getResults($queryObject);
     }
     if ($queryObject instanceof TaxonQuery) {
         return $this->getResultsForTaxon($queryObject);
     }
     throw new \InvalidArgumentException("finder can't handle this currently, feel free to implement it!");
 }