@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | |
4 | 4 | class WhereBuilder { |
5 | 5 | //Needs to be broken up into better methods |
6 | - public function createSql($fields, $mode = \Maphper\Maphper::FIND_EXACT | \Maphper\Maphper::FIND_AND){ |
|
6 | + public function createSql($fields, $mode = \Maphper\Maphper::FIND_EXACT | \Maphper\Maphper::FIND_AND) { |
|
7 | 7 | $args = []; |
8 | 8 | $sql = []; |
9 | 9 | |
10 | 10 | foreach ($fields as $key => $value) { |
11 | 11 | if ($value instanceof \DateTime) { |
12 | - if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
12 | + if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
13 | 13 | else $value = $value->format('Y-m-d H:i:s'); |
14 | 14 | } |
15 | 15 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $inSql[] = ':' . $key . $i; |
35 | 35 | } |
36 | 36 | if (count($inSql) == 0) return []; |
37 | - else $sql[] = $key . ' IN ( ' . implode(', ', $inSql) . ')'; |
|
37 | + else $sql[] = $key . ' IN ( ' . implode(', ', $inSql) . ')'; |
|
38 | 38 | } |
39 | 39 | else if ($value === NULL) { |
40 | 40 | $nullSql = $key . ' IS '; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | $this->selectBuilder = new \Maphper\Lib\SelectBuilder(); |
30 | 30 | $this->whereBuilder = new \Maphper\Lib\Sql\WhereBuilder(); |
31 | 31 | |
32 | - $this->fields = implode(',', array_map([$this->adapter, 'quote'], (array) $this->options->read('fields'))); |
|
32 | + $this->fields = implode(',', array_map([$this->adapter, 'quote'], (array)$this->options->read('fields'))); |
|
33 | 33 | |
34 | - $this->defaultSort = $this->options->read('defaultSort') !== false ? $this->options->read('defaultSort') : implode(', ', $this->primaryKey); |
|
34 | + $this->defaultSort = $this->options->read('defaultSort') !== false ? $this->options->read('defaultSort') : implode(', ', $this->primaryKey); |
|
35 | 35 | |
36 | 36 | $this->alterDb = $this->options->getEditMode(); |
37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | private function optimizeColumns() { |
42 | - if (self::EDIT_OPTIMISE & $this->alterDb && rand(0,500) == 1) $this->adapter->optimiseColumns($this->table); |
|
42 | + if (self::EDIT_OPTIMISE & $this->alterDb && rand(0, 500) == 1) $this->adapter->optimiseColumns($this->table); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function getPrimaryKey() { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | private function updateCache($data) { |
178 | 178 | $pkValue = $data->{$this->primaryKey[0]}; |
179 | - if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object) array_merge((array)$this->cache[$pkValue], (array)$data); |
|
179 | + if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object)array_merge((array)$this->cache[$pkValue], (array)$data); |
|
180 | 180 | else $this->cache[$pkValue] = $data; |
181 | 181 | } |
182 | 182 |