Skip to content

Commit

Permalink
count bugs fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Steeven Andrian committed Oct 2, 2019
1 parent 05b340b commit 4029191
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/DataObjects/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ public function setNumTotal($totalRows)
*
* Gets first result row data.
*
* @return \O2System\Database\DataObjects\Result\Row
* @return \O2System\Database\DataObjects\Result\Row|null
*/
public function first()
{
$this->rewind();
if($this->count()) {
$this->rewind();

return $this->current();
return $this->current();
}
}

// ------------------------------------------------------------------------
Expand All @@ -121,10 +123,12 @@ public function first()
*/
public function last()
{
$index = $this->count() - 1;
if($this->count()) {
$index = $this->count() - 1;

if ($this->offsetExists($index)) {
return $this->offsetGet($index);
if ($this->offsetExists($index)) {
return $this->offsetGet($index);
}
}
}

Expand Down

0 comments on commit 4029191

Please sign in to comment.