Skip to content

Commit

Permalink
Tidy up client
Browse files Browse the repository at this point in the history
  • Loading branch information
petercoles committed May 12, 2016
1 parent cfafd25 commit 9cf7370
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/Http/Client.php
Expand Up @@ -242,7 +242,7 @@ public function setFlag($name, $flag)
*/
public function setDateRange($name, $range)
{
if ($range) {
if (!empty($range)) {
$this->options[ 'json' ][ $name ] = $range;
}
return $this;
Expand All @@ -260,7 +260,7 @@ public function setOrder($by, $direction = null)
if ($by) {
$this->options[ 'json' ][ 'orderBy' ] = $by;

if ($direction) {
if (!empty($direction)) {
$this->options[ 'json' ][ 'sortDir' ] = $direction;
}
}
Expand All @@ -270,20 +270,14 @@ public function setOrder($by, $direction = null)
/**
* Setter for record range.
*
* @param string $from
* @param string $count
* @param int $from
* @param int $count
* @return Client
*/
public function setRecordRange($from = null, $count = null)
public function setRecordRange($from = 0, $count = 1000)
{
if ($from) {
$this->options[ 'json' ][ 'fromRecord' ] = $from;
}

if ($count) {
$this->options[ 'json' ][ 'recordCount' ] = $count;
}

$this->options[ 'json' ][ 'fromRecord' ] = $from;
$this->options[ 'json' ][ 'recordCount' ] = $count;
return $this;
}

Expand Down

0 comments on commit 9cf7370

Please sign in to comment.