for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace CouchDB\DesignDocument;
/**
* @author Markus Bachmann <[email protected]>
*/
class Result implements ResultInterface
{
* @var array
protected $data;
* Constructor.
*
* @param array $data
public function __construct(array $data)
$this->data = $data;
}
* Return the total amount of rows.
* @return int
public function getTotalRows()
return $this->data['total_rows'];
* Gets the offset.
public function getOffset()
return $this->data['offset'];
* Return all rows.
* @return array
public function getRows()
return $this->data['rows'];
* Return the first row.
* @return bool|array
public function getFirstRow()
$rows = $this->data['rows'];
if (empty($rows)) {
return false;
$row = array_slice($rows, 0, 1);
return current($row);
* Return the last row.
public function getLastRow()
$row = array_slice($rows, count($rows) - 1);
* Return the array.
public function toArray()
return $this->data;
* {@inheritdoc}
public function getIterator()
return new \ArrayIterator($this->data['rows']);
public function count()
return count($this->data['rows']);