@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * Declare information for FROM part and column will be get for main table |
145 | 145 | * |
146 | - * @param string|array $table Table name. |
|
146 | + * @param string $table Table name. |
|
147 | 147 | * It can be an array if a table shortcut is declared. |
148 | 148 | * In array mode, the format is ['asValue' => 'tableName'] |
149 | - * @param string|array $columns (default: "*") Columns will be get for |
|
149 | + * @param string $columns (default: "*") Columns will be get for |
|
150 | 150 | * the table declared in first argument |
151 | 151 | * |
152 | 152 | * @return \BfwSql\SqlSelect |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | /** |
297 | 297 | * Add information about the LIMIT part in request |
298 | 298 | * |
299 | - * @param array|integer $limit If it's a integer, the number of row to |
|
299 | + * @param integer $limit If it's a integer, the number of row to |
|
300 | 300 | * return. If an array, the format is [numberToStart, numberOfRowToReturn] |
301 | 301 | * |
302 | 302 | * @return \BfwSql\SqlSelect |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return \BfwSql\SqlSelect |
153 | 153 | */ |
154 | - public function from($table, $columns='*') |
|
154 | + public function from($table, $columns = '*') |
|
155 | 155 | { |
156 | 156 | $this->from = $this->obtainTableInfos($table); |
157 | 157 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return \BfwSql\SqlSelect |
245 | 245 | */ |
246 | - public function join($table, $joinOn, $joinColumns='*') |
|
246 | + public function join($table, $joinOn, $joinColumns = '*') |
|
247 | 247 | { |
248 | 248 | return $this->createJoin('join', $table, $joinOn, $joinColumns); |
249 | 249 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return \BfwSql\SqlSelect |
261 | 261 | */ |
262 | - public function joinLeft($table, $joinOn, $joinColumns='*') |
|
262 | + public function joinLeft($table, $joinOn, $joinColumns = '*') |
|
263 | 263 | { |
264 | 264 | return $this->createJoin('joinLeft', $table, $joinOn, $joinColumns); |
265 | 265 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return \BfwSql\SqlSelect |
277 | 277 | */ |
278 | - public function joinRight($table, $joinOn, $joinColumns='*') |
|
278 | + public function joinRight($table, $joinOn, $joinColumns = '*') |
|
279 | 279 | { |
280 | 280 | return $this->createJoin('joinRight', $table, $joinOn, $joinColumns); |
281 | 281 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $result = []; |
365 | 365 | $request = $this->execute(); //throw an Exception if error |
366 | 366 | |
367 | - while($row = $request->fetch($this->getPdoFetchType())) |
|
367 | + while ($row = $request->fetch($this->getPdoFetchType())) |
|
368 | 368 | { |
369 | 369 | $result[] = $row; |
370 | 370 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | protected function generateSelect() |
399 | 399 | { |
400 | 400 | $select = ''; |
401 | - foreach($this->select as $columnInfos) |
|
401 | + foreach ($this->select as $columnInfos) |
|
402 | 402 | { |
403 | 403 | if ($select != '') { |
404 | 404 | $select .= ', '; |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | |
407 | 407 | $select .= $columnInfos->column; |
408 | 408 | if ($columnInfos->shortcut !== null) { |
409 | - $select. ' AS '.$columnInfos->shortcut; |
|
409 | + $select.' AS '.$columnInfos->shortcut; |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
413 | - foreach($this->subQuery as $subQueryInfos) |
|
413 | + foreach ($this->subQuery as $subQueryInfos) |
|
414 | 414 | { |
415 | 415 | if ($select != '') { |
416 | 416 | $select .= ', '; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $joinSqlName = ' RIGHT JOIN '; |
462 | 462 | } |
463 | 463 | |
464 | - foreach($this->{$joinProperty} as $joinInfos) |
|
464 | + foreach ($this->{$joinProperty} as $joinInfos) |
|
465 | 465 | { |
466 | 466 | $join .= $joinSqlName.'`'.$joinInfos->tableName.'`'; |
467 | 467 | if ($joinInfos->shortcut !== null) { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | $group = ' GROUP BY '; |
512 | - foreach($this->group as $groupCondition) |
|
512 | + foreach ($this->group as $groupCondition) |
|
513 | 513 | { |
514 | 514 | if ($group != ' GROUP BY ') { |
515 | 515 | $group .= ', '; |
@@ -84,7 +84,7 @@ |
||
84 | 84 | * protected string. |
85 | 85 | * So we remove this quote at the start and the end of the string. |
86 | 86 | */ |
87 | - return substr($protectedString, 1, strlen($protectedString)-2); |
|
87 | + return substr($protectedString, 1, strlen($protectedString) - 2); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return integer |
66 | 66 | */ |
67 | - public function getLastInsertedId($name=null) |
|
67 | + public function getLastInsertedId($name = null) |
|
68 | 68 | { |
69 | 69 | return (int) $this->PDO->lastInsertId($name); |
70 | 70 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $table, |
85 | 85 | $colId, |
86 | 86 | $order, |
87 | - $where='' |
|
87 | + $where = '' |
|
88 | 88 | ) { |
89 | 89 | $req = $this->select() |
90 | 90 | ->from($table, $colId) |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return \BfwSql\SqlSelect |
126 | 126 | */ |
127 | - public function select($type='array') |
|
127 | + public function select($type = 'array') |
|
128 | 128 | { |
129 | 129 | return new SqlSelect($this->sqlConnect, $type); |
130 | 130 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return \BfwSql\SqlInsert |
140 | 140 | */ |
141 | - public function insert($table, $columns=null) |
|
141 | + public function insert($table, $columns = null) |
|
142 | 142 | { |
143 | 143 | return new SqlInsert($this->sqlConnect, $table, $columns); |
144 | 144 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return \BfwSql\SqlUpdate |
154 | 154 | */ |
155 | - public function update($table, $columns=null) |
|
155 | + public function update($table, $columns = null) |
|
156 | 156 | { |
157 | 157 | return new SqlUpdate($this->sqlConnect, $table, $columns); |
158 | 158 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | if ($res[$column] > 1) { |
197 | - return $res[$column]-1; |
|
197 | + return $res[$column] - 1; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $req2 = $this->select() |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $res2 = $req2->fetchRow(); |
206 | 206 | $req2->closeCursor(); |
207 | 207 | |
208 | - return $res2[$column]+1; |
|
208 | + return $res2[$column] + 1; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $req = $this->sqlConnect->PDO->query($request); |
225 | 225 | $error = $this->sqlConnect->PDO->errorInfo(); |
226 | 226 | |
227 | - if( |
|
227 | + if ( |
|
228 | 228 | !$req |
229 | 229 | && $error[0] != null |
230 | 230 | && $error[0] != '00000' |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $backtrace = []; |
106 | 106 | $backtraceInfos = debug_backtrace(); |
107 | 107 | |
108 | - foreach($backtraceInfos as $trace) |
|
108 | + foreach ($backtraceInfos as $trace) |
|
109 | 109 | { |
110 | 110 | $backtrace[] = $trace['file'].' : '.$trace['line']; |
111 | 111 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | $explainDatas = []; |
167 | - foreach($explainFetchAll[0] as $explainKey => $explainValue) { |
|
167 | + foreach ($explainFetchAll[0] as $explainKey => $explainValue) { |
|
168 | 168 | if (is_numeric($explainValue)) { |
169 | 169 | continue; |
170 | 170 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | $statusDatas = []; |
201 | - foreach($statusFetchAll as $statusRow) { |
|
201 | + foreach ($statusFetchAll as $statusRow) { |
|
202 | 202 | $statusKey = $statusRow['Variable_name']; |
203 | 203 | $statusValue = $statusRow['Value']; |
204 | 204 |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function requestIsAssembled() |
123 | 123 | { |
124 | - if($this->assembledRequest == '') |
|
124 | + if ($this->assembledRequest == '') |
|
125 | 125 | { |
126 | 126 | $this->assembleRequest(); |
127 | 127 | } |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return \BfwSql\SqlActions |
271 | 271 | */ |
272 | - public function where($filter, $preparedFilters=null) |
|
272 | + public function where($filter, $preparedFilters = null) |
|
273 | 273 | { |
274 | 274 | $this->where[] = $filter; |
275 | 275 | |
276 | - if(is_array($preparedFilters)) |
|
276 | + if (is_array($preparedFilters)) |
|
277 | 277 | { |
278 | 278 | $this->addPreparedFilters($preparedFilters); |
279 | 279 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | */ |
291 | 291 | protected function addPreparedFilters($preparedFilters) |
292 | 292 | { |
293 | - foreach($preparedFilters as $prepareKey => $prepareValue) |
|
293 | + foreach ($preparedFilters as $prepareKey => $prepareValue) |
|
294 | 294 | { |
295 | 295 | $this->preparedRequestArgs[$prepareKey] = $prepareValue; |
296 | 296 | } |