@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | /** |
| 358 | 358 | * Information extractor for col relations path |
| 359 | 359 | * |
| 360 | - * @param string|array $info |
|
| 360 | + * @param string $info |
|
| 361 | 361 | * @return array |
| 362 | 362 | */ |
| 363 | 363 | public static function parseColRecursion($info) |
@@ -432,8 +432,8 @@ discard block |
||
| 432 | 432 | /** |
| 433 | 433 | * Generate params string for col by name |
| 434 | 434 | * |
| 435 | - * @param type $colName |
|
| 436 | - * @return boolean|string |
|
| 435 | + * @param string $colName |
|
| 436 | + * @return false|string |
|
| 437 | 437 | */ |
| 438 | 438 | public static function genColParams($colName) |
| 439 | 439 | { |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | /** |
| 574 | 574 | * return relations list |
| 575 | 575 | * |
| 576 | - * @return array |
|
| 576 | + * @return string |
|
| 577 | 577 | */ |
| 578 | 578 | public static function relations() |
| 579 | 579 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | * |
| 1066 | 1066 | * @param array $params |
| 1067 | 1067 | * @param array $where |
| 1068 | - * @return boolean |
|
| 1068 | + * @return false|null |
|
| 1069 | 1069 | */ |
| 1070 | 1070 | public static function update($params, $where = []) |
| 1071 | 1071 | { |
@@ -685,17 +685,21 @@ discard block |
||
| 685 | 685 | */ |
| 686 | 686 | public static function get_list($options = []) |
| 687 | 687 | { |
| 688 | - if (!empty($options['where'])) |
|
| 689 | - App::$cur->db->where($options['where']); |
|
| 688 | + if (!empty($options['where'])) { |
|
| 689 | + App::$cur->db->where($options['where']); |
|
| 690 | + } |
|
| 690 | 691 | if (!empty($options['group'])) { |
| 691 | 692 | App::$cur->db->group($options['group']); |
| 692 | 693 | } |
| 693 | - if (!empty($options['order'])) |
|
| 694 | - App::$cur->db->order($options['order']); |
|
| 695 | - if (!empty($options['join'])) |
|
| 696 | - App::$cur->db->join($options['join']); |
|
| 697 | - if (!empty($options['distinct'])) |
|
| 698 | - App::$cur->db->distinct = $options['distinct']; |
|
| 694 | + if (!empty($options['order'])) { |
|
| 695 | + App::$cur->db->order($options['order']); |
|
| 696 | + } |
|
| 697 | + if (!empty($options['join'])) { |
|
| 698 | + App::$cur->db->join($options['join']); |
|
| 699 | + } |
|
| 700 | + if (!empty($options['distinct'])) { |
|
| 701 | + App::$cur->db->distinct = $options['distinct']; |
|
| 702 | + } |
|
| 699 | 703 | |
| 700 | 704 | foreach (static::$relJoins as $join) { |
| 701 | 705 | App::$cur->db->join($join[0], $join[1]); |
@@ -721,14 +725,14 @@ discard block |
||
| 721 | 725 | } |
| 722 | 726 | static::$needJoin = []; |
| 723 | 727 | |
| 724 | - if (!empty($options['limit'])) |
|
| 725 | - $limit = (int) $options['limit']; |
|
| 726 | - else { |
|
| 728 | + if (!empty($options['limit'])) { |
|
| 729 | + $limit = (int) $options['limit']; |
|
| 730 | + } else { |
|
| 727 | 731 | $limit = 0; |
| 728 | 732 | } |
| 729 | - if (!empty($options['start'])) |
|
| 730 | - $start = (int) $options['start']; |
|
| 731 | - else { |
|
| 733 | + if (!empty($options['start'])) { |
|
| 734 | + $start = (int) $options['start']; |
|
| 735 | + } else { |
|
| 732 | 736 | $start = 0; |
| 733 | 737 | } |
| 734 | 738 | if ($limit || $start) { |
@@ -983,21 +987,23 @@ discard block |
||
| 983 | 987 | if (!empty($options['where'])) { |
| 984 | 988 | static::fixPrefix($options['where'], 'first'); |
| 985 | 989 | } |
| 986 | - if (!empty($options['where'])) |
|
| 987 | - App::$cur->db->where($options['where']); |
|
| 988 | - if (!empty($options['join'])) |
|
| 989 | - App::$cur->db->join($options['join']); |
|
| 990 | + if (!empty($options['where'])) { |
|
| 991 | + App::$cur->db->where($options['where']); |
|
| 992 | + } |
|
| 993 | + if (!empty($options['join'])) { |
|
| 994 | + App::$cur->db->join($options['join']); |
|
| 995 | + } |
|
| 990 | 996 | if (!empty($options['order'])) { |
| 991 | 997 | App::$cur->db->order($options['order']); |
| 992 | 998 | } |
| 993 | - if (!empty($options['limit'])) |
|
| 994 | - $limit = (int) $options['limit']; |
|
| 995 | - else { |
|
| 999 | + if (!empty($options['limit'])) { |
|
| 1000 | + $limit = (int) $options['limit']; |
|
| 1001 | + } else { |
|
| 996 | 1002 | $limit = 0; |
| 997 | 1003 | } |
| 998 | - if (!empty($options['start'])) |
|
| 999 | - $start = (int) $options['start']; |
|
| 1000 | - else { |
|
| 1004 | + if (!empty($options['start'])) { |
|
| 1005 | + $start = (int) $options['start']; |
|
| 1006 | + } else { |
|
| 1001 | 1007 | $start = 0; |
| 1002 | 1008 | } |
| 1003 | 1009 | if ($limit || $start) { |
@@ -1075,8 +1081,9 @@ discard block |
||
| 1075 | 1081 | |
| 1076 | 1082 | $values = []; |
| 1077 | 1083 | foreach ($cols as $col => $param) { |
| 1078 | - if (isset($params[$col])) |
|
| 1079 | - $values[$col] = $params[$col]; |
|
| 1084 | + if (isset($params[$col])) { |
|
| 1085 | + $values[$col] = $params[$col]; |
|
| 1086 | + } |
|
| 1080 | 1087 | } |
| 1081 | 1088 | if (empty($values)) { |
| 1082 | 1089 | return false; |
@@ -1259,8 +1266,9 @@ discard block |
||
| 1259 | 1266 | $values = []; |
| 1260 | 1267 | |
| 1261 | 1268 | foreach ($this->cols() as $col => $param) { |
| 1262 | - if (isset($this->_params[$col])) |
|
| 1263 | - $values[$col] = $this->_params[$col]; |
|
| 1269 | + if (isset($this->_params[$col])) { |
|
| 1270 | + $values[$col] = $this->_params[$col]; |
|
| 1271 | + } |
|
| 1264 | 1272 | } |
| 1265 | 1273 | if (empty($values) && empty($options['empty'])) { |
| 1266 | 1274 | return false; |
@@ -1420,8 +1428,9 @@ discard block |
||
| 1420 | 1428 | { |
| 1421 | 1429 | |
| 1422 | 1430 | foreach (static::relations() as $relName => $rel) { |
| 1423 | - if ($rel['col'] == $col) |
|
| 1424 | - return $relName; |
|
| 1431 | + if ($rel['col'] == $col) { |
|
| 1432 | + return $relName; |
|
| 1433 | + } |
|
| 1425 | 1434 | } |
| 1426 | 1435 | return NULL; |
| 1427 | 1436 | } |
@@ -1577,8 +1586,9 @@ discard block |
||
| 1577 | 1586 | App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk()); |
| 1578 | 1587 | App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId); |
| 1579 | 1588 | $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc(); |
| 1580 | - if ($isset) |
|
| 1581 | - return true; |
|
| 1589 | + if ($isset) { |
|
| 1590 | + return true; |
|
| 1591 | + } |
|
| 1582 | 1592 | |
| 1583 | 1593 | App::$cur->db->insert($relation['relTable'], [ |
| 1584 | 1594 | $relation['relTablePrefix'] . $this->index() => $this->{$this->index()}, |
@@ -15,6 +15,9 @@ |
||
| 15 | 15 | { |
| 16 | 16 | public $xml = null; |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @param \SimpleXMLElement $xml |
|
| 20 | + */ |
|
| 18 | 21 | public function __construct($xml) |
| 19 | 22 | { |
| 20 | 23 | $this->xml = $xml; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Mysql extends \Object |
| 15 | 15 | { |
| 16 | - public $config = []; // настройки подключения выбраной базы |
|
| 17 | - public $connect = FALSE; // ярлык соединения с MySQL |
|
| 18 | - public $encoding = 'utf-8'; // установленная кодировка |
|
| 19 | - public $db_name = 'test'; // выбраная в данный момент база |
|
| 20 | - public $table_prefix = 'inji_'; // префикс названий таблиц |
|
| 16 | + public $config = []; // настройки подключения выбраной базы |
|
| 17 | + public $connect = FALSE; // ярлык соединения с MySQL |
|
| 18 | + public $encoding = 'utf-8'; // установленная кодировка |
|
| 19 | + public $db_name = 'test'; // выбраная в данный момент база |
|
| 20 | + public $table_prefix = 'inji_'; // префикс названий таблиц |
|
| 21 | 21 | public $pdo = NULL; |
| 22 | 22 | public $lastQuery = ''; |
| 23 | 23 | public $last_error = ''; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |