@@ -55,8 +55,8 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * @param int|string $recordId |
|
59 | - * @param mixed|array $fieldList |
|
58 | + * @param integer $recordId |
|
59 | + * @param string[] $fieldList |
|
60 | 60 | * @param bool $forUpdate |
61 | 61 | * |
62 | 62 | * @return array|null |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public static function getRecordById($recordId, $fieldList = '*', $forUpdate = false) { |
65 | 65 | // return static::getRecord(array(static::$_idField => $recordId), $fieldList, $forUpdate); |
66 | - return static::getRecord(array(static::$_idField . '=' . $recordId), $fieldList, $forUpdate); |
|
66 | + return static::getRecord(array(static::$_idField.'='.$recordId), $fieldList, $forUpdate); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | DbSqlStatement::build(null, get_called_class()) |
85 | 85 | ->select() |
86 | 86 | ->fields(static::$_idField) |
87 | - ->where(array("`" . static::$_idField . "` IN (" . implode(',', $idList) . ")")) |
|
87 | + ->where(array("`".static::$_idField."` IN (".implode(',', $idList).")")) |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // TODO - fields should be escaped !! |
175 | 175 | // TODO - $where should be validated and checked! |
176 | 176 | public function where($where = array()) { |
177 | - if(!is_array($where)) { |
|
177 | + if (!is_array($where)) { |
|
178 | 178 | throw new ExceptionDbSqlWhereNotAnArray(); |
179 | 179 | } |
180 | 180 | $this->where = $where; |
@@ -209,24 +209,24 @@ discard block |
||
209 | 209 | $result = ''; |
210 | 210 | $result .= $this->stringEscape($this->operation); |
211 | 211 | |
212 | - $result .= ' ' . $this->selectFieldsToString($this->fields); |
|
212 | + $result .= ' '.$this->selectFieldsToString($this->fields); |
|
213 | 213 | |
214 | 214 | $result .= ' FROM'; |
215 | - $result .= ' `{{' . $this->stringEscape($this->table) . '}}`'; |
|
216 | - $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : ''; |
|
215 | + $result .= ' `{{'.$this->stringEscape($this->table).'}}`'; |
|
216 | + $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : ''; |
|
217 | 217 | |
218 | 218 | // TODO - fields should be escaped !! |
219 | - $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : ''; |
|
219 | + $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : ''; |
|
220 | 220 | |
221 | 221 | // TODO - fields should be escaped !! |
222 | - $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : ''; |
|
222 | + $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : ''; |
|
223 | 223 | |
224 | 224 | // TODO - fields should be escaped !! |
225 | - $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : ''; |
|
225 | + $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : ''; |
|
226 | 226 | |
227 | 227 | // TODO - fields should be escaped !! |
228 | 228 | // TODO - separate offset and row_count |
229 | - $result .= !empty($this->limit) ? ' LIMIT ' . implode(' OFFSET ', $this->limit) : ''; |
|
229 | + $result .= !empty($this->limit) ? ' LIMIT '.implode(' OFFSET ', $this->limit) : ''; |
|
230 | 230 | |
231 | 231 | // TODO - protect from double escape! |
232 | 232 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | protected function processField($fieldName) { |
266 | 266 | if (is_bool($fieldName)) { |
267 | - $result = (string)intval($fieldName); |
|
267 | + $result = (string) intval($fieldName); |
|
268 | 268 | } elseif (is_null($fieldName)) { |
269 | 269 | $result = 'NULL'; |
270 | 270 | } elseif ($fieldName === '*') { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @return string |
283 | 283 | */ |
284 | 284 | protected function processFieldDefault($fieldName) { |
285 | - $result = (string)$fieldName; |
|
285 | + $result = (string) $fieldName; |
|
286 | 286 | if ( |
287 | 287 | $result != '' |
288 | 288 | && |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | !is_numeric($fieldName) |
297 | 297 | ) { |
298 | 298 | // Other should be formatted |
299 | - $result = '`' . $this->stringEscape($result) . '`'; |
|
299 | + $result = '`'.$this->stringEscape($result).'`'; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | return $result; |