@@ -69,29 +69,29 @@ |
||
| 69 | 69 | |
| 70 | 70 | public function submit(Form $form, ArrayHash $values) |
| 71 | 71 | { |
| 72 | - $values = (array)$values; |
|
| 73 | - $keys = array_map(function ($key) { |
|
| 74 | - return '`' . $key . '`'; |
|
| 72 | + $values = (array) $values; |
|
| 73 | + $keys = array_map(function($key) { |
|
| 74 | + return '`'.$key.'`'; |
|
| 75 | 75 | }, array_keys($values)); |
| 76 | - $vals = array_map(function ($key) { |
|
| 77 | - return ':' . $key; |
|
| 76 | + $vals = array_map(function($key) { |
|
| 77 | + return ':'.$key; |
|
| 78 | 78 | }, array_keys($values)); |
| 79 | 79 | if ($this->item) { |
| 80 | 80 | $query = sprintf('UPDATE `%s` SET ', $this->table); |
| 81 | 81 | $set = []; |
| 82 | 82 | foreach ($values as $key => $value) { |
| 83 | - $set[] = '`' . $key . '` = :' . $key; |
|
| 83 | + $set[] = '`'.$key.'` = :'.$key; |
|
| 84 | 84 | } |
| 85 | 85 | $query .= implode(', ', $set); |
| 86 | 86 | $primaryColumns = $this->dataManager->getPrimaryColumns($this->type, $this->table); |
| 87 | 87 | $query .= sprintf(' WHERE md5(concat(%s)) = "%s"', implode(', "|", ', $primaryColumns), $this->item); |
| 88 | 88 | } else { |
| 89 | - $query = sprintf('INSERT INTO `%s` %s VALUES %s', $this->table, '(' . implode(', ', $keys) . ')', '(' . implode(', ', $vals) . ')'); |
|
| 89 | + $query = sprintf('INSERT INTO `%s` %s VALUES %s', $this->table, '('.implode(', ', $keys).')', '('.implode(', ', $vals).')'); |
|
| 90 | 90 | } |
| 91 | 91 | $statement = $this->pdo->prepare($query); |
| 92 | 92 | foreach ($values as $key => $value) { |
| 93 | 93 | $value = $value === '' && $this->columns[$key]['Null'] ? null : $value; |
| 94 | - $statement->bindValue(':' . $key, $value); |
|
| 94 | + $statement->bindValue(':'.$key, $value); |
|
| 95 | 95 | } |
| 96 | 96 | $ret = $statement->execute(); |
| 97 | 97 | if (!$ret) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function itemsCount($type, $table, array $filter = []) |
| 100 | 100 | { |
| 101 | - $query = sprintf('SELECT count(*) FROM `%s`', $table) . $this->createWhere($filter); |
|
| 101 | + $query = sprintf('SELECT count(*) FROM `%s`', $table).$this->createWhere($filter); |
|
| 102 | 102 | return $this->connection->query($query)->fetch(PDO::FETCH_COLUMN); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $query = sprintf('SELECT * FROM `%s`', $table); |
| 109 | 109 | $query .= $this->createWhere($filter); |
| 110 | 110 | $query .= $this->createOrderBy($sorting); |
| 111 | - $query .= ' LIMIT ' . (($page - 1) * $onPage) . ', ' . $onPage; |
|
| 111 | + $query .= ' LIMIT '.(($page - 1) * $onPage).', '.$onPage; |
|
| 112 | 112 | $items = []; |
| 113 | 113 | foreach ($this->connection->query($query)->fetchAll(PDO::FETCH_ASSOC) as $item) { |
| 114 | 114 | $pk = []; |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | foreach ($filterPart as $key => $filterSettings) { |
| 150 | 150 | foreach ($filterSettings as $operator => $value) { |
| 151 | 151 | if (!isset($operatorsMap[$operator])) { |
| 152 | - throw new OperatorNotSupportedException('Operator "' . $operator . '" is not supported.'); |
|
| 152 | + throw new OperatorNotSupportedException('Operator "'.$operator.'" is not supported.'); |
|
| 153 | 153 | } |
| 154 | - $whereParts[] = "`$key` " . sprintf($operatorsMap[$operator], $value); |
|
| 154 | + $whereParts[] = "`$key` ".sprintf($operatorsMap[$operator], $value); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } elseif ($type === MySqlDriver::TYPE_VIEW) { |
| 198 | 198 | $query = sprintf('DROP VIEW `%s`', $table); |
| 199 | 199 | } else { |
| 200 | - throw new InvalidArgumentException('Type "' . $type . '" is not supported'); |
|
| 200 | + throw new InvalidArgumentException('Type "'.$type.'" is not supported'); |
|
| 201 | 201 | } |
| 202 | 202 | return $this->connection->query($query); |
| 203 | 203 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | public function execute($commands) |
| 252 | 252 | { |
| 253 | - $queries = array_filter(array_map('trim', explode(';', $commands)), function ($query) { |
|
| 253 | + $queries = array_filter(array_map('trim', explode(';', $commands)), function($query) { |
|
| 254 | 254 | return $query; |
| 255 | 255 | }); |
| 256 | 256 | $results = []; |
@@ -292,7 +292,7 @@ |
||
| 292 | 292 | |
| 293 | 293 | public function execute($commands) |
| 294 | 294 | { |
| 295 | - $listOfCommands = array_filter(array_map('trim', explode("\n", $commands)), function ($command) { |
|
| 295 | + $listOfCommands = array_filter(array_map('trim', explode("\n", $commands)), function($command) { |
|
| 296 | 296 | return $command; |
| 297 | 297 | }); |
| 298 | 298 | |