for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phossa Project
*
* PHP version 5.4
* @category Library
* @package Phossa2\Db
* @copyright Copyright (c) 2016 phossa.com
* @license http://mit-license.org/ MIT License
* @link http://www.phossa.com/
*/
/*# declare(strict_types=1); */
namespace Phossa2\Db\Driver\Pdo;
use Phossa2\Db\Driver\ResultAbstract;
* Result
* @author Hong Zhang <[email protected]>
* @see ResultAbstract
* @version 2.0.0
* @since 2.0.0 added
class Result extends ResultAbstract
{
* @var \PDOStatement
* @access protected
protected $statement;
* Invoke to set statement
* @param \PDOStatement $statement
* @return $this
* @access public
public function __invoke(\PDOStatement $statement)
$this->statement = $statement;
return $this;
}
* {@inheritDoc}
public function fieldCount()/*# : int */
return $this->statement->columnCount();
public function rowCount()/*# : int */
if ($this->statement) {
return $this->statement->rowCount();
return 0;
public function affectedRows()/*# : int */
protected function realFetchAll()/*# : array */
return $this->statement->fetchAll(\PDO::FETCH_ASSOC);
protected function realFetchRow($rowCount)/*# : array */
$result = [];
$count = 0;
while ($count++ < $rowCount) {
$row = $this->statement->fetch(\PDO::FETCH_ASSOC);
if (false === $row) {
break;
$result[] = $row;
return $result;