@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | $this->checkDb(); |
| 136 | 136 | $params = is_array($value) ? $value : [$value]; |
| 137 | 137 | $this->db->connect() |
| 138 | - ->select() |
|
| 139 | - ->from($this ->tableName) |
|
| 140 | - ->where($where) |
|
| 141 | - ->execute($params) |
|
| 142 | - ->fetchInto($this); |
|
| 138 | + ->select() |
|
| 139 | + ->from($this ->tableName) |
|
| 140 | + ->where($where) |
|
| 141 | + ->execute($params) |
|
| 142 | + ->fetchInto($this); |
|
| 143 | 143 | return $this; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | $values = array_values($properties); |
| 243 | 243 | |
| 244 | 244 | $this->db->connect() |
| 245 | - ->insert($this->tableName, $columns) |
|
| 246 | - ->execute($values); |
|
| 245 | + ->insert($this->tableName, $columns) |
|
| 246 | + ->execute($values); |
|
| 247 | 247 | |
| 248 | 248 | $this->{$this->tableIdColumn} = $this->db->lastInsertId(); |
| 249 | 249 | } |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | $values[] = $this->{$this->tableIdColumn}; |
| 266 | 266 | |
| 267 | 267 | $this->db->connect() |
| 268 | - ->update($this->tableName, $columns) |
|
| 269 | - ->where("{$this->tableIdColumn} = ?") |
|
| 270 | - ->execute($values); |
|
| 268 | + ->update($this->tableName, $columns) |
|
| 269 | + ->where("{$this->tableIdColumn} = ?") |
|
| 270 | + ->execute($values); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | $values = array_merge($values, $values1); |
| 300 | 300 | |
| 301 | 301 | $this->db->connect() |
| 302 | - ->update($this->tableName, $columns) |
|
| 303 | - ->where($where) |
|
| 304 | - ->execute($values); |
|
| 302 | + ->update($this->tableName, $columns) |
|
| 303 | + ->where($where) |
|
| 304 | + ->execute($values); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
@@ -321,9 +321,9 @@ discard block |
||
| 321 | 321 | $id = $id ?: $this->{$this->tableIdColumn}; |
| 322 | 322 | |
| 323 | 323 | $this->db->connect() |
| 324 | - ->deleteFrom($this->tableName) |
|
| 325 | - ->where("{$this->tableIdColumn} = ?") |
|
| 326 | - ->execute([$id]); |
|
| 324 | + ->deleteFrom($this->tableName) |
|
| 325 | + ->where("{$this->tableIdColumn} = ?") |
|
| 326 | + ->execute([$id]); |
|
| 327 | 327 | |
| 328 | 328 | $this->{$this->tableIdColumn} = null; |
| 329 | 329 | } |
@@ -352,8 +352,8 @@ discard block |
||
| 352 | 352 | $values = is_array($value) ? $value : [$value]; |
| 353 | 353 | |
| 354 | 354 | $this->db->connect() |
| 355 | - ->deleteFrom($this->tableName) |
|
| 356 | - ->where($where) |
|
| 357 | - ->execute($values); |
|
| 355 | + ->deleteFrom($this->tableName) |
|
| 356 | + ->where($where) |
|
| 357 | + ->execute($values); |
|
| 358 | 358 | } |
| 359 | 359 | } |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $properties = get_object_vars($this); |
| 74 | 74 | unset( |
| 75 | - $properties['tableName'], |
|
| 76 | - $properties['db'], |
|
| 77 | - $properties['di'], |
|
| 78 | - $properties['tableIdColumn'] |
|
| 75 | + $properties[ 'tableName' ], |
|
| 76 | + $properties[ 'db' ], |
|
| 77 | + $properties[ 'di' ], |
|
| 78 | + $properties[ 'tableIdColumn' ] |
|
| 79 | 79 | ); |
| 80 | 80 | return $properties; |
| 81 | 81 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | public function findWhere($where, $value) : object |
| 134 | 134 | { |
| 135 | 135 | $this->checkDb(); |
| 136 | - $params = is_array($value) ? $value : [$value]; |
|
| 136 | + $params = is_array($value) ? $value : [ $value ]; |
|
| 137 | 137 | $this->db->connect() |
| 138 | 138 | ->select() |
| 139 | 139 | ->from($this ->tableName) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | public function findAllWhere($where, $value) |
| 180 | 180 | { |
| 181 | 181 | $this->checkDb(); |
| 182 | - $params = is_array($value) ? $value : [$value]; |
|
| 182 | + $params = is_array($value) ? $value : [ $value ]; |
|
| 183 | 183 | return $this->db->connect() |
| 184 | 184 | ->select() |
| 185 | 185 | ->from($this->tableName) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | { |
| 238 | 238 | $this->checkDb(); |
| 239 | 239 | $properties = $this->getProperties(); |
| 240 | - unset($properties[$this->tableIdColumn]); |
|
| 240 | + unset($properties[ $this->tableIdColumn ]); |
|
| 241 | 241 | $columns = array_keys($properties); |
| 242 | 242 | $values = array_values($properties); |
| 243 | 243 | |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | $this->checkDb(); |
| 261 | 261 | $properties = $this->getProperties(); |
| 262 | - unset($properties[$this->tableIdColumn]); |
|
| 262 | + unset($properties[ $this->tableIdColumn ]); |
|
| 263 | 263 | $columns = array_keys($properties); |
| 264 | 264 | $values = array_values($properties); |
| 265 | - $values[] = $this->{$this->tableIdColumn}; |
|
| 265 | + $values[ ] = $this->{$this->tableIdColumn}; |
|
| 266 | 266 | |
| 267 | 267 | $this->db->connect() |
| 268 | 268 | ->update($this->tableName, $columns) |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $values = array_values($properties); |
| 296 | 296 | $values1 = is_array($value) |
| 297 | 297 | ? $value |
| 298 | - : [$value]; |
|
| 298 | + : [ $value ]; |
|
| 299 | 299 | $values = array_merge($values, $values1); |
| 300 | 300 | |
| 301 | 301 | $this->db->connect() |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $this->db->connect() |
| 324 | 324 | ->deleteFrom($this->tableName) |
| 325 | 325 | ->where("{$this->tableIdColumn} = ?") |
| 326 | - ->execute([$id]); |
|
| 326 | + ->execute([ $id ]); |
|
| 327 | 327 | |
| 328 | 328 | $this->{$this->tableIdColumn} = null; |
| 329 | 329 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | public function deleteWhere($where, $value) |
| 350 | 350 | { |
| 351 | 351 | $this->checkDb(); |
| 352 | - $values = is_array($value) ? $value : [$value]; |
|
| 352 | + $values = is_array($value) ? $value : [ $value ]; |
|
| 353 | 353 | |
| 354 | 354 | $this->db->connect() |
| 355 | 355 | ->deleteFrom($this->tableName) |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function setDefaultsFromConfiguration() |
| 23 | 23 | { |
| 24 | - if ($this->options['dsn']) { |
|
| 25 | - $dsn = explode(':', $this->options['dsn']); |
|
| 26 | - $this->setSQLDialect($dsn[0]); |
|
| 24 | + if ($this->options[ 'dsn' ]) { |
|
| 25 | + $dsn = explode(':', $this->options[ 'dsn' ]); |
|
| 26 | + $this->setSQLDialect($dsn[ 0 ]); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $this->setTablePrefix($this->options['table_prefix']); |
|
| 29 | + $this->setTablePrefix($this->options[ 'table_prefix' ]); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return self |
| 41 | 41 | */ |
| 42 | - public function execute($query = null, array $params = []) : object |
|
| 42 | + public function execute($query = null, array $params = [ ]) : object |
|
| 43 | 43 | { |
| 44 | 44 | // When using one argument and its array, assume its $params |
| 45 | 45 | if (is_array($query)) { |
@@ -466,12 +466,12 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | - * Build the group by part. |
|
| 470 | - * |
|
| 471 | - * @param string $condition for building the group by part of the query. |
|
| 472 | - * |
|
| 473 | - * @return $this |
|
| 474 | - */ |
|
| 469 | + * Build the group by part. |
|
| 470 | + * |
|
| 471 | + * @param string $condition for building the group by part of the query. |
|
| 472 | + * |
|
| 473 | + * @return $this |
|
| 474 | + */ |
|
| 475 | 475 | public function groupBy($condition) |
| 476 | 476 | { |
| 477 | 477 | $this->groupby = "GROUP BY " . $condition; |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | |
| 484 | 484 | /** |
| 485 | - * Build the order by part. |
|
| 486 | - * |
|
| 487 | - * @param string $condition for building the where part of the query. |
|
| 488 | - * |
|
| 489 | - * @return $this |
|
| 490 | - */ |
|
| 485 | + * Build the order by part. |
|
| 486 | + * |
|
| 487 | + * @param string $condition for building the where part of the query. |
|
| 488 | + * |
|
| 489 | + * @return $this |
|
| 490 | + */ |
|
| 491 | 491 | public function orderBy($condition) |
| 492 | 492 | { |
| 493 | 493 | $this->orderby = "ORDER BY " . $condition; |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | protected function build() |
| 65 | 65 | { |
| 66 | 66 | $sql = $this->start . "\n" |
| 67 | - . ($this->from ? $this->from . "\n" : null) |
|
| 68 | - . ($this->join ? $this->join : null) |
|
| 69 | - . ($this->set ? $this->set . "\n" : null) |
|
| 70 | - . ($this->where ? $this->where . "\n" : null) |
|
| 67 | + . ($this->from ? $this->from . "\n" : null) |
|
| 68 | + . ($this->join ? $this->join : null) |
|
| 69 | + . ($this->set ? $this->set . "\n" : null) |
|
| 70 | + . ($this->where ? $this->where . "\n" : null) |
|
| 71 | 71 | . ($this->groupby ? $this->groupby . "\n" : null) |
| 72 | 72 | . ($this->orderby ? $this->orderby . "\n" : null) |
| 73 | - . ($this->limit ? $this->limit . "\n" : null) |
|
| 74 | - . ($this->offset ? $this->offset . "\n" : null) |
|
| 73 | + . ($this->limit ? $this->limit . "\n" : null) |
|
| 74 | + . ($this->offset ? $this->offset . "\n" : null) |
|
| 75 | 75 | . ";"; |
| 76 | 76 | |
| 77 | 77 | return $sql; |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $max = count($columns); |
| 228 | 228 | for ($i = 0; $i < $max; $i++) { |
| 229 | - $cols .= $columns[$i] . ', '; |
|
| 229 | + $cols .= $columns[ $i ] . ', '; |
|
| 230 | 230 | |
| 231 | - $val = $values[$i]; |
|
| 231 | + $val = $values[ $i ]; |
|
| 232 | 232 | |
| 233 | 233 | if ($val == '?') { |
| 234 | 234 | $vals .= $val . ', '; |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | $max = count($columns); |
| 283 | 283 | |
| 284 | 284 | for ($i = 0; $i < $max; $i++) { |
| 285 | - $cols .= "\t" . $columns[$i] . ' = '; |
|
| 285 | + $cols .= "\t" . $columns[ $i ] . ' = '; |
|
| 286 | 286 | |
| 287 | - $val = $values[$i]; |
|
| 287 | + $val = $values[ $i ]; |
|
| 288 | 288 | if ($val == '?') { |
| 289 | 289 | $cols .= $val . ",\n"; |
| 290 | 290 | } else { |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | // Create an array of '?' to match number of columns |
| 550 | 550 | $max = count($columns); |
| 551 | 551 | for ($i = 0; $i < $max; $i++) { |
| 552 | - $values[] = '?'; |
|
| 552 | + $values[ ] = '?'; |
|
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - return [$columns, $values]; |
|
| 557 | + return [ $columns, $values ]; |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | |
@@ -39,8 +39,8 @@ |
||
| 39 | 39 | { |
| 40 | 40 | $db = $di->get("dbqb"); |
| 41 | 41 | $db->connect() |
| 42 | - ->insert("Answers", ["questionId", "acronym", "answer", "points", "created"]) |
|
| 43 | - ->execute([$this->questionId, $this->acronym, $this->answer, $this->points, $this->created]); |
|
| 42 | + ->insert("Answers", [ "questionId", "acronym", "answer", "points", "created" ]) |
|
| 43 | + ->execute([ $this->questionId, $this->acronym, $this->answer, $this->points, $this->created ]); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | * @param array $attributes to set to the element. Default is an empty |
| 18 | 18 | * array. |
| 19 | 19 | */ |
| 20 | - public function __construct($name, $attributes = []) |
|
| 20 | + public function __construct($name, $attributes = [ ]) |
|
| 21 | 21 | { |
| 22 | 22 | parent::__construct($name, $attributes); |
| 23 | - $this['type'] = 'file'; |
|
| 23 | + $this[ 'type' ] = 'file'; |
|
| 24 | 24 | $this->UseNameAsDefaultLabel(); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | "pear" => "pear", |
| 98 | 98 | "banana" => "banana", |
| 99 | 99 | ], |
| 100 | - "checked" => ["potato", "pear"], |
|
| 100 | + "checked" => [ "potato", "pear" ], |
|
| 101 | 101 | ], |
| 102 | 102 | |
| 103 | 103 | "color" => [ |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | "submit" => [ |
| 200 | 200 | "type" => "submit", |
| 201 | 201 | "value" => "Submit", |
| 202 | - "callback" => [$this, "callbackSubmit"] |
|
| 202 | + "callback" => [ $this, "callbackSubmit" ] |
|
| 203 | 203 | ], |
| 204 | 204 | ] |
| 205 | 205 | ); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | "submit" => [ |
| 41 | 41 | "type" => "submit", |
| 42 | 42 | "value" => "Login", |
| 43 | - "callback" => [$this, "callbackSubmit"] |
|
| 43 | + "callback" => [ $this, "callbackSubmit" ] |
|
| 44 | 44 | ], |
| 45 | 45 | ] |
| 46 | 46 | ); |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | "submit" => [ |
| 52 | 52 | "type" => "submit", |
| 53 | 53 | "value" => "Ställ fråga", |
| 54 | - "callback" => [$this, "callbackSubmit"] |
|
| 54 | + "callback" => [ $this, "callbackSubmit" ] |
|
| 55 | 55 | ], |
| 56 | 56 | ] |
| 57 | 57 | ); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | "submit" => [ |
| 57 | 57 | "type" => "submit", |
| 58 | 58 | "value" => "Skicka", |
| 59 | - "callback" => [$this, "callbackSubmit"] |
|
| 59 | + "callback" => [ $this, "callbackSubmit" ] |
|
| 60 | 60 | ], |
| 61 | 61 | ] |
| 62 | 62 | ); |