@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function prepareQueryMark(string $sql, array $parameter) |
| 23 | 23 | { |
| 24 | 24 | $binders = []; |
| 25 | - $query = preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) { |
|
| 25 | + $query = preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) { |
|
| 26 | 26 | $index = count($binders); |
| 27 | 27 | if (array_key_exists($index, $parameter)) { |
| 28 | 28 | $name = Binder::index($index); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } else { |
| 34 | 34 | $binder = new Binder($name, $parameter[$index]); |
| 35 | 35 | $binders[] = $binder; |
| 36 | - return ':' . $binder->getName(); |
|
| 36 | + return ':'.$binder->getName(); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | return $match[0]; |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | public function prepareInParameter($values, string $name) |
| 52 | 52 | { |
| 53 | 53 | if ($this->count($values) <= 0) { |
| 54 | - throw new SQLException('on field ' . $name . ' value can\'t be empty array'); |
|
| 54 | + throw new SQLException('on field '.$name.' value can\'t be empty array'); |
|
| 55 | 55 | } |
| 56 | 56 | $names = []; |
| 57 | 57 | $binders = []; |
| 58 | 58 | foreach ($values as $value) { |
| 59 | 59 | $_name = Binder::index($name); |
| 60 | 60 | $binders[] = new Binder($_name, $value); |
| 61 | - $names[] = ':' . $_name; |
|
| 61 | + $names[] = ':'.$_name; |
|
| 62 | 62 | } |
| 63 | 63 | return [implode(',', $names), $binders]; |
| 64 | 64 | } |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | public function createQueryOperation(string $name, string $operation, $value, string $indexName = '') |
| 87 | 87 | { |
| 88 | 88 | if ($value instanceof Query) { |
| 89 | - return new Query("`{$name}` {$operation} " . $value, $value->getBinder()); |
|
| 89 | + return new Query("`{$name}` {$operation} ".$value, $value->getBinder()); |
|
| 90 | 90 | } |
| 91 | 91 | if ($value instanceof Statement) { |
| 92 | - return new Query("`{$name}` {$operation} (" . $value->getQuery() . ')', $value->getBinder()); |
|
| 92 | + return new Query("`{$name}` {$operation} (".$value->getQuery().')', $value->getBinder()); |
|
| 93 | 93 | } |
| 94 | 94 | if ($value instanceof IteratorAggregate || is_array($value)) { |
| 95 | 95 | return $this->prepareIn($name, $operation, $value); |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | return $this->createQueryOperation($name, 'in', $values); |
| 191 | 191 | } |
| 192 | 192 | list($inSQL, $binders) = $this->prepareInParameter($values, $name); |
| 193 | - $sql = '`' . $name . '` ' . strtoupper($operation) . ' (' . $inSQL . ')'; |
|
| 193 | + $sql = '`'.$name.'` '.strtoupper($operation).' ('.$inSQL.')'; |
|
| 194 | 194 | return new Query($sql, $binders); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -205,6 +205,6 @@ discard block |
||
| 205 | 205 | public function replaceQuote(string $name, string $replace, string $target) |
| 206 | 206 | { |
| 207 | 207 | $name = ltrim($name, ':'); |
| 208 | - return preg_replace('/(?<!_):' . preg_quote($name) . '/', $replace, $target); |
|
| 208 | + return preg_replace('/(?<!_):'.preg_quote($name).'/', $replace, $target); |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | \ No newline at end of file |
@@ -210,10 +210,10 @@ |
||
| 210 | 210 | list($updateSet, $upBinder) = $this->prepareUpdateSet($this->data); |
| 211 | 211 | $this->binder = array_merge($this->binder, $upBinder); |
| 212 | 212 | } |
| 213 | - $string = "UPDATE " . $this->table . " SET " . $updateSet . " WHERE " . $this->whereCondition; |
|
| 213 | + $string = "UPDATE ".$this->table." SET ".$updateSet." WHERE ".$this->whereCondition; |
|
| 214 | 214 | return new Query($string, $this->binder); |
| 215 | 215 | } else { |
| 216 | - $string = "DELETE FROM " . $this->table . " WHERE " . $this->whereCondition; |
|
| 216 | + $string = "DELETE FROM ".$this->table." WHERE ".$this->whereCondition; |
|
| 217 | 217 | return new Query($string, $this->binder); |
| 218 | 218 | } |
| 219 | 219 | } |