@@ -24,6 +24,9 @@ |
||
24 | 24 | private $_messages = array(); |
25 | 25 | private $_errors = array(); |
26 | 26 | |
27 | + /** |
|
28 | + * @param null|Route $tpl |
|
29 | + */ |
|
27 | 30 | public function __construct($tpl) { |
28 | 31 | if (!empty($tpl)) { |
29 | 32 | if (is_string($tpl)) { |
@@ -271,7 +271,6 @@ discard block |
||
271 | 271 | * Return parameters from the statment with dynamic number of parameters. |
272 | 272 | * |
273 | 273 | * @param resource $stmt Statement. |
274 | - * @param array $params Parameters. |
|
275 | 274 | */ |
276 | 275 | public static function bindResults($stmt) { |
277 | 276 | $resultSet = array(); |
@@ -769,7 +768,7 @@ discard block |
||
769 | 768 | /** |
770 | 769 | * Executes SQL query with single record and value result and return this value. |
771 | 770 | * |
772 | - * @param mixed $query SQL query template string or DBPreparedQuery object |
|
771 | + * @param string $query SQL query template string or DBPreparedQuery object |
|
773 | 772 | * if single parameter. |
774 | 773 | * @param string $types Types string (ex: "isdb"). |
775 | 774 | * @param array $params Parameters in the same order like types string. |
@@ -598,7 +598,7 @@ |
||
598 | 598 | public static function deleteDBObject($dbObject) { |
599 | 599 | if (!empty($dbObject) && is_object($dbObject)) { |
600 | 600 | $query = "DELETE FROM " . $dbObject->getTableName() . |
601 | - " WHERE " . $dbObject->getIdFieldName() . " = ? LIMIT 1"; |
|
601 | + " WHERE " . $dbObject->getIdFieldName() . " = ? LIMIT 1"; |
|
602 | 602 | if (Tools::isInteger($dbObject->getId())) { |
603 | 603 | $typesString = "i"; |
604 | 604 | } else { |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | |
496 | 496 | $fieldStr = "'" . $field . "' => "; |
497 | 497 | if ($attributes['null'] === 'YES' && is_null($attributes['default'])) { |
498 | - $fieldStr.= "null"; |
|
498 | + $fieldStr .= "null"; |
|
499 | 499 | } else { |
500 | - $fieldStr.= self::getPrintableSQLValue($attributes['type'], $attributes['default']); |
|
500 | + $fieldStr .= self::getPrintableSQLValue($attributes['type'], $attributes['default']); |
|
501 | 501 | } |
502 | - $fieldStr.= ", // " . $attributes['type'] . |
|
502 | + $fieldStr .= ", // " . $attributes['type'] . |
|
503 | 503 | ", " . (($attributes['null'] == "NO") ? "not null" : "null") |
504 | 504 | . ", default '" . $attributes['default'] . "'" . |
505 | 505 | ($extra ? ", " . $extra : "") . |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * |
554 | 554 | * @return int Insertion ID (primary key value) or null on debug. |
555 | 555 | */ |
556 | - public static function insertDBObject($dbObject, $ignore = false, $debug = false) { |
|
556 | + public static function insertDBObject($dbObject, $ignore = false, $debug = false) { |
|
557 | 557 | $fieldsList = $dbObject->getFieldsList(); |
558 | 558 | $idFieldName = $dbObject->getIdFieldName(); |
559 | 559 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | LIMIT 1"; |
599 | 599 | $typesString = DBPreparedQuery::sqlTypesString($fieldsList, $idFieldName); |
600 | 600 | if (Tools::isInteger($fieldsList[$idFieldName])) { |
601 | - $typesString.= "i"; |
|
601 | + $typesString .= "i"; |
|
602 | 602 | } else { |
603 | - $typesString.= "s"; |
|
603 | + $typesString .= "s"; |
|
604 | 604 | } |
605 | 605 | $valuesList = self::createValuesList($fieldsList, $idFieldName); |
606 | 606 | $valuesList[] = $dbObject->getId(); |
@@ -42,6 +42,9 @@ |
||
42 | 42 | */ |
43 | 43 | private $dbObject = null; |
44 | 44 | |
45 | + /** |
|
46 | + * @param string $className |
|
47 | + */ |
|
45 | 48 | public function __construct($className) { |
46 | 49 | if (is_object($className)) { |
47 | 50 | $className = get_class($className); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function selectDBObject($debug = false) { |
103 | 103 | $query = "SELECT * FROM " . $this->dbObject->getTableName() |
104 | - . ($this->conditions != "" ? " WHERE " . $this->conditions : "") |
|
105 | - . " LIMIT 1"; |
|
104 | + . ($this->conditions != "" ? " WHERE " . $this->conditions : "") |
|
105 | + . " LIMIT 1"; |
|
106 | 106 | |
107 | 107 | if (!$debug) { |
108 | 108 | $stmt = DBCore::doSelectQuery($query); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function selectDBObjects($debug = false) { |
185 | 185 | $query = "SELECT" . ($this->unique ? " DISTINCT" : "") |
186 | - . " * FROM " . $this->dbObject->getTableName(); |
|
186 | + . " * FROM " . $this->dbObject->getTableName(); |
|
187 | 187 | |
188 | 188 | if ($this->conditions != "") { |
189 | 189 | $query .= " WHERE " . $this->conditions; |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | $query .= " AND " . $this->conditions; |
138 | 138 | } |
139 | 139 | |
140 | - $query.= $this->getQueryOrderSQL(); |
|
141 | - $query.= " LIMIT 1"; |
|
140 | + $query .= $this->getQueryOrderSQL(); |
|
141 | + $query .= " LIMIT 1"; |
|
142 | 142 | |
143 | 143 | $fieldType = DBField::getType($fieldValue); |
144 | 144 | if (!$debug) { |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | $query .= " WHERE " . $this->conditions; |
190 | 190 | } |
191 | 191 | |
192 | - $query.= $this->getQueryOrderSQL(); |
|
193 | - $query.= $this->getQueryLimitSQL(); |
|
192 | + $query .= $this->getQueryOrderSQL(); |
|
193 | + $query .= $this->getQueryLimitSQL(); |
|
194 | 194 | |
195 | 195 | if (!$debug) { |
196 | 196 | $stmt = DBCore::doSelectQuery($query); |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | $query .= " AND " . $this->conditions; |
227 | 227 | } |
228 | 228 | |
229 | - $query.= $this->getQueryOrderSQL(); |
|
230 | - $query.= $this->getQueryLimitSQL(); |
|
229 | + $query .= $this->getQueryOrderSQL(); |
|
230 | + $query .= $this->getQueryLimitSQL(); |
|
231 | 231 | |
232 | 232 | $fieldType = DBField::getType($fieldValue); |
233 | 233 | if (!$debug) { |
@@ -136,7 +136,7 @@ |
||
136 | 136 | * css($propertyName, $propertyValue) Set the value of a CSS property |
137 | 137 | * |
138 | 138 | * @param string $propertyName Name of a CSS property. |
139 | - * @param mixed $propertyValue Value of a CSS property. |
|
139 | + * @param string $propertyValue Value of a CSS property. |
|
140 | 140 | * |
141 | 141 | * @return Value of the CSS property or NULL if property is not exists. |
142 | 142 | */ |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | break; |
107 | 107 | case ("IN"): |
108 | 108 | case ("NOT IN"): |
109 | - if (is_array($value) && !empty($value)) { |
|
109 | + if (is_array($value) && !empty($value)) { |
|
110 | 110 | $dataList = []; |
111 | 111 | foreach ($value as $dataItem) { |
112 | 112 | $dataList[] = DBField::sqlValue($this->field->type, $dataItem); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ($count > 0) { |
117 | 117 | $qmStr = "?"; |
118 | 118 | $tStr = $this->field->type; |
119 | - for ($i = 1; $i < $count; $i ++) { |
|
119 | + for ($i = 1; $i < $count; $i++) { |
|
120 | 120 | $qmStr .= ", ?"; |
121 | 121 | $tStr .= $this->field->type; |
122 | 122 | } |
@@ -139,9 +139,9 @@ |
||
139 | 139 | $typeByValue = DBField::getType($value); |
140 | 140 | if ($typeByValue != 's') { |
141 | 141 | if ($type != $typeByValue && !( |
142 | - ($type == 'd' && $typeByValue == 'i') || // We can put integer as double |
|
142 | + ($type == 'd' && $typeByValue == 'i') || // We can put integer as double |
|
143 | 143 | ($type == 's' && $typeByValue == 'i') // We can put integer as string |
144 | - ) |
|
144 | + ) |
|
145 | 145 | ) { |
146 | 146 | throw new DBCoreException( |
147 | 147 | "Invalid query parameters types string ('" . $value . |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $chunks = []; |
220 | 220 | foreach ($fieldsList as $fieldName => $fieldValue) { |
221 | 221 | if ($fieldName != $idFieldName) { |
222 | - $chunks[]= "`" . $fieldName . "` = '" . $fieldValue . "'"; |
|
222 | + $chunks[] = "`" . $fieldName . "` = '" . $fieldValue . "'"; |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | foreach ($fieldsList as $fieldName => $fieldValue) { |
244 | 244 | if ($fieldName != $idFieldName) { |
245 | 245 | if (Tools::isDouble($fieldValue)) { |
246 | - $typesString.= "d"; |
|
246 | + $typesString .= "d"; |
|
247 | 247 | } elseif (Tools::isInteger($fieldValue)) { |
248 | - $typesString.= "i"; |
|
248 | + $typesString .= "i"; |
|
249 | 249 | } else { |
250 | - $typesString.= "s"; |
|
250 | + $typesString .= "s"; |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $type = DBField::castType($type); |
269 | 269 | $typesString = ""; |
270 | 270 | while ($length > 0) { |
271 | - $typesString.= $type; |
|
271 | + $typesString .= $type; |
|
272 | 272 | $length--; |
273 | 273 | } |
274 | 274 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | if (!is_array($fieldValue)) { |
289 | 289 | if (!is_null($fieldValue)) { |
290 | 290 | $chunks[] = $fieldName . " = ?"; |
291 | - $this->types.= DBField::getType($fieldValue); |
|
291 | + $this->types .= DBField::getType($fieldValue); |
|
292 | 292 | $this->params[] = $fieldValue; |
293 | 293 | } else { |
294 | 294 | $chunks[] = $fieldName; |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | |
300 | 300 | $chunks[] = $condition; |
301 | 301 | foreach ($localParams as $param) { |
302 | - $this->types.= DBField::getType($param); |
|
302 | + $this->types .= DBField::getType($param); |
|
303 | 303 | $this->params[] = $param; |
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | - $this->query.= implode($separator, $chunks); |
|
307 | + $this->query .= implode($separator, $chunks); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | break; |
150 | 150 | } |
151 | 151 | $array = &$array[$key]; |
152 | - } elseif(isset($array[$key])) { // last element |
|
152 | + } elseif (isset($array[$key])) { // last element |
|
153 | 153 | unset($array[$key]); |
154 | 154 | } |
155 | 155 | } |
@@ -89,11 +89,11 @@ |
||
89 | 89 | */ |
90 | 90 | protected function sendMail($email, $subject, $message, $format = self::FORMAT_TEXT, $replyTo = "") { |
91 | 91 | $headers = "From: " . $this->fromName . " <" . $this->fromEmail . ">\r\n"; |
92 | - $headers.= "Reply-To: " . $replyTo . "\r\n"; |
|
92 | + $headers .= "Reply-To: " . $replyTo . "\r\n"; |
|
93 | 93 | |
94 | 94 | if ($format == self::FORMAT_HTML) { |
95 | - $headers.= "MIME-Version: 1.0\r\n"; |
|
96 | - $headers.= "Content-type: text/html; charset=utf-8\r\n"; |
|
95 | + $headers .= "MIME-Version: 1.0\r\n"; |
|
96 | + $headers .= "Content-type: text/html; charset=utf-8\r\n"; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | public function getUrl($action, $id = null, $getParams = array()) { |
99 | 99 | $url = $this->controller . "/"; |
100 | 100 | if (!is_null($id)) { |
101 | - $url.= $action . "/" . $id; |
|
101 | + $url .= $action . "/" . $id; |
|
102 | 102 | } else { |
103 | - $url.= $action; |
|
103 | + $url .= $action; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if (!empty($getParams)) { |
107 | - $url.= "?"; |
|
107 | + $url .= "?"; |
|
108 | 108 | foreach ($getParams as $key => $value) { |
109 | - $url.= $key . "=" . $value; |
|
109 | + $url .= $key . "=" . $value; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | return $url; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function tplPath() { |
121 | 121 | $path = $this->controller . "/" . $this->controller; |
122 | 122 | if (!empty($this->action)) { |
123 | - $path.= "_" . $this->action; |
|
123 | + $path .= "_" . $this->action; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $path; |