protected function getFormattedBatchParams($values)
 {
     $values = !empty($values) ? BatchValidator::formatBatch($values) : $values;
     $url = !empty($this->params) ? BatchValidator::formatUrlWithHttpParams($this->collectionUrl(), $this->params) : $this->collectionUrl();
     return array($url, $values);
 }
 public function testFormatUrlWithHttpEncodes()
 {
     $test = ['fileds' => 'id(>="2")'];
     $this->assertContains(http_build_query($test), BatchValidator::formatUrlWithHttpParams("test", $test));
 }
 /**
  * Delete collection
  *
  * @param $values
  *
  * @return mixed
  */
 public function deleteAll($values = array())
 {
     $values = BatchValidator::formatBatch($values);
     return $this->gateway->delete($this->collectionUrl(), $values);
 }
 /**
  * Do not fetch a large data set in memory to avoid exhaustion
  * Recommended: fetch each collection (1000 rows) and process
  *
  * @param array $params
  *
  * @return string
  * @throws InvalidCallException
  */
 public function fetchAll($params = array())
 {
     $this->validateFetchRequest();
     $this->params = BatchValidator::combine($params, $this->params);
     if ($this->isFiltered()) {
         $results = $this->gateway->read($this->collectionUrl(), $this->params);
     } elseif ($this->getLast) {
         $results = $this->collection->fetchLastInCollection($this->gateway, $this->collectionUrl(), $this->params);
         $this->getLast = false;
     } elseif ($this->getIncrement) {
         $results = $this->collection->fetchIncrement($this->gateway, $this->collectionUrl(), $this->params);
         $this->getIncrement = false;
     } else {
         $results = $this->collection->fetchCollection($this->gateway, $this->collectionUrl(), $this->params);
     }
     return $results;
 }