@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function whereOr() |
| 93 | 93 | { |
| 94 | - $this->_conditions[] = '('.implode(' or ', func_get_args()).')'; |
|
| 94 | + $this->_conditions[] = '(' . implode(' or ', func_get_args()) . ')'; |
|
| 95 | 95 | |
| 96 | 96 | return $this; |
| 97 | 97 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | // |
| 170 | 170 | $joins = null; |
| 171 | 171 | foreach ($this->_joins as $join) { |
| 172 | - $joins .= $join['type'].' JOIN '.$join['table'].' on '.$join['on'].' '; |
|
| 172 | + $joins .= $join['type'] . ' JOIN ' . $join['table'] . ' on ' . $join['on'] . ' '; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // |
| 178 | 178 | $limit = null; |
| 179 | 179 | if ($this->limit > 0) { |
| 180 | - $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit; |
|
| 180 | + $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // |
| 186 | 186 | $group = null; |
| 187 | 187 | if (count($this->_group_fields) > 0) { |
| 188 | - $group = ' group by '.implode(', ', $this->_group_fields).' '; |
|
| 188 | + $group = ' group by ' . implode(', ', $this->_group_fields) . ' '; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // |
@@ -201,20 +201,20 @@ discard block |
||
| 201 | 201 | $pos = strpos($of[0], '.'); |
| 202 | 202 | if ($pos !== false) { |
| 203 | 203 | $t = explode('.', $of[0]); |
| 204 | - $t[1] = '`'.$t[1].'`'; |
|
| 204 | + $t[1] = '`' . $t[1] . '`'; |
|
| 205 | 205 | $of[0] = implode('.', $t); |
| 206 | 206 | $order .= $of[0]; |
| 207 | 207 | } else { |
| 208 | - $order .= '`'.$of[0].'`'; |
|
| 208 | + $order .= '`' . $of[0] . '`'; |
|
| 209 | 209 | } |
| 210 | - $order .= ' '.($of[1] ? 'asc' : 'desc'); |
|
| 210 | + $order .= ' ' . ($of[1] ? 'asc' : 'desc'); |
|
| 211 | 211 | } else { |
| 212 | 212 | $order .= $of[0]; |
| 213 | 213 | } |
| 214 | 214 | ++$i; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | - $string = sprintf('select %1$s from %2$s%7$s%3$s%6$s%4$s%5$s', implode(', ', $_read_fields), implode(', ', $this->_table_names), count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null, $order, $limit, $group, $joins); |
|
| 217 | + $string = sprintf('select %1$s from %2$s%7$s%3$s%6$s%4$s%5$s', implode(', ', $_read_fields), implode(', ', $this->_table_names), count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null, $order, $limit, $group, $joins); |
|
| 218 | 218 | |
| 219 | 219 | return $string; |
| 220 | 220 | } |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | $updates = array(); |
| 231 | 231 | for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) { |
| 232 | - $t = '`' . $this->_write_fields[$d].'`='; |
|
| 232 | + $t = '`' . $this->_write_fields[$d] . '`='; |
|
| 233 | 233 | switch ($this->_write_field_types[$d]) { |
| 234 | 234 | case 0: |
| 235 | - $t .= "'".$this->_write_values[$d]."'"; |
|
| 235 | + $t .= "'" . $this->_write_values[$d] . "'"; |
|
| 236 | 236 | break; |
| 237 | 237 | default: |
| 238 | 238 | $t .= $this->_write_values[$d]; |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | $update_fields = implode(', ', $updates); |
| 243 | 243 | $limit = null; |
| 244 | 244 | if ($this->limit > 0) { |
| 245 | - $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit; |
|
| 245 | + $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit; |
|
| 246 | 246 | } |
| 247 | - $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null; |
|
| 247 | + $where = count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null; |
|
| 248 | 248 | $string = sprintf('update %1$s set %2$s %3$s %4$s', $this->_table_names[0], $update_fields, $where, $limit); |
| 249 | 249 | |
| 250 | 250 | return $string; |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | throw new \Exception('Specify at least 1 write field (set function)'); |
| 260 | 260 | } |
| 261 | 261 | $table = $this->_table_names[0]; |
| 262 | - $fields = '`'.implode('`, `', $this->_write_fields).'`'; |
|
| 262 | + $fields = '`' . implode('`, `', $this->_write_fields) . '`'; |
|
| 263 | 263 | $values = array(); |
| 264 | 264 | for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) { |
| 265 | 265 | switch ($this->_write_field_types[$d]) { |
| 266 | 266 | case 0: |
| 267 | - $values[] = "'".$this->_write_values[$d]."'"; |
|
| 267 | + $values[] = "'" . $this->_write_values[$d] . "'"; |
|
| 268 | 268 | break; |
| 269 | 269 | default: |
| 270 | 270 | $values[] = $this->_write_values[$d]; |
@@ -281,10 +281,10 @@ discard block |
||
| 281 | 281 | throw new \Exception('Specify at least 1 table name'); |
| 282 | 282 | } |
| 283 | 283 | $table = $this->_table_names[0]; |
| 284 | - $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null; |
|
| 284 | + $where = count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null; |
|
| 285 | 285 | $limit = null; |
| 286 | 286 | if ($this->limit > 0) { |
| 287 | - $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit; |
|
| 287 | + $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit; |
|
| 288 | 288 | } |
| 289 | 289 | $string = sprintf('delete from %1$s %2$s %3$s', $table, $where, $limit); |
| 290 | 290 | |