/**
  * @param SelectQueryParameters $query
  * @param mixed[]
  * @return mixed[]
  * @throws InvalidArgumentException
  */
 public function processResults(SelectQueryParameters $query, $results)
 {
     if (!ArrayHelper::isIterable($results)) {
         throw new InvalidArgumentException("Results should be iterable.");
     }
     if ($query->isReverse()) {
         $results = ArrayHelper::reverse($results);
     }
     // Set the first and the last values
     if (count($results) > 0) {
         $this->setFirst($results[0]);
         $this->setLast($results[count($results) - 1]);
     }
     return $results;
 }