@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | if (isset($_FIELDS[$fieldName])) { |
225 | 225 | $_FIELDS[$fieldName] = $fieldValue; |
226 | 226 | } else { |
227 | - throw new \Exception("No field '".$fieldName."' in global fields list."); |
|
227 | + throw new \Exception("No field '" . $fieldName . "' in global fields list."); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | case 'boolean': |
262 | 262 | case 'bool': |
263 | 263 | case 'b': |
264 | - $_FIELDS[$fieldName] = (bool) $_FIELDS[$fieldName]; |
|
264 | + $_FIELDS[$fieldName] = (bool)$_FIELDS[$fieldName]; |
|
265 | 265 | } |
266 | 266 | } else { |
267 | - throw new \Exception("No field '".$fieldName."' in global fields list."); |
|
267 | + throw new \Exception("No field '" . $fieldName . "' in global fields list."); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | global $_FIELDS; |
282 | 282 | |
283 | 283 | foreach ($fieldNames as $fieldName) { |
284 | - $_FIELDS[$fieldName] = (int) (bool) self::getFieldValue($fieldName); |
|
284 | + $_FIELDS[$fieldName] = (int)(bool)self::getFieldValue($fieldName); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * Detect browser version number |
119 | 119 | */ |
120 | 120 | $identifiers[] = $browserShortName; |
121 | - self::$pattern = '#(?<browser>'.implode('|', $identifiers). |
|
121 | + self::$pattern = '#(?<browser>' . implode('|', $identifiers) . |
|
122 | 122 | ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#'; |
123 | 123 | if (!preg_match_all(self::$pattern, $userAgent, $matches)) { |
124 | 124 | // we have no matching number just continue |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // New IE version detection |
142 | 142 | if (isset($matches['browser'][0]) && $matches['browser'][0] == 'Trident') { |
143 | - $browserVersion = sprintf('%.1f', (int) $browserVersion + 4); |
|
143 | + $browserVersion = sprintf('%.1f', (int)$browserVersion + 4); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | // check if we have a number |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | { |
31 | 31 | $paramsString = ''; |
32 | 32 | foreach ($params as $key => $value) { |
33 | - $paramsString .= '&'.$key.'='.$value; |
|
33 | + $paramsString .= '&' . $key . '=' . $value; |
|
34 | 34 | } |
35 | 35 | if ($session) { |
36 | - $paramsString .= '&'.session_name().'='.session_id(); |
|
36 | + $paramsString .= '&' . session_name() . '=' . session_id(); |
|
37 | 37 | } |
38 | 38 | $paramsString = substr($paramsString, 1); |
39 | 39 | if ($paramsString) { |
40 | - $paramsString = '?'.$paramsString; |
|
40 | + $paramsString = '?' . $paramsString; |
|
41 | 41 | } |
42 | - header('Location: '.$url.$paramsString); |
|
42 | + header('Location: ' . $url . $paramsString); |
|
43 | 43 | exit(); |
44 | 44 | } |
45 | 45 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | if (function_exists('http_redirect')) { |
75 | - http_redirect('http://'.$_SERVER['SERVER_NAME'].'/'.$url); |
|
75 | + http_redirect('http://' . $_SERVER['SERVER_NAME'] . '/' . $url); |
|
76 | 76 | } else { |
77 | - self::http_redirect('http://'.$_SERVER['SERVER_NAME'].'/'.$url); |
|
77 | + self::http_redirect('http://' . $_SERVER['SERVER_NAME'] . '/' . $url); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | $urlParts['path'] = '/'; |
131 | 131 | } |
132 | 132 | |
133 | - $sock = fsockopen($urlParts['host'], (isset($urlParts['port']) ? (int) $urlParts['port'] : 80), $errno, $errstr, 30); |
|
133 | + $sock = fsockopen($urlParts['host'], (isset($urlParts['port']) ? (int)$urlParts['port'] : 80), $errno, $errstr, 30); |
|
134 | 134 | if (!$sock) { |
135 | 135 | throw new HttpException("$errstr ($errno)"); |
136 | 136 | } |
137 | 137 | |
138 | - $request = 'HEAD '.$urlParts['path'].(isset($urlParts['query']) ? '?'.$urlParts['query'] : '')." HTTP/1.1\r\n"; |
|
139 | - $request .= 'Host: '.$urlParts['host']."\r\n"; |
|
138 | + $request = 'HEAD ' . $urlParts['path'] . (isset($urlParts['query']) ? '?' . $urlParts['query'] : '') . " HTTP/1.1\r\n"; |
|
139 | + $request .= 'Host: ' . $urlParts['host'] . "\r\n"; |
|
140 | 140 | $request .= "Connection: Close\r\n\r\n"; |
141 | 141 | fwrite($sock, $request); |
142 | 142 | $response = ''; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | if (preg_match('/^Location: (.+?)$/m', $response, $matches)) { |
149 | 149 | if (substr($matches[1], 0, 1) == '/') { |
150 | - return $urlParts['scheme'].'://'.$urlParts['host'].trim($matches[1]); |
|
150 | + return $urlParts['scheme'] . '://' . $urlParts['host'] . trim($matches[1]); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return trim($matches[1]); |
@@ -212,27 +212,27 @@ discard block |
||
212 | 212 | if (is_array($val)) { |
213 | 213 | $val = implode(',', $val); |
214 | 214 | } |
215 | - $postParams[] = $key.'='.urlencode($val); |
|
215 | + $postParams[] = $key . '=' . urlencode($val); |
|
216 | 216 | } |
217 | 217 | $postString = implode('&', $postParams); |
218 | 218 | |
219 | 219 | $parts = parse_url($url); |
220 | 220 | |
221 | - $port = isset($parts['port']) ? (int) $parts['port'] : 80; |
|
221 | + $port = isset($parts['port']) ? (int)$parts['port'] : 80; |
|
222 | 222 | |
223 | 223 | $sock = fsockopen($parts['host'], $port, $errno, $errstr, $timeout); |
224 | 224 | |
225 | 225 | // Data goes in the path for a GET request |
226 | 226 | if ($type == self::GET) { |
227 | - $parts['path'] .= '?'.$postString; |
|
227 | + $parts['path'] .= '?' . $postString; |
|
228 | 228 | } |
229 | 229 | |
230 | - $request = "$type ".$parts['path']." HTTP/1.1\r\n"; |
|
231 | - $request .= 'Host: '.$parts['host']."\r\n"; |
|
230 | + $request = "$type " . $parts['path'] . " HTTP/1.1\r\n"; |
|
231 | + $request .= 'Host: ' . $parts['host'] . "\r\n"; |
|
232 | 232 | |
233 | 233 | if ($type == self::POST) { |
234 | 234 | $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; |
235 | - $request .= 'Content-Length: '.strlen($postString)."\r\n"; |
|
235 | + $request .= 'Content-Length: ' . strlen($postString) . "\r\n"; |
|
236 | 236 | } |
237 | 237 | $request .= "Connection: Close\r\n"; |
238 | 238 | $request .= "\r\n"; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | header('HTTP/1.0 404 Not Found', true, 404); |
288 | 288 | break; |
289 | 289 | default: |
290 | - throw new HttpException("Invalid HTTP status code '".$code."'"); |
|
290 | + throw new HttpException("Invalid HTTP status code '" . $code . "'"); |
|
291 | 291 | } |
292 | 292 | if (!is_null($path)) { |
293 | 293 | include $path; |
@@ -310,12 +310,12 @@ discard block |
||
310 | 310 | public static function __callStatic($name, $arguments) |
311 | 311 | { |
312 | 312 | if (substr($name, 0, 5) === 'force') { |
313 | - $code = (int) substr($name, 5); |
|
313 | + $code = (int)substr($name, 5); |
|
314 | 314 | $path = isset($arguments[0]) ? $arguments[0] : null; |
315 | 315 | |
316 | 316 | return self::forceHttpStatus($code, $path); |
317 | 317 | } |
318 | - throw new HttpException("Invalid HTTP class method '".$name."'"); |
|
318 | + throw new HttpException("Invalid HTTP class method '" . $name . "'"); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | if (isset($this->titles[$code])) { |
64 | 64 | return $this->titles[$code]; |
65 | 65 | } else { |
66 | - throw new Exception("Invalid language code '".$code."'"); |
|
66 | + throw new Exception("Invalid language code '" . $code . "'"); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $type = strtoupper($chunks[0]); |
69 | 69 | |
70 | 70 | if (!self::isValidQueryType($type)) { |
71 | - throw new DBQueryTypeException("Invalid SQL query type '".$type."'"); |
|
71 | + throw new DBQueryTypeException("Invalid SQL query type '" . $type . "'"); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $type; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | case '!=': |
90 | 90 | $this->value = DBField::castValue($this->field->type, $value); |
91 | 91 | |
92 | - $this->sqlCondition = '`'.$field->name.'` '.$this->type.' '.DBField::sqlValue($this->field->type, $value); |
|
92 | + $this->sqlCondition = '`' . $field->name . '` ' . $this->type . ' ' . DBField::sqlValue($this->field->type, $value); |
|
93 | 93 | |
94 | - $this->preparedCondition = '`'.$field->name.'` '.$this->type.' ?'; |
|
94 | + $this->preparedCondition = '`' . $field->name . '` ' . $this->type . ' ?'; |
|
95 | 95 | $this->preparedTypes = $this->field->type; |
96 | 96 | $this->preparedData = [DBField::sqlValue($this->field->type, $value)]; |
97 | 97 | break; |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | if ($this->field->type != 's') { |
103 | 103 | throw new DBQueryConditionException('Field type is not a string'); |
104 | 104 | } |
105 | - $this->sqlCondition = '`'.$field->name.'` '.$this->type.' '.DBField::sqlValue($this->field->type, $value); |
|
105 | + $this->sqlCondition = '`' . $field->name . '` ' . $this->type . ' ' . DBField::sqlValue($this->field->type, $value); |
|
106 | 106 | |
107 | - $this->preparedCondition = '`'.$field->name.'` '.$this->type.' ?'; |
|
107 | + $this->preparedCondition = '`' . $field->name . '` ' . $this->type . ' ?'; |
|
108 | 108 | $this->preparedTypes = $this->field->type; |
109 | 109 | $this->preparedData = [DBField::sqlValue($this->field->type, $value)]; |
110 | 110 | break; |
111 | 111 | case 'IN': |
112 | 112 | case 'NOT IN': |
113 | - if (is_array($value) && !empty($value)) { |
|
113 | + if (is_array($value) && !empty($value)) { |
|
114 | 114 | $dataList = []; |
115 | 115 | foreach ($value as $dataItem) { |
116 | 116 | $dataList[] = DBField::sqlValue($this->field->type, $dataItem); |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | - $this->sqlCondition = '`'.$field->name.'` '.$this->type.' ('.implode(', ', $dataList).')'; |
|
133 | + $this->sqlCondition = '`' . $field->name . '` ' . $this->type . ' (' . implode(', ', $dataList) . ')'; |
|
134 | 134 | |
135 | - $this->preparedCondition = '`'.$field->name.'` '.$this->type.' ('.$qmStr.')'; |
|
135 | + $this->preparedCondition = '`' . $field->name . '` ' . $this->type . ' (' . $qmStr . ')'; |
|
136 | 136 | $this->preparedTypes = $tStr; |
137 | 137 | $this->preparedData = $dataList; |
138 | 138 | } else { |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | if (is_array($value) && count($value) == 2 && isset($value[0]) && isset($value[1])) { |
144 | 144 | $from = DBField::sqlValue($this->field->type, $value[0]); |
145 | 145 | $to = DBField::sqlValue($this->field->type, $value[1]); |
146 | - $this->sqlCondition = '`'.$field->name.'` BETWEEN '.$from.' AND '.$to; |
|
146 | + $this->sqlCondition = '`' . $field->name . '` BETWEEN ' . $from . ' AND ' . $to; |
|
147 | 147 | |
148 | - $this->preparedCondition = '`'.$field->name.'` BETWEEN ? AND ?'; |
|
149 | - $this->preparedTypes = $this->field->type.$this->field->type; |
|
148 | + $this->preparedCondition = '`' . $field->name . '` BETWEEN ? AND ?'; |
|
149 | + $this->preparedTypes = $this->field->type . $this->field->type; |
|
150 | 150 | $this->preparedData = [$from, $to]; |
151 | 151 | } else { |
152 | 152 | throw new DBQueryConditionException("Invalid data for 'BETWEEN' condition"); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | case '!=': |
165 | 165 | case 'LIKE': |
166 | 166 | case 'NOT LIKE': |
167 | - $this->sqlCondition = '`'.$field1->name.'` '.$this->type.' `'.$field2->name.'`'; |
|
167 | + $this->sqlCondition = '`' . $field1->name . '` ' . $this->type . ' `' . $field2->name . '`'; |
|
168 | 168 | break; |
169 | 169 | case 'IN': |
170 | 170 | case 'NOT IN': |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | foreach ($queryCondition as $operation => $conditions) { |
201 | - $cond .= ' '.$operator.self::getSQLCondition($conditions, $operation); |
|
201 | + $cond .= ' ' . $operator . self::getSQLCondition($conditions, $operation); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | $cond .= ')'; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ); |
216 | 216 | } |
217 | 217 | } elseif (Tools::isInstanceOf($queryCondition, "\Asymptix\db\DBQueryCondition")) { |
218 | - return ' '.$queryCondition->sqlCondition; |
|
218 | + return ' ' . $queryCondition->sqlCondition; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | return ''; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (isset($conditionTypes[$conditionType])) { |
281 | 281 | return $conditionTypes[$conditionType]; |
282 | 282 | } |
283 | - throw new DBQueryConditionException("Invalid SQL condition type '".$conditionType."'"); |
|
283 | + throw new DBQueryConditionException("Invalid SQL condition type '" . $conditionType . "'"); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function __construct($type = '', $name = '', $value = null) |
50 | 50 | { |
51 | - if (!(bool) preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $name)) { |
|
52 | - throw new DBFieldException("Can't create DBField object: invalid field name '".$name."'"); |
|
51 | + if (!(bool)preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $name)) { |
|
52 | + throw new DBFieldException("Can't create DBField object: invalid field name '" . $name . "'"); |
|
53 | 53 | } |
54 | 54 | $this->name = $name; |
55 | 55 | |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | if (!is_null($value)) { |
69 | 69 | switch ($this->type) { |
70 | 70 | case 'i': |
71 | - $this->value = (int) $value; |
|
71 | + $this->value = (int)$value; |
|
72 | 72 | break; |
73 | 73 | case 'd': |
74 | - $this->value = (float) $value; |
|
74 | + $this->value = (float)$value; |
|
75 | 75 | break; |
76 | 76 | case 's': |
77 | - $this->value = (string) $value; |
|
77 | + $this->value = (string)$value; |
|
78 | 78 | break; |
79 | 79 | case 'b': |
80 | - $this->value = (bool) $value; |
|
80 | + $this->value = (bool)$value; |
|
81 | 81 | break; |
82 | 82 | } |
83 | 83 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | return 's'; |
142 | 142 | } else { |
143 | 143 | throw new DBFieldTypeException( |
144 | - "Can't detect field value type for value '".(string) $fieldValue."'" |
|
144 | + "Can't detect field value type for value '" . (string)$fieldValue . "'" |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | } |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | { |
161 | 161 | switch (self::castType($type)) { |
162 | 162 | case 'i': |
163 | - return (int) $value; |
|
163 | + return (int)$value; |
|
164 | 164 | case 'd': |
165 | - return (float) $value; |
|
165 | + return (float)$value; |
|
166 | 166 | case 's': |
167 | - return (string) $value; |
|
167 | + return (string)$value; |
|
168 | 168 | case 'b': |
169 | - return (bool) $value; |
|
169 | + return (bool)$value; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | throw new DBFieldTypeException('Invalid SQL type'); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return $value; |
193 | 193 | case 's': |
194 | 194 | if (!in_array($value, ['NOW()'])) { |
195 | - return "'".$value."'"; |
|
195 | + return "'" . $value . "'"; |
|
196 | 196 | } else { |
197 | 197 | return $value; |
198 | 198 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function selectDBObject($debug = false) |
113 | 113 | { |
114 | 114 | $query = 'SELECT * FROM '.$this->dbObject->getTableName(). |
115 | - ($this->conditions != '' ? ' WHERE '.$this->conditions : '').' LIMIT 1'; |
|
115 | + ($this->conditions != '' ? ' WHERE '.$this->conditions : '').' LIMIT 1'; |
|
116 | 116 | |
117 | 117 | if (!$debug) { |
118 | 118 | $stmt = DBCore::doSelectQuery($query); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | return $this->selectDBObject(); |
412 | 412 | } |
413 | 413 | |
414 | - /* |
|
414 | + /* |
|
415 | 415 | * Try to call parent method __call() with same params by default |
416 | 416 | */ |
417 | 417 | $method = substr($methodName, 0, 3); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | $classNamespaceParts = explode('\\', $this->className); |
67 | 67 | if ($className != $classNamespaceParts[count($classNamespaceParts) - 1]) { |
68 | 68 | throw new DBSelectorException( |
69 | - "Invalid DB object classname '".$className."' in method name. ". |
|
70 | - "Valid classname is '".$this->className."'" |
|
69 | + "Invalid DB object classname '" . $className . "' in method name. " . |
|
70 | + "Valid classname is '" . $this->className . "'" |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | } |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function selectDBObject($debug = false) |
113 | 113 | { |
114 | - $query = 'SELECT * FROM '.$this->dbObject->getTableName(). |
|
115 | - ($this->conditions != '' ? ' WHERE '.$this->conditions : '').' LIMIT 1'; |
|
114 | + $query = 'SELECT * FROM ' . $this->dbObject->getTableName() . |
|
115 | + ($this->conditions != '' ? ' WHERE ' . $this->conditions : '') . ' LIMIT 1'; |
|
116 | 116 | |
117 | 117 | if (!$debug) { |
118 | 118 | $stmt = DBCore::doSelectQuery($query); |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function selectDBObjectByField($fieldName, $fieldValue, $debug = false) |
142 | 142 | { |
143 | - $query = 'SELECT * FROM '.$this->dbObject->getTableName().' WHERE '.$fieldName.' = ?'; |
|
143 | + $query = 'SELECT * FROM ' . $this->dbObject->getTableName() . ' WHERE ' . $fieldName . ' = ?'; |
|
144 | 144 | |
145 | 145 | if ($this->conditions != '') { |
146 | - $query .= ' AND '.$this->conditions; |
|
146 | + $query .= ' AND ' . $this->conditions; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $query .= $this->getQueryOrderSQL(); |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function selectDBObjects($debug = false) |
193 | 193 | { |
194 | - $query = 'SELECT'.($this->unique ? ' DISTINCT' : '').' * FROM '.$this->dbObject->getTableName(); |
|
194 | + $query = 'SELECT' . ($this->unique ? ' DISTINCT' : '') . ' * FROM ' . $this->dbObject->getTableName(); |
|
195 | 195 | |
196 | 196 | if ($this->conditions != '') { |
197 | - $query .= ' WHERE '.$this->conditions; |
|
197 | + $query .= ' WHERE ' . $this->conditions; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $query .= $this->getQueryOrderSQL(); |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function selectDBObjectsByField($fieldName, $fieldValue, $debug = false) |
230 | 230 | { |
231 | - $query = 'SELECT * FROM '.$this->dbObject->getTableName(); |
|
232 | - $query .= ' WHERE '.$fieldName.' = ?'; |
|
231 | + $query = 'SELECT * FROM ' . $this->dbObject->getTableName(); |
|
232 | + $query .= ' WHERE ' . $fieldName . ' = ?'; |
|
233 | 233 | |
234 | 234 | if ($this->conditions != '') { |
235 | - $query .= ' AND '.$this->conditions; |
|
235 | + $query .= ' AND ' . $this->conditions; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | $query .= $this->getQueryOrderSQL(); |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function count() |
265 | 265 | { |
266 | - $query = 'SELECT count(*) FROM '.$this->dbObject->getTableName(); |
|
266 | + $query = 'SELECT count(*) FROM ' . $this->dbObject->getTableName(); |
|
267 | 267 | |
268 | 268 | if ($this->conditions != '') { |
269 | - $query .= ' WHERE '.$this->conditions; |
|
269 | + $query .= ' WHERE ' . $this->conditions; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | return DBCore::selectSingleValue($query); |
@@ -279,10 +279,10 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function max() |
281 | 281 | { |
282 | - $query = 'SELECT max(`'.$this->field.'`) FROM '.$this->dbObject->getTableName(); |
|
282 | + $query = 'SELECT max(`' . $this->field . '`) FROM ' . $this->dbObject->getTableName(); |
|
283 | 283 | |
284 | 284 | if ($this->conditions != '') { |
285 | - $query .= ' WHERE '.$this->conditions; |
|
285 | + $query .= ' WHERE ' . $this->conditions; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return DBCore::selectSingleValue($query); |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function min() |
297 | 297 | { |
298 | - $query = 'SELECT min(`'.$this->field.'`) FROM '.$this->dbObject->getTableName(); |
|
298 | + $query = 'SELECT min(`' . $this->field . '`) FROM ' . $this->dbObject->getTableName(); |
|
299 | 299 | |
300 | 300 | if ($this->conditions != '') { |
301 | - $query .= ' WHERE '.$this->conditions; |
|
301 | + $query .= ' WHERE ' . $this->conditions; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | return DBCore::selectSingleValue($query); |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | private function getQueryOrderSQL() |
313 | 313 | { |
314 | 314 | if ($this->order != '') { |
315 | - return ' ORDER BY '.$this->order; |
|
315 | + return ' ORDER BY ' . $this->order; |
|
316 | 316 | } |
317 | 317 | |
318 | - return ' ORDER BY '.$this->dbObject->getIdFieldName().' DESC'; |
|
318 | + return ' ORDER BY ' . $this->dbObject->getIdFieldName() . ' DESC'; |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | { |
328 | 328 | if ($this->count !== 'all') { |
329 | 329 | if ($this->offset > 0) { |
330 | - return ' LIMIT '.$this->offset.','.$this->count; |
|
330 | + return ' LIMIT ' . $this->offset . ',' . $this->count; |
|
331 | 331 | } |
332 | 332 | |
333 | - return ' LIMIT '.$this->count; |
|
333 | + return ' LIMIT ' . $this->count; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | return ''; |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | elseif (preg_match('#^selectAll([A-Z]{1}[[:alpha:]]+)s#', $methodName, $matches)) { |
381 | 381 | $this->validateClassName(preg_replace('#ie$#', 'y', $matches[1])); |
382 | 382 | |
383 | - $this->order = '`'.$this->dbObject->getIdFieldName().'` DESC'; |
|
383 | + $this->order = '`' . $this->dbObject->getIdFieldName() . '` DESC'; |
|
384 | 384 | if (isset($methodParams[0])) { |
385 | - $this->order = (string) $methodParams[0]; |
|
385 | + $this->order = (string)$methodParams[0]; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | $dbObjects = $this->selectDBObjects(); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | case 'get': |
426 | 426 | return $this->getFieldValue($fieldName); |
427 | 427 | default: |
428 | - throw new DBSelectorException("No method with name '".$methodName."'"); |
|
428 | + throw new DBSelectorException("No method with name '" . $methodName . "'"); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | if (!in_array($type, ['i', 'd', 's', 'b'])) { |
142 | 142 | throw new DBCoreException( |
143 | - "Invalid query parameters types string (type '".$type. |
|
143 | + "Invalid query parameters types string (type '" . $type . |
|
144 | 144 | "' is undefined, only 'i', 'd', 's' and 'b' types are acceptable)" |
145 | 145 | ); |
146 | 146 | } |
@@ -153,30 +153,30 @@ discard block |
||
153 | 153 | ) |
154 | 154 | ) { |
155 | 155 | throw new DBCoreException( |
156 | - "Invalid query parameters types string ('".$value. |
|
157 | - "' is not '".$type."' type but '".$typeByValue."' detected)" |
|
156 | + "Invalid query parameters types string ('" . $value . |
|
157 | + "' is not '" . $type . "' type but '" . $typeByValue . "' detected)" |
|
158 | 158 | ); |
159 | 159 | } |
160 | 160 | } else { // in case if we try send non-string parameters as a string value |
161 | 161 | switch ($type) { |
162 | 162 | case 'i': |
163 | - if (!(Tools::isNumeric($value) && ((string) (int) $value === $value))) { |
|
163 | + if (!(Tools::isNumeric($value) && ((string)(int)$value === $value))) { |
|
164 | 164 | throw new DBCoreException( |
165 | - "Invalid query parameters types string ('".$value."' is not '".$type.')' |
|
165 | + "Invalid query parameters types string ('" . $value . "' is not '" . $type . ')' |
|
166 | 166 | ); |
167 | 167 | } |
168 | 168 | break; |
169 | 169 | case 'd': |
170 | 170 | if (!Tools::isDoubleString($value)) { |
171 | 171 | throw new DBCoreException( |
172 | - "Invalid query parameters types string ('".$value."' is not '".$type.')' |
|
172 | + "Invalid query parameters types string ('" . $value . "' is not '" . $type . ')' |
|
173 | 173 | ); |
174 | 174 | } |
175 | 175 | break; |
176 | 176 | case 'b': |
177 | 177 | if (!in_array(strtolower($value), ['true', 'false'])) { |
178 | 178 | throw new DBCoreException( |
179 | - "Invalid query parameters types string ('".$value."' is not '".$type.')' |
|
179 | + "Invalid query parameters types string ('" . $value . "' is not '" . $type . ')' |
|
180 | 180 | ); |
181 | 181 | } |
182 | 182 | break; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $chunks = []; |
211 | 211 | foreach (array_keys($fieldsList) as $fieldName) { |
212 | 212 | if ($fieldName != $idFieldName) { |
213 | - $chunks[] = '`'.$fieldName.'` = ?'; |
|
213 | + $chunks[] = '`' . $fieldName . '` = ?'; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $chunks = []; |
231 | 231 | foreach ($fieldsList as $fieldName => $fieldValue) { |
232 | 232 | if ($fieldName != $idFieldName) { |
233 | - $chunks[] = '`'.$fieldName."` = '".$fieldValue."'"; |
|
233 | + $chunks[] = '`' . $fieldName . "` = '" . $fieldValue . "'"; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | foreach ($values as $fieldName => $fieldValue) { |
304 | 304 | if (!is_array($fieldValue)) { |
305 | 305 | if (!is_null($fieldValue)) { |
306 | - $chunks[] = $fieldName.' = ?'; |
|
306 | + $chunks[] = $fieldName . ' = ?'; |
|
307 | 307 | $this->types .= DBField::getType($fieldValue); |
308 | 308 | $this->params[] = $fieldValue; |
309 | 309 | } else { |