@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function prepareQueryMark(string $sql, array $parameter) |
22 | 22 | { |
23 | 23 | $binders = []; |
24 | - $query = preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) { |
|
24 | + $query = preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) { |
|
25 | 25 | $index = count($binders); |
26 | 26 | if (array_key_exists($index, $parameter)) { |
27 | 27 | $name = Binder::index($index); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } else { |
33 | 33 | $binder = new Binder($name, $parameter[$index]); |
34 | 34 | $binders[] = $binder; |
35 | - return ':' . $binder->getName(); |
|
35 | + return ':'.$binder->getName(); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | return $match[0]; |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | public function prepareInParameter($values, string $name) |
51 | 51 | { |
52 | 52 | if ($this->countObject($values) <= 0) { |
53 | - throw new SQLException('on field ' . $name . ' value can\'t be empty array'); |
|
53 | + throw new SQLException('on field '.$name.' value can\'t be empty array'); |
|
54 | 54 | } |
55 | 55 | $names = []; |
56 | 56 | $binders = []; |
57 | 57 | foreach ($values as $value) { |
58 | 58 | $_name = Binder::index($name); |
59 | 59 | $binders[] = new Binder($_name, $value); |
60 | - $names[] = ':' . $_name; |
|
60 | + $names[] = ':'.$_name; |
|
61 | 61 | } |
62 | 62 | return [implode(',', $names), $binders]; |
63 | 63 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | public function createQueryOperation(string $name, string $operator, $value, string $indexName = '') |
86 | 86 | { |
87 | 87 | if ($value instanceof Query) { |
88 | - return new Query("`{$name}` {$operator} " . $value, $value->getBinder()); |
|
88 | + return new Query("`{$name}` {$operator} ".$value, $value->getBinder()); |
|
89 | 89 | } |
90 | 90 | if ($value instanceof Statement) { |
91 | - return new Query("`{$name}` {$operator} (" . $value->getQuery() . ')', $value->getBinder()); |
|
91 | + return new Query("`{$name}` {$operator} (".$value->getQuery().')', $value->getBinder()); |
|
92 | 92 | } |
93 | 93 | if ($value instanceof IteratorAggregate || is_array($value)) { |
94 | 94 | return $this->prepareIn($name, $operator, $value); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | protected function fixWhereArray(array $item) { |
161 | 161 | if (count($item) === 2) { |
162 | 162 | [$name, $value] = $item; |
163 | - $op = $this->isArray($value)?'in':'='; |
|
163 | + $op = $this->isArray($value) ? 'in' : '='; |
|
164 | 164 | return [$name, $op, $value]; |
165 | 165 | } |
166 | 166 | return $item; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if (is_array($value)) { |
181 | 181 | $newWhere[] = [$name, $value[0], $value[1]]; |
182 | 182 | } else { |
183 | - $op = $this->isArray($value)?'in':'='; |
|
183 | + $op = $this->isArray($value) ? 'in' : '='; |
|
184 | 184 | $newWhere[] = [$name, $op, $value]; |
185 | 185 | } |
186 | 186 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | return $this->createQueryOperation($name, 'in', $values); |
240 | 240 | } |
241 | 241 | [$inSQL, $binders] = $this->prepareInParameter($values, $name); |
242 | - $sql = '`' . $name . '` ' . strtoupper($operation) . ' (' . $inSQL . ')'; |
|
242 | + $sql = '`'.$name.'` '.strtoupper($operation).' ('.$inSQL.')'; |
|
243 | 243 | return new Query($sql, $binders); |
244 | 244 | } |
245 | 245 | |
@@ -254,6 +254,6 @@ discard block |
||
254 | 254 | public function replaceQuote(string $name, string $replace, string $target) |
255 | 255 | { |
256 | 256 | $name = ltrim($name, ':'); |
257 | - return preg_replace('/(?<!_):' . preg_quote($name) . '/', $replace, $target); |
|
257 | + return preg_replace('/(?<!_):'.preg_quote($name).'/', $replace, $target); |
|
258 | 258 | } |
259 | 259 | } |