@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | |
44 | 44 | public function prepareQuery($data) |
45 | 45 | { |
46 | - if(!array_key_exists($this->options['local_key'], $data)) { |
|
46 | + if (!array_key_exists($this->options['local_key'], $data)) { |
|
47 | 47 | throw new FieldNotFoundException("Field {$this->options['local_key']} not found for belongs to relationship query."); |
48 | 48 | } |
49 | - if(!isset($data[$this->options['local_key']])) { |
|
49 | + if (!isset($data[$this->options['local_key']])) { |
|
50 | 50 | return null; |
51 | 51 | } |
52 | 52 | $query = $this->getQuery(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->options['foreign_key'] = $model->getDescription()->getPrimaryKey()[0]; |
70 | 70 | } |
71 | 71 | if ($this->options['local_key'] == null) { |
72 | - $this->options['local_key'] = Text::singularize($table) . '_id'; |
|
72 | + $this->options['local_key'] = Text::singularize($table).'_id'; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | public function doFilter() |
241 | 241 | { |
242 | 242 | $arguments = func_get_args(); |
243 | - if(count($arguments) == 1 && is_array($arguments[0])) { |
|
244 | - foreach($arguments[0] as $field => $value) { |
|
243 | + if (count($arguments) == 1 && is_array($arguments[0])) { |
|
244 | + foreach ($arguments[0] as $field => $value) { |
|
245 | 245 | $this->getQueryParameters()->addFilter($field, $value); |
246 | 246 | } |
247 | 247 | } else { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | |
350 | 350 | public function doWith($model) |
351 | 351 | { |
352 | - if(!isset($this->wrapper->getDescription()->getRelationships()[$model])) { |
|
352 | + if (!isset($this->wrapper->getDescription()->getRelationships()[$model])) { |
|
353 | 353 | throw new ModelNotFoundException("Could not find related model [$model]"); |
354 | 354 | } |
355 | 355 | $relationship = $this->wrapper->getDescription()->getRelationships()[$model]; |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | $this->table = $table['table']; |
136 | 136 | $this->schema = $table['schema']; |
137 | 137 | } |
138 | - $this->quotedTable = ($this->schema ? "{$driver->quoteIdentifier($this->schema)}." : "") . $driver->quoteIdentifier($this->table); |
|
139 | - $this->unquotedTable = ($this->schema ? "{$this->schema}." : "") . $this->table; |
|
138 | + $this->quotedTable = ($this->schema ? "{$driver->quoteIdentifier($this->schema)}." : "").$driver->quoteIdentifier($this->table); |
|
139 | + $this->unquotedTable = ($this->schema ? "{$this->schema}." : "").$this->table; |
|
140 | 140 | $this->adapter->setModel($this, $this->quotedTable); |
141 | 141 | $this->initialized = true; |
142 | 142 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $this->initialize(); |
157 | 157 | return $this->context->getCache()->read( |
158 | - "{$this->className}::desc", function () { |
|
158 | + "{$this->className}::desc", function() { |
|
159 | 159 | return $this->context->getModelDescription($this); |
160 | 160 | } |
161 | 161 | ); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $this->getToken(); |
62 | 62 | $expression = $this->parseExpression(); |
63 | 63 | if ($this->token !== false) { |
64 | - throw new FilterCompilerException("Unexpected '" . $this->token . "' in filter [$filter]"); |
|
64 | + throw new FilterCompilerException("Unexpected '".$this->token."' in filter [$filter]"); |
|
65 | 65 | } |
66 | 66 | $parsed = $this->renderExpression($expression); |
67 | 67 | return $parsed; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | private function renderExpression($expression) |
71 | 71 | { |
72 | 72 | if (is_array($expression)) { |
73 | - $expression = $this->renderExpression($expression['left']) . " {$expression['opr']} " . $this->renderExpression($expression['right']); |
|
73 | + $expression = $this->renderExpression($expression['left'])." {$expression['opr']} ".$this->renderExpression($expression['right']); |
|
74 | 74 | } |
75 | 75 | return $expression; |
76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $tokens = [$tokens]; |
82 | 82 | } |
83 | 83 | if (array_search($this->lookahead, $tokens) === false) { |
84 | - throw new FilterCompilerException("Expected " . implode(' or ', $tokens) . " but found " . $this->lookahead); |
|
84 | + throw new FilterCompilerException("Expected ".implode(' or ', $tokens)." but found ".$this->lookahead); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | private function returnPositionTag() |
175 | 175 | { |
176 | - return ":filter_bind_" . (++$this->numPositions); |
|
176 | + return ":filter_bind_".(++$this->numPositions); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | private function parseObracket() |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | if ($this->token === false && strlen($this->filter) > 0) { |
261 | - throw new FilterCompilerException("Unexpected character [" . $this->filter[0] . "] begining " . $this->filter . "."); |
|
261 | + throw new FilterCompilerException("Unexpected character [".$this->filter[0]."] begining ".$this->filter."."); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $rewritten = []; |
275 | 275 | foreach ($data as $key => $value) { |
276 | 276 | if (is_numeric($key)) { |
277 | - $rewritten["filter_bind_" . ($key + 1)] = $value; |
|
277 | + $rewritten["filter_bind_".($key + 1)] = $value; |
|
278 | 278 | } else { |
279 | 279 | $rewritten[$key] = $value; |
280 | 280 | } |