@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | |
184 | 184 | $trace = debug_backtrace(); |
185 | 185 | throw new \Exception( |
186 | - 'Undefined property via __get(): ' . $name . |
|
187 | - ' in ' . $trace[0]['file'] . |
|
188 | - ' on line ' . $trace[0]['line'], |
|
186 | + 'Undefined property via __get(): '.$name. |
|
187 | + ' in '.$trace[0]['file']. |
|
188 | + ' on line '.$trace[0]['line'], |
|
189 | 189 | 1 |
190 | 190 | ); |
191 | 191 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ($part === '*') { |
311 | 311 | return $part; |
312 | 312 | } |
313 | - return static::$_identifier_quote_character . $part . static::$_identifier_quote_character; |
|
313 | + return static::$_identifier_quote_character.$part.static::$_identifier_quote_character; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | { |
323 | 323 | $class = get_called_class(); |
324 | 324 | if (!isset(self::$_tableColumns[$class])) { |
325 | - $st = static::execute('DESCRIBE ' . static::_quote_identifier(static::$_tableName)); |
|
325 | + $st = static::execute('DESCRIBE '.static::_quote_identifier(static::$_tableName)); |
|
326 | 326 | self::$_tableColumns[$class] = $st->fetchAll(\PDO::FETCH_COLUMN); |
327 | 327 | } |
328 | 328 | return self::$_tableColumns[$class]; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | static public function getById($id) |
390 | 390 | { |
391 | - return static::fetchOneWhere(static::_quote_identifier(static::$_primary_column_name) . ' = ?', array($id)); |
|
391 | + return static::fetchOneWhere(static::_quote_identifier(static::$_primary_column_name).' = ?', array($id)); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | static public function first() |
400 | 400 | { |
401 | - return static::fetchOneWhere('1=1 ORDER BY ' . static::_quote_identifier(static::$_primary_column_name) . ' ASC'); |
|
401 | + return static::fetchOneWhere('1=1 ORDER BY '.static::_quote_identifier(static::$_primary_column_name).' ASC'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | */ |
409 | 409 | static public function last() |
410 | 410 | { |
411 | - return static::fetchOneWhere('1=1 ORDER BY ' . static::_quote_identifier(static::$_primary_column_name) . ' DESC'); |
|
411 | + return static::fetchOneWhere('1=1 ORDER BY '.static::_quote_identifier(static::$_primary_column_name).' DESC'); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | */ |
421 | 421 | static public function find($id) |
422 | 422 | { |
423 | - $find_by_method = 'find_by_' . (static::$_primary_column_name); |
|
423 | + $find_by_method = 'find_by_'.(static::$_primary_column_name); |
|
424 | 424 | static::$find_by_method($id); |
425 | 425 | } |
426 | 426 | |
@@ -465,12 +465,12 @@ discard block |
||
465 | 465 | $fieldname = substr($name, 9); // remove find by |
466 | 466 | $match = $arguments[0]; |
467 | 467 | if (is_array($match)) { |
468 | - return static::countAllWhere(static::_quote_identifier($fieldname) . ' IN (' . static::createInClausePlaceholders($match) . ')', $match); |
|
468 | + return static::countAllWhere(static::_quote_identifier($fieldname).' IN ('.static::createInClausePlaceholders($match).')', $match); |
|
469 | 469 | } else { |
470 | - return static::countAllWhere(static::_quote_identifier($fieldname) . ' = ?', array($match)); |
|
470 | + return static::countAllWhere(static::_quote_identifier($fieldname).' = ?', array($match)); |
|
471 | 471 | } |
472 | 472 | } |
473 | - throw new \Exception(__CLASS__ . ' not such static method[' . $name . ']'); |
|
473 | + throw new \Exception(__CLASS__.' not such static method['.$name.']'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -485,9 +485,9 @@ discard block |
||
485 | 485 | public static function fetchOneWhereMatchingSingleField($fieldname, $match, $order) |
486 | 486 | { |
487 | 487 | if (is_array($match)) { |
488 | - return static::fetchOneWhere(static::_quote_identifier($fieldname) . ' IN (' . static::createInClausePlaceholders($match) . ') ORDER BY ' . static::_quote_identifier($fieldname) . ' ' . $order, $match); |
|
488 | + return static::fetchOneWhere(static::_quote_identifier($fieldname).' IN ('.static::createInClausePlaceholders($match).') ORDER BY '.static::_quote_identifier($fieldname).' '.$order, $match); |
|
489 | 489 | } else { |
490 | - return static::fetchOneWhere(static::_quote_identifier($fieldname) . ' = ? ORDER BY ' . static::_quote_identifier($fieldname) . ' ' . $order, array($match)); |
|
490 | + return static::fetchOneWhere(static::_quote_identifier($fieldname).' = ? ORDER BY '.static::_quote_identifier($fieldname).' '.$order, array($match)); |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | public static function fetchAllWhereMatchingSingleField($fieldname, $match) |
504 | 504 | { |
505 | 505 | if (is_array($match)) { |
506 | - return static::fetchAllWhere(static::_quote_identifier($fieldname) . ' IN (' . static::createInClausePlaceholders($match) . ')', $match); |
|
506 | + return static::fetchAllWhere(static::_quote_identifier($fieldname).' IN ('.static::createInClausePlaceholders($match).')', $match); |
|
507 | 507 | } else { |
508 | - return static::fetchAllWhere(static::_quote_identifier($fieldname) . ' = ?', array($match)); |
|
508 | + return static::fetchAllWhere(static::_quote_identifier($fieldname).' = ?', array($match)); |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | */ |
529 | 529 | static public function count() |
530 | 530 | { |
531 | - $st = static::execute('SELECT COUNT(*) FROM ' . static::_quote_identifier(static::$_tableName)); |
|
532 | - return (int)$st->fetchColumn(0); |
|
531 | + $st = static::execute('SELECT COUNT(*) FROM '.static::_quote_identifier(static::$_tableName)); |
|
532 | + return (int) $st->fetchColumn(0); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | /** |
@@ -543,8 +543,8 @@ discard block |
||
543 | 543 | static public function countAllWhere($SQLfragment = '', $params = array()) |
544 | 544 | { |
545 | 545 | $SQLfragment = self::addWherePrefix($SQLfragment); |
546 | - $st = static::execute('SELECT COUNT(*) FROM ' . static::_quote_identifier(static::$_tableName) . $SQLfragment, $params); |
|
547 | - return (int)$st->fetchColumn(0); |
|
546 | + $st = static::execute('SELECT COUNT(*) FROM '.static::_quote_identifier(static::$_tableName).$SQLfragment, $params); |
|
547 | + return (int) $st->fetchColumn(0); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | /** |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | */ |
557 | 557 | static protected function addWherePrefix($SQLfragment) |
558 | 558 | { |
559 | - return $SQLfragment ? ' WHERE ' . $SQLfragment : $SQLfragment; |
|
559 | + return $SQLfragment ? ' WHERE '.$SQLfragment : $SQLfragment; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $class = get_called_class(); |
575 | 575 | $SQLfragment = self::addWherePrefix($SQLfragment); |
576 | 576 | $st = static::execute( |
577 | - 'SELECT * FROM ' . static::_quote_identifier(static::$_tableName) . $SQLfragment . ($limitOne ? ' LIMIT 1' : ''), |
|
577 | + 'SELECT * FROM '.static::_quote_identifier(static::$_tableName).$SQLfragment.($limitOne ? ' LIMIT 1' : ''), |
|
578 | 578 | $params |
579 | 579 | ); |
580 | 580 | $st->setFetchMode(\PDO::FETCH_ASSOC); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | static public function deleteById($id) |
623 | 623 | { |
624 | 624 | $st = static::execute( |
625 | - 'DELETE FROM ' . static::_quote_identifier(static::$_tableName) . ' WHERE ' . static::_quote_identifier(static::$_primary_column_name) . ' = ? LIMIT 1', |
|
625 | + 'DELETE FROM '.static::_quote_identifier(static::$_tableName).' WHERE '.static::_quote_identifier(static::$_primary_column_name).' = ? LIMIT 1', |
|
626 | 626 | array($id) |
627 | 627 | ); |
628 | 628 | return ($st->rowCount() == 1); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | static public function deleteAllWhere($where, $params = array()) |
650 | 650 | { |
651 | 651 | $st = static::execute( |
652 | - 'DELETE FROM ' . static::_quote_identifier(static::$_tableName) . ' WHERE ' . $where, |
|
652 | + 'DELETE FROM '.static::_quote_identifier(static::$_tableName).' WHERE '.$where, |
|
653 | 653 | $params |
654 | 654 | ); |
655 | 655 | return $st; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $this->$pk = null; // ensure id is null |
690 | 690 | } |
691 | 691 | $set = $this->setString(!$allowSetPrimaryKey); |
692 | - $query = 'INSERT INTO ' . static::_quote_identifier(static::$_tableName) . ' SET ' . $set['sql']; |
|
692 | + $query = 'INSERT INTO '.static::_quote_identifier(static::$_tableName).' SET '.$set['sql']; |
|
693 | 693 | $st = static::execute($query, $set['params']); |
694 | 694 | if ($st->rowCount() == 1) { |
695 | 695 | $this->{static::$_primary_column_name} = static::$_db->lastInsertId(); |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | } |
713 | 713 | $this->validate(); |
714 | 714 | $set = $this->setString(); |
715 | - $query = 'UPDATE ' . static::_quote_identifier(static::$_tableName) . ' SET ' . $set['sql'] . ' WHERE ' . static::_quote_identifier(static::$_primary_column_name) . ' = ? LIMIT 1'; |
|
715 | + $query = 'UPDATE '.static::_quote_identifier(static::$_tableName).' SET '.$set['sql'].' WHERE '.static::_quote_identifier(static::$_primary_column_name).' = ? LIMIT 1'; |
|
716 | 716 | $set['params'][] = $this->{static::$_primary_column_name}; |
717 | 717 | $st = static::execute( |
718 | 718 | $query, |
@@ -798,10 +798,10 @@ discard block |
||
798 | 798 | if (isset($this->$field) && $this->isFieldDirty($field)) { // Only if dirty |
799 | 799 | if ($this->$field === null) { |
800 | 800 | // if empty set to NULL |
801 | - $fragments[] = static::_quote_identifier($field) . ' = NULL'; |
|
801 | + $fragments[] = static::_quote_identifier($field).' = NULL'; |
|
802 | 802 | } else { |
803 | 803 | // Just set value normally as not empty string with NULL allowed |
804 | - $fragments[] = static::_quote_identifier($field) . ' = ?'; |
|
804 | + $fragments[] = static::_quote_identifier($field).' = ?'; |
|
805 | 805 | $params[] = $this->$field; |
806 | 806 | } |
807 | 807 | } |