Skip to content

Commit 8e45c95

Browse files
committed
Trim whitespaces in the code
1 parent 20db85d commit 8e45c95

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

MysqliDb.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MysqliDb
2121
protected static $_instance;
2222
/**
2323
* Table prefix
24-
*
24+
*
2525
* @var string
2626
*/
2727
public static $prefix = '';
@@ -54,7 +54,7 @@ class MysqliDb
5454
*
5555
* @var array
5656
*/
57-
protected $_join = array();
57+
protected $_join = array();
5858
/**
5959
* An array that holds where conditions 'fieldname' => 'value'
6060
*
@@ -64,11 +64,11 @@ class MysqliDb
6464
/**
6565
* Dynamic type list for order by condition value
6666
*/
67-
protected $_orderBy = array();
67+
protected $_orderBy = array();
6868
/**
6969
* Dynamic type list for group by condition value
7070
*/
71-
protected $_groupBy = array();
71+
protected $_groupBy = array();
7272
/**
7373
* Dynamic array that holds a combination of where condition/table data value types and parameter references
7474
*
@@ -79,13 +79,13 @@ class MysqliDb
7979
* Variable which holds an amount of returned rows during get/getOne/select queries
8080
*
8181
* @var string
82-
*/
82+
*/
8383
public $count = 0;
8484
/**
8585
* Variable which holds an amount of returned rows during get/getOne/select queries with withTotalCount()
8686
*
8787
* @var string
88-
*/
88+
*/
8989
public $totalCount = 0;
9090
/**
9191
* Variable which holds last statement error
@@ -113,7 +113,7 @@ class MysqliDb
113113
protected $isSubQuery = false;
114114

115115
/**
116-
* Name of the auto increment column
116+
* Name of the auto increment column
117117
*
118118
*/
119119
protected $_lastInsertId = null;
@@ -240,7 +240,7 @@ protected function reset()
240240
$this->_where = array();
241241
$this->_join = array();
242242
$this->_orderBy = array();
243-
$this->_groupBy = array();
243+
$this->_groupBy = array();
244244
$this->_bindParams = array(''); // Create the empty 0 index
245245
$this->_query = null;
246246
$this->_queryOptions = array();
@@ -281,10 +281,10 @@ public function ObjectBuilder () {
281281
$this->returnType = 'Object';
282282
return $this;
283283
}
284-
284+
285285
/**
286286
* Method to set a prefix
287-
*
287+
*
288288
* @param string $prefix Contains a tableprefix
289289
*/
290290
public function setPrefix($prefix = '')
@@ -399,7 +399,7 @@ public function get($tableName, $numRows = null, $columns = '*')
399399
if (empty ($columns))
400400
$columns = '*';
401401

402-
$column = is_array($columns) ? implode(', ', $columns) : $columns;
402+
$column = is_array($columns) ? implode(', ', $columns) : $columns;
403403
$this->_tableName = self::$prefix . $tableName;
404404
$this->_query = 'SELECT ' . implode(' ', $this->_queryOptions) . ' ' .
405405
$column . " FROM " . $this->_tableName;
@@ -423,7 +423,7 @@ public function get($tableName, $numRows = null, $columns = '*')
423423
*
424424
* @return array Contains the returned rows from the select query.
425425
*/
426-
public function getOne($tableName, $columns = '*')
426+
public function getOne($tableName, $columns = '*')
427427
{
428428
$res = $this->get ($tableName, 1, $columns);
429429

@@ -444,7 +444,7 @@ public function getOne($tableName, $columns = '*')
444444
*
445445
* @return string Contains the value of a returned column.
446446
*/
447-
public function getValue($tableName, $column)
447+
public function getValue($tableName, $column)
448448
{
449449
$res = $this->ArrayBuilder()->get ($tableName, 1, "{$column} as retval");
450450

@@ -563,12 +563,12 @@ public function where($whereProp, $whereValue = 'DBNULL', $operator = '=', $cond
563563
return $this;
564564
}
565565

566-
/**
567-
* This function store update column's name and column name of the
566+
/**
567+
* This function store update column's name and column name of the
568568
* autoincrement column
569-
*
569+
*
570570
* @param Array Variable with values
571-
* @param String Variable value
571+
* @param String Variable value
572572
*/
573573
public function onDuplicate($_updateColumns, $_lastInsertId = null)
574574
{
@@ -632,7 +632,7 @@ public function orderBy($orderByField, $orderbyDirection = "DESC", $customFields
632632
$orderbyDirection = strtoupper (trim ($orderbyDirection));
633633
$orderByField = preg_replace ("/[^-a-z0-9\.\(\),_`]+/i",'', $orderByField);
634634

635-
// Add table prefix to orderByField if needed.
635+
// Add table prefix to orderByField if needed.
636636
//FIXME: We are adding prefix only if table is enclosed into `` to distinguish aliases
637637
// from table names
638638
$orderByField = preg_replace('/(\`)([`a-zA-Z0-9_]*\.)/', '\1' . self::$prefix. '\2', $orderByField);
@@ -650,7 +650,7 @@ public function orderBy($orderByField, $orderbyDirection = "DESC", $customFields
650650

651651
$this->_orderBy[$orderByField] = $orderbyDirection;
652652
return $this;
653-
}
653+
}
654654

655655
/**
656656
* This method allows you to specify multiple (method chaining optional) GROUP BY statements for SQL queries.
@@ -667,7 +667,7 @@ public function groupBy($groupByField)
667667

668668
$this->_groupBy[] = $groupByField;
669669
return $this;
670-
}
670+
}
671671

672672
/**
673673
* This methods returns the ID of the last inserted item
@@ -805,30 +805,30 @@ private function _buildInsert ($tableName, $insertData, $operation)
805805
return true;
806806
}
807807

808-
/**
808+
/**
809809
* Helper function to add variables into the query statement
810-
*
810+
*
811811
* @param Array Variable with values
812812
*/
813813
protected function _buildDuplicate($tableData)
814814
{
815815
if (is_array($this->_updateColumns) && !empty($this->_updateColumns)) {
816816
$this->_query .= " on duplicate key update ";
817817
if ($this->_lastInsertId) {
818-
$this->_lastQuery .= $this->_lastInsertId."=LAST_INSERT_ID(".$this->_lastInsertId."),";
818+
$this->_lastQuery .= $this->_lastInsertId."=LAST_INSERT_ID (".$this->_lastInsertId."),";
819819
$this->_lastInsertId = null;
820820
}
821-
821+
822822
foreach ($this->_updateColumns as $column) {
823823
$this->_query .= "`" . $column . "` = ";
824-
824+
825825
// Simple value
826826
if (!is_array ($tableData[$column])) {
827827
$this->_bindParam($tableData[$column]);
828828
$this->_query .= '?, ';
829829
continue;
830830
}
831-
831+
832832
// Function value
833833
$arr = $tableData[$column];
834834
$key = key($arr);
@@ -912,7 +912,7 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
912912

913913
// if $meta is false yet sqlstate is true, there's no sql error but the query is
914914
// most likely an update/insert/delete which doesn't produce any results
915-
if(!$meta && $stmt->sqlstate) {
915+
if(!$meta && $stmt->sqlstate) {
916916
return array();
917917
}
918918

@@ -1234,7 +1234,7 @@ public function getLastQuery () {
12341234

12351235
/**
12361236
* Method returns mysql error
1237-
*
1237+
*
12381238
* @return string
12391239
*/
12401240
public function getLastError () {
@@ -1246,7 +1246,7 @@ public function getLastError () {
12461246
/**
12471247
* Mostly internal method to get query and its params out of subquery object
12481248
* after get() and getAll()
1249-
*
1249+
*
12501250
* @return array
12511251
*/
12521252
public function getSubQuery () {
@@ -1321,7 +1321,7 @@ public function inc($num = 1) {
13211321
public function dec ($num = 1) {
13221322
return Array ("[I]" => "-" . (int)$num);
13231323
}
1324-
1324+
13251325
/**
13261326
* Method generates change boolean function call
13271327
* @param string column name. null by default

tests/mysqliDbTests.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
$db = new Mysqlidb(Array (
1313
'host' => 'localhost',
14-
'username' => 'root',
14+
'username' => 'root',
1515
'password' => '',
1616
'db' => 'testdb',
1717
'prefix' => $prefix,
@@ -380,7 +380,7 @@ function createTable ($name, $data) {
380380
$db->delete("users");
381381
$db->get("users");
382382
if ($db->count != 0) {
383-
echo "Invalid users count after delete";
383+
echo "Invalid users count after delete";
384384
exit;
385385
}
386386
$db->delete("products");

0 commit comments

Comments
 (0)