@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | return $this->filter( |
37 | - "INSERT INTO " . $table . |
|
38 | - " (" . implode(", ", $quotedFields) . ") VALUES (" . implode(', ', $valueFields) . ")" |
|
37 | + "INSERT INTO ".$table. |
|
38 | + " (".implode(", ", $quotedFields).") VALUES (".implode(', ', $valueFields).")" |
|
39 | 39 | ); |
40 | 40 | } |
41 | 41 | |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | - return $this->filter("UPDATE " . |
|
81 | - $model->getDBStoreInformation()['quoted_table'] . |
|
82 | - " SET " . implode(', ', $valueFields) . |
|
83 | - " WHERE " . implode(' AND ', $conditions) |
|
80 | + return $this->filter("UPDATE ". |
|
81 | + $model->getDBStoreInformation()['quoted_table']. |
|
82 | + " SET ".implode(', ', $valueFields). |
|
83 | + " WHERE ".implode(' AND ', $conditions) |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | public function __construct(DriverAdapter $adapter) { |
58 | 58 | $table = Nibii::getModelTable($this); |
59 | 59 | $driver = Db::getDriver(); |
60 | - if(is_string($table)) { |
|
60 | + if (is_string($table)) { |
|
61 | 61 | $this->quotedTable = $driver->quoteIdentifier($table); |
62 | 62 | $this->table = $this->unquotedTable = $table; |
63 | 63 | } else { |
64 | - $this->quotedTable = (isset($table['schema']) ? "{$driver->quoteIdentifier($table["schema"])}." : ""). $driver->quoteIdentifier($table["table"]); |
|
65 | - $this->unquotedTable = (isset($table['schema']) ? "{$table['schema']}." : "") . $table['table']; |
|
64 | + $this->quotedTable = (isset($table['schema']) ? "{$driver->quoteIdentifier($table["schema"])}." : "").$driver->quoteIdentifier($table["table"]); |
|
65 | + $this->unquotedTable = (isset($table['schema']) ? "{$table['schema']}." : "").$table['table']; |
|
66 | 66 | $this->table = $table['table']; |
67 | 67 | $this->schema = $table['schema']; |
68 | 68 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getDescription() { |
82 | 82 | return Cache::read( |
83 | - (new \ReflectionClass($this))->getName() . '::desc', function() { |
|
83 | + (new \ReflectionClass($this))->getName().'::desc', function() { |
|
84 | 84 | return new ModelDescription($this); |
85 | 85 | } |
86 | 86 | ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | public function getSorts() { |
73 | - return count($this->sorts) ? " ORDER BY " . implode(", ", $this->sorts) : null; |
|
73 | + return count($this->sorts) ? " ORDER BY ".implode(", ", $this->sorts) : null; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function addFilter($field, $values = []) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $this->whereClause .= "{$field} IN ("; |
91 | 91 | $comma = ''; |
92 | 92 | for ($i = 0; $i < $numValues; $i++) { |
93 | - $key = "filter_" . ($startIndex + $i); |
|
93 | + $key = "filter_".($startIndex + $i); |
|
94 | 94 | $this->whereClause .= "$comma:$key"; |
95 | 95 | $this->boundData[$key] = $values[$i]; |
96 | 96 | $comma = ' ,'; |
@@ -70,11 +70,11 @@ |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if (!isset($this->options['junction_local_key'])) { |
73 | - $this->options['junction_local_key'] = Text::singularize($this->setupTable) . '_id'; |
|
73 | + $this->options['junction_local_key'] = Text::singularize($this->setupTable).'_id'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | if (!isset($this->options['junction_foreign_key'])) { |
77 | - $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getDBStoreInformation()['table']) . '_id'; |
|
77 | + $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getDBStoreInformation()['table']).'_id'; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 |
@@ -47,11 +47,11 @@ |
||
47 | 47 | { |
48 | 48 | $model = InjectionContainer::resolve(Nibii::getClassName($this->options['model'], self::BELONGS_TO)); |
49 | 49 | $table = $model->getDBStoreInformation()['table']; |
50 | - if($this->options['foreign_key'] == null) { |
|
50 | + if ($this->options['foreign_key'] == null) { |
|
51 | 51 | $this->options['foreign_key'] = $model->getDescription()->getPrimaryKey()[0]; |
52 | 52 | } |
53 | - if($this->options['local_key'] == null) { |
|
54 | - $this->options['local_key'] = Text::singularize($table) . '_id'; |
|
53 | + if ($this->options['local_key'] == null) { |
|
54 | + $this->options['local_key'] = Text::singularize($table).'_id'; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->getToken(); |
58 | 58 | $expression = $this->parseExpression(); |
59 | 59 | if ($this->token !== false) { |
60 | - throw new FilterCompilerException("Unexpected '" . $this->token . "' in filter [$filter]"); |
|
60 | + throw new FilterCompilerException("Unexpected '".$this->token."' in filter [$filter]"); |
|
61 | 61 | } |
62 | 62 | $parsed = $this->renderExpression($expression); |
63 | 63 | return $parsed; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | private function renderExpression($expression) { |
67 | 67 | if (is_array($expression)) { |
68 | - $expression = $this->renderExpression($expression['left']) . " {$expression['opr']} " . $this->renderExpression($expression['right']); |
|
68 | + $expression = $this->renderExpression($expression['left'])." {$expression['opr']} ".$this->renderExpression($expression['right']); |
|
69 | 69 | } |
70 | 70 | return $expression; |
71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $tokens = [$tokens]; |
76 | 76 | } |
77 | 77 | if (array_search($this->lookahead, $tokens) === false) { |
78 | - throw new FilterCompilerException("Expected " . implode(' or ', $tokens) . " but found " . $this->lookahead); |
|
78 | + throw new FilterCompilerException("Expected ".implode(' or ', $tokens)." but found ".$this->lookahead); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | private function returnPositionTag() { |
163 | - return ":filter_bind_" . ( ++$this->numPositions); |
|
163 | + return ":filter_bind_".( ++$this->numPositions); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | private function parseObracket() { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | if ($this->token === false && strlen($this->filter) > 0) { |
240 | - throw new FilterCompilerException("Unexpected character [" . $this->filter[0] . "] begining " . $this->filter . "."); |
|
240 | + throw new FilterCompilerException("Unexpected character [".$this->filter[0]."] begining ".$this->filter."."); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $rewritten = []; |
252 | 252 | foreach ($data as $key => $value) { |
253 | 253 | if (is_numeric($key)) { |
254 | - $rewritten["filter_bind_" . ($key + 1)] = $value; |
|
254 | + $rewritten["filter_bind_".($key + 1)] = $value; |
|
255 | 255 | } else { |
256 | 256 | $rewritten[$key] = $value; |
257 | 257 | } |