Skip to content
Permalink
Browse files

Change all the strings to use the constant values.

  • Loading branch information...
T0mats0 committed Mar 31, 2018
1 parent dc8506b commit 6ff34340127d785767be7a4993a6877c165c0f50
@@ -86,7 +86,7 @@ public function fetch($type = parent::FETCH_TYPE_NUM)
{
if ($this->_allFetched) {
$row = ($this->_counter < $this->_count) ? $this->_records[$this->_counter++] : false;
$row = ($row && $type === 'num') ? array_values($row) : $row;
$row = ($row && $type === parent::FETCH_TYPE_NUM) ? array_values($row) : $row;
return $row;
}
@@ -128,7 +128,7 @@ public function fetchObject()
* @param string $type The type to fetch.
* @return array
*/
public function fetchAll($type = 'num')
public function fetchAll($type = parent::FETCH_TYPE_NUM)
{
if ($this->_allFetched) {
return $this->_records;
@@ -149,7 +149,7 @@ public function rowCount()
{
if (!$this->_allFetched) {
$counter = $this->_counter;
while ($this->fetch('assoc')) {
while ($this->fetch(parent::FETCH_TYPE_ASSOC)) {
}
$this->_counter = $counter;
}
@@ -51,7 +51,7 @@ public function __construct($statement, $driver, $callback)
* @param string $type Either 'num' or 'assoc' to indicate the result format you would like.
* @return array|false
*/
public function fetch($type = 'num')
public function fetch($type = parent::FETCH_TYPE_NUM)
{
$callback = $this->_callback;
$row = $this->_statement->fetch($type);
@@ -67,7 +67,7 @@ public function fetch($type = 'num')
* @param string $type Either 'num' or 'assoc' to indicate the result format you would like.
* @return array
*/
public function fetchAll($type = 'num')
public function fetchAll($type = parent::FETCH_TYPE_NUM)
{
return array_map($this->_callback, $this->_statement->fetchAll($type));
}
@@ -88,7 +88,7 @@ public function bindValue($column, $value, $type = 'string')
* @return array|false Result array containing columns and values or false if no results
* are left
*/
public function fetch($type = 'num')
public function fetch($type = parent::FETCH_TYPE_NUM)
{
if ($type === static::FETCH_TYPE_NUM) {
return $this->_statement->fetch(PDO::FETCH_NUM);
@@ -117,7 +117,7 @@ public function fetch($type = 'num')
* @param string $type num for fetching columns as positional keys or assoc for column names as keys
* @return array list of all results from database for this statement
*/
public function fetchAll($type = 'num')
public function fetchAll($type = parent::FETCH_TYPE_NUM)
{
if ($type === static::FETCH_TYPE_NUM) {
return $this->_statement->fetchAll(PDO::FETCH_NUM);
@@ -210,7 +210,7 @@ public function execute($params = null)
* @return array|false Result array containing columns and values or false if no results
* are left
*/
public function fetch($type = 'num')
public function fetch($type = self::FETCH_TYPE_NUM)
{
return $this->_statement->fetch($type);
}
@@ -263,7 +263,7 @@ public function fetchColumn($position)
* @param string $type num for fetching columns as positional keys or assoc for column names as keys
* @return array List of all results from database for this statement
*/
public function fetchAll($type = 'num')
public function fetchAll($type = self::FETCH_TYPE_NUM)
{
return $this->_statement->fetchAll($type);
}
@@ -369,7 +369,7 @@ public function lastInsertId($table = null, $column = null)
{
$row = null;
if ($column && $this->columnCount()) {
$row = $this->fetch('assoc');
$row = $this->fetch(static::FETCH_TYPE_ASSOC);
}
if (isset($row[$column])) {
return $row[$column];

0 comments on commit 6ff3434

Please sign in to comment.
You can’t perform that action at this time.