@@ -97,7 +97,7 @@ |
||
| 97 | 97 | * @param string $tableName The name of the table |
| 98 | 98 | * |
| 99 | 99 | * @return bool True if the table has been dropped, otherwise false |
| 100 | - */ |
|
| 100 | + */ |
|
| 101 | 101 | public function dropTable(string $tableName): bool |
| 102 | 102 | { |
| 103 | 103 | $sql = trim(sprintf('DROP TABLE %s', $tableName)); |
@@ -261,7 +261,7 @@ |
||
| 261 | 261 | */ |
| 262 | 262 | public function beginTransaction(): void |
| 263 | 263 | { |
| 264 | - if (! $this->inTransaction()) { |
|
| 264 | + if (!$this->inTransaction()) { |
|
| 265 | 265 | $this->getConnection()->beginTransaction(); |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -131,8 +131,8 @@ |
||
| 131 | 131 | */ |
| 132 | 132 | public function escape(string $str): string |
| 133 | 133 | { |
| 134 | - $list = explode('.', $str); |
|
| 135 | - return implode('.', $this->escapeList($list)); |
|
| 134 | + $list = explode('.', $str); |
|
| 135 | + return implode('.', $this->escapeList($list)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | // check for required attributes |
| 164 | 164 | foreach ($this->dsnAttributes as $attribute) { |
| 165 | - if (! array_key_exists($attribute, $settings)) { |
|
| 165 | + if (!array_key_exists($attribute, $settings)) { |
|
| 166 | 166 | throw new Exception\MissingArgException('This configuration parameter is missing: "'.$attribute.'"'); |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // defaut output format |
| 171 | - if (array_key_exists('default_output_format', $settings)){ |
|
| 171 | + if (array_key_exists('default_output_format', $settings)) { |
|
| 172 | 172 | $format = $settings['default_output_format']; |
| 173 | - if (!in_array($format, $this->outputFormats)){ |
|
| 173 | + if (!in_array($format, $this->outputFormats)) { |
|
| 174 | 174 | throw new Exception\InvalidArgException('The default output format specified is invalid.'); |
| 175 | 175 | } |
| 176 | 176 | $this->defaultOutputFormat = $format; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $this->createConnection($settings); |
| 180 | 180 | $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
| 181 | - $this->hostname = array_key_exists('hostname',$settings) && $settings['hostname'] ? $settings['hostname'] : ''; |
|
| 181 | + $this->hostname = array_key_exists('hostname', $settings) && $settings['hostname'] ? $settings['hostname'] : ''; |
|
| 182 | 182 | $this->driverName = $settings['driver']; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function errorCode(): int |
| 214 | 214 | { |
| 215 | - return !empty($this->error) ? $this->error['code']: ''; |
|
| 215 | + return !empty($this->error) ? $this->error['code'] : ''; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | return $pdoStatement->execute($parameters); |
| 257 | 257 | } catch (\PDOException $e) { |
| 258 | 258 | // register error |
| 259 | - $this->error['code'] = (int)$e->getCode(); |
|
| 259 | + $this->error['code'] = (int) $e->getCode(); |
|
| 260 | 260 | $this->error['message'] = $e->getMessage(); |
| 261 | 261 | return false; |
| 262 | 262 | } |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function lastInsertedId(): string |
| 124 | 124 | { |
| 125 | - // Postgres does not set pdo->lastInsertedId |
|
| 126 | - // use sequence |
|
| 127 | - try { |
|
| 125 | + // Postgres does not set pdo->lastInsertedId |
|
| 126 | + // use sequence |
|
| 127 | + try { |
|
| 128 | 128 | $rq = $this->pdo->prepare('SELECT LASTVAL()'); |
| 129 | 129 | $rq->execute(); |
| 130 | 130 | // return string |
@@ -158,7 +158,6 @@ discard block |
||
| 158 | 158 | /** |
| 159 | 159 | * Get whether foreign keys are enabled or not |
| 160 | 160 | * For compatibility with Sqlite, not implemented in that driver, return false |
| 161 | - |
|
| 162 | 161 | * @access public |
| 163 | 162 | * @return bool true if foreign keys are enabled, otherwise false |
| 164 | 163 | */ |
@@ -182,11 +181,11 @@ discard block |
||
| 182 | 181 | public function addForeignKey(string $fkName, string $srcTable, string $srcColumn, string $refTable, string $refColumn): bool |
| 183 | 182 | { |
| 184 | 183 | $sql = sprintf('ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', |
| 185 | - $this->escape($srcTable), |
|
| 186 | - $fkName, |
|
| 187 | - $this->escape($srcColumn), |
|
| 188 | - $this->escape($refTable), |
|
| 189 | - $this->escape($refColumn) |
|
| 184 | + $this->escape($srcTable), |
|
| 185 | + $fkName, |
|
| 186 | + $this->escape($srcColumn), |
|
| 187 | + $this->escape($refTable), |
|
| 188 | + $this->escape($refColumn) |
|
| 190 | 189 | ); |
| 191 | 190 | return $this->prepareAndExecuteSql($sql); |
| 192 | 191 | } |
@@ -203,9 +202,9 @@ discard block |
||
| 203 | 202 | public function dropForeignKey(string $fkName, string $tableName, bool $ifExists = false): bool |
| 204 | 203 | { |
| 205 | 204 | $sql = sprintf('ALTER TABLE %s DROP CONSTRAINT %s %s', |
| 206 | - $this->escape($tableName), |
|
| 207 | - $ifExists ? 'IF EXISTS' : '', |
|
| 208 | - $fkName |
|
| 205 | + $this->escape($tableName), |
|
| 206 | + $ifExists ? 'IF EXISTS' : '', |
|
| 207 | + $fkName |
|
| 209 | 208 | ); |
| 210 | 209 | return $this->prepareAndExecuteSql($sql); |
| 211 | 210 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function createConnection(array $settings): void |
| 100 | 100 | { |
| 101 | - $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
|
| 102 | - $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
|
| 103 | - $dsn = 'pgsql:host='.$settings['hostname'] .$port .$dbname ; |
|
| 101 | + $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
|
| 102 | + $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
|
| 103 | + $dsn = 'pgsql:host='.$settings['hostname'].$port.$dbname; |
|
| 104 | 104 | |
| 105 | 105 | $this->pdo = new \PDO( |
| 106 | 106 | $dsn, |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | { |
| 223 | 223 | $sql = 'SELECT COUNT(*) FROM pg_database WHERE datname = :dbName'; |
| 224 | 224 | $query = $this->pdo->prepare($sql); |
| 225 | - $query->bindValue(':dbName', $databaseName, \PDO::PARAM_STR); |
|
| 225 | + $query->bindValue(':dbName', $databaseName, \PDO::PARAM_STR); |
|
| 226 | 226 | $query->execute(); |
| 227 | 227 | return (bool) $query->fetchColumn(); |
| 228 | 228 | } |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | * |
| 238 | 238 | * @return bool True if the database has been created, otherwise false. |
| 239 | 239 | */ |
| 240 | - public function createDatabase(string $databaseName, ?string $owner= null, ?string $template = 'template0'): bool |
|
| 240 | + public function createDatabase(string $databaseName, ?string $owner = null, ?string $template = 'template0'): bool |
|
| 241 | 241 | { |
| 242 | 242 | $sql = trim(sprintf('CREATE DATABASE %s %s TEMPLATE %s', |
| 243 | 243 | $this->escape($databaseName), |
| 244 | - isset($owner) ? 'OWNER '. $this->escape($owner) : '', |
|
| 244 | + isset($owner) ? 'OWNER '.$this->escape($owner) : '', |
|
| 245 | 245 | $template |
| 246 | 246 | )); |
| 247 | 247 | return $this->prepareAndExecuteSql($sql); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $sql = trim(sprintf('CREATE USER %s PASSWORD %s', |
| 262 | 262 | $this->escape($userName), |
| 263 | - "'" . $userPassword ."'" |
|
| 263 | + "'".$userPassword."'" |
|
| 264 | 264 | )); |
| 265 | 265 | return $this->prepareAndExecuteSql($sql); |
| 266 | 266 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | public function dropUser(string $userName, bool $ifExists = false): bool |
| 278 | 278 | { |
| 279 | 279 | $sql = trim(sprintf('DROP USER %s %s', |
| 280 | - $ifExists === true ? 'IF EXISTS': '', |
|
| 280 | + $ifExists === true ? 'IF EXISTS' : '', |
|
| 281 | 281 | $this->escape($userName) |
| 282 | 282 | )); |
| 283 | 283 | return $this->prepareAndExecuteSql($sql); |
@@ -129,8 +129,7 @@ |
||
| 129 | 129 | $rq->execute(); |
| 130 | 130 | // return string |
| 131 | 131 | return strval($rq->fetchColumn()); |
| 132 | - } |
|
| 133 | - catch (\PDOException $e) { |
|
| 132 | + } catch (\PDOException $e) { |
|
| 134 | 133 | return 0; |
| 135 | 134 | } |
| 136 | 135 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function __construct(array $settings, bool $isServerConnection = false) |
| 38 | 38 | { |
| 39 | 39 | // remove database attribute for server connection |
| 40 | - if ($isServerConnection){ |
|
| 40 | + if ($isServerConnection) { |
|
| 41 | 41 | $dbKey = array_search('database', $this->dsnAttributes); |
| 42 | 42 | if ($dbKey !== false) { |
| 43 | 43 | unset($this->dsnAttributes[$dbKey]); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return bool True if the database has been created, otherwise false. |
| 68 | 68 | */ |
| 69 | - abstract public function createDatabase(string $databaseName, ?string $owner= null, ?string $template = null): bool; |
|
| 69 | + abstract public function createDatabase(string $databaseName, ?string $owner = null, ?string $template = null): bool; |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Create a user |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
| 87 | 87 | $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
| 88 | 88 | $options = [ |
| 89 | - // \PDO::ATTR_EMULATE_PREPARES => false, |
|
| 89 | + // \PDO::ATTR_EMULATE_PREPARES => false, |
|
| 90 | 90 | ]; |
| 91 | 91 | |
| 92 | 92 | $this->pdo = new \PDO( |
@@ -138,7 +138,6 @@ discard block |
||
| 138 | 138 | /** |
| 139 | 139 | * Get whether foreign keys are enabled or not |
| 140 | 140 | * For compatibility with Sqlite, not implemented in that driver, return false |
| 141 | - |
|
| 142 | 141 | * @access public |
| 143 | 142 | * @return bool true if foreign keys are enabled, otherwise false |
| 144 | 143 | */ |
@@ -162,11 +161,11 @@ discard block |
||
| 162 | 161 | public function addForeignKey(string $fkName, string $srcTable, string $srcColumn, string $refTable, string $refColumn): bool |
| 163 | 162 | { |
| 164 | 163 | $sql = sprintf('ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', |
| 165 | - $this->escape($srcTable), |
|
| 166 | - $fkName, |
|
| 167 | - $this->escape($srcColumn), |
|
| 168 | - $this->escape($refTable), |
|
| 169 | - $this->escape($refColumn) |
|
| 164 | + $this->escape($srcTable), |
|
| 165 | + $fkName, |
|
| 166 | + $this->escape($srcColumn), |
|
| 167 | + $this->escape($refTable), |
|
| 168 | + $this->escape($refColumn) |
|
| 170 | 169 | ); |
| 171 | 170 | return $this->prepareAndExecuteSql($sql); |
| 172 | 171 | } |
@@ -183,8 +182,8 @@ discard block |
||
| 183 | 182 | public function dropForeignKey(string $fkName, string $tableName): bool |
| 184 | 183 | { |
| 185 | 184 | $sql = sprintf('ALTER TABLE %s DROP FOREIGN KEY %s', |
| 186 | - $this->escape($tableName), |
|
| 187 | - $fkName |
|
| 185 | + $this->escape($tableName), |
|
| 186 | + $fkName |
|
| 188 | 187 | ); |
| 189 | 188 | return $this->prepareAndExecuteSql($sql); |
| 190 | 189 | } |
@@ -239,7 +238,7 @@ discard block |
||
| 239 | 238 | "'" . $userPassword ."'" |
| 240 | 239 | )); |
| 241 | 240 | return $this->prepareAndExecuteSql($sql); |
| 242 | - } |
|
| 241 | + } |
|
| 243 | 242 | |
| 244 | 243 | /** |
| 245 | 244 | * Drop a user |
@@ -269,7 +268,7 @@ discard block |
||
| 269 | 268 | * |
| 270 | 269 | * @return bool True if the user has been granted, otherwise false. |
| 271 | 270 | */ |
| 272 | - public function grantUser(string $databaseName, string $userName): bool |
|
| 271 | + public function grantUser(string $databaseName, string $userName): bool |
|
| 273 | 272 | { |
| 274 | 273 | $sql = trim(sprintf('GRANT ALL ON %s.* TO %s@%s; FLUSH PRIVILEGES;', |
| 275 | 274 | $this->escape($databaseName), |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function escapeIdentifier(string $identifier): string |
| 58 | 58 | { |
| 59 | - return '`' . $identifier .'`'; |
|
| 59 | + return '`'.$identifier.'`'; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function createConnection(array $settings): void |
| 84 | 84 | { |
| 85 | - $charset = !empty($settings['charset']) ? ';charset='.$settings['charset'] : ';charset=utf8'; |
|
| 86 | - $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
|
| 87 | - $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
|
| 85 | + $charset = !empty($settings['charset']) ? ';charset='.$settings['charset'] : ';charset=utf8'; |
|
| 86 | + $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
|
| 87 | + $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
|
| 88 | 88 | $options = [ |
| 89 | 89 | // \PDO::ATTR_EMULATE_PREPARES => false, |
| 90 | 90 | ]; |
| 91 | 91 | |
| 92 | 92 | $this->pdo = new \PDO( |
| 93 | - 'mysql:host='.$settings['hostname'] .$port .$dbname .$charset, |
|
| 93 | + 'mysql:host='.$settings['hostname'].$port.$dbname.$charset, |
|
| 94 | 94 | $settings['username'], |
| 95 | 95 | $settings['password'], |
| 96 | 96 | $options |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $sql = 'SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = :dbName'; |
| 203 | 203 | $query = $this->pdo->prepare($sql); |
| 204 | - $query->bindValue(':dbName', $databaseName, \PDO::PARAM_STR); |
|
| 204 | + $query->bindValue(':dbName', $databaseName, \PDO::PARAM_STR); |
|
| 205 | 205 | $query->execute(); |
| 206 | 206 | return (bool) $query->fetchColumn(); |
| 207 | 207 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function createDatabase(string $databaseName, ?string $owner = null, ?string $template = null): bool |
| 220 | 220 | { |
| 221 | - $sql = trim(sprintf('CREATE DATABASE %s', $this->escape($databaseName))); |
|
| 221 | + $sql = trim(sprintf('CREATE DATABASE %s', $this->escape($databaseName))); |
|
| 222 | 222 | return $this->prepareAndExecuteSql($sql); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $sql = trim(sprintf('CREATE USER %s@%s IDENTIFIED BY %s', |
| 237 | 237 | $this->escape($userName), |
| 238 | 238 | $this->escape($this->getHostName()), |
| 239 | - "'" . $userPassword ."'" |
|
| 239 | + "'".$userPassword."'" |
|
| 240 | 240 | )); |
| 241 | 241 | return $this->prepareAndExecuteSql($sql); |
| 242 | 242 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public function dropUser(string $userName, bool $ifExists = false): bool |
| 254 | 254 | { |
| 255 | 255 | $sql = trim(sprintf('DROP USER %s %s@%s', |
| 256 | - $ifExists === true ? 'IF EXISTS': '', |
|
| 256 | + $ifExists === true ? 'IF EXISTS' : '', |
|
| 257 | 257 | $this->escape($userName), |
| 258 | 258 | $this->escape($this->getHostName()) |
| 259 | 259 | )); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function sqlCreateTableOptions(): string |
| 322 | 322 | { |
| 323 | - $engine = !empty($settings['engine']) ? $settings['engine'] : 'InnoDB'; |
|
| 323 | + $engine = !empty($settings['engine']) ? $settings['engine'] : 'InnoDB'; |
|
| 324 | 324 | $charset = !empty($settings['charset']) ? $settings['charset'] : 'utf8'; |
| 325 | 325 | $collate = !empty($settings['collate']) ? $settings['collate'] : 'utf8_unicode_ci'; |
| 326 | 326 | return sprintf('ENGINE=%s DEFAULT CHARSET=%s COLLATE=%s;', $engine, $charset, $collate); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public function sqlColumnAutoIncrement(string $type): string |
| 351 | 351 | { |
| 352 | - return $type .' AUTO_INCREMENT'; |
|
| 352 | + return $type.' AUTO_INCREMENT'; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | protected function getArgName(string $column): string |
| 63 | 63 | { |
| 64 | - return '_' . str_replace('.', '_', $column); |
|
| 64 | + return '_' . str_replace('.', '_', $column); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function getArgName(string $column): string |
| 63 | 63 | { |
| 64 | - return '_' . str_replace('.', '_', $column); |
|
| 64 | + return '_'.str_replace('.', '_', $column); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | // Define column parameters |
| 78 | 78 | $columns = func_get_args(); |
| 79 | - if (!empty($columns)){ |
|
| 79 | + if (!empty($columns)) { |
|
| 80 | 80 | |
| 81 | 81 | // clear current parameters |
| 82 | 82 | unset($this->parameters); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function fn(string $function, string $column, string $operator, $value) |
| 50 | 50 | { |
| 51 | - $sql = $function .'('. ($column ? $this->query->escape($column): '') . ') ' . $operator . ' '; |
|
| 51 | + $sql = $function.'('.($column ? $this->query->escape($column) : '').') '.$operator.' '; |
|
| 52 | 52 | $this->addCondition($function, $sql, $column, $value); |
| 53 | 53 | return $this->returnFunction(); |
| 54 | 54 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function count(string $operator, $value) |
| 66 | 66 | { |
| 67 | - $sql = 'COUNT(*) '. $operator. ' '; |
|
| 67 | + $sql = 'COUNT(*) '.$operator.' '; |
|
| 68 | 68 | $this->addCondition('COUNT', $sql, 'COUNT', $value); |
| 69 | 69 | return $this->returnFunction(); |
| 70 | 70 | } |
@@ -90,12 +90,12 @@ |
||
| 90 | 90 | */ |
| 91 | 91 | public function sql(): string |
| 92 | 92 | { |
| 93 | - // Build sql where and escape table name |
|
| 94 | - $sqlWhere = (isset($this->where)) ? $this->where->sql() : ''; |
|
| 95 | - $sqlTableName = $this->escape($this->tableName); |
|
| 93 | + // Build sql where and escape table name |
|
| 94 | + $sqlWhere = (isset($this->where)) ? $this->where->sql() : ''; |
|
| 95 | + $sqlTableName = $this->escape($this->tableName); |
|
| 96 | 96 | |
| 97 | - // DELETE query |
|
| 98 | - return trim(sprintf('DELETE FROM %s %s', |
|
| 97 | + // DELETE query |
|
| 98 | + return trim(sprintf('DELETE FROM %s %s', |
|
| 99 | 99 | $sqlTableName, |
| 100 | 100 | $sqlWhere)); |
| 101 | 101 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | public function where(): Where |
| 63 | 63 | { |
| 64 | - if (!isset($this->where)){ |
|
| 64 | + if (!isset($this->where)) { |
|
| 65 | 65 | $this->where = new Query\Where($this, $this->driver); |
| 66 | 66 | } |
| 67 | 67 | return $this->where; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @access protected |
| 101 | 101 | * @var QueryBuilder |
| 102 | 102 | */ |
| 103 | - protected $topQuery = null; |
|
| 103 | + protected $topQuery = null; |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Constructor |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - /** |
|
| 124 | + /** |
|
| 125 | 125 | * Parse the columns arguments for the select query |
| 126 | 126 | * |
| 127 | 127 | * @access protected |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function count(string $alias) |
| 201 | 201 | { |
| 202 | - $this->columns[] = array( |
|
| 202 | + $this->columns[] = array( |
|
| 203 | 203 | 'type' => 'count', |
| 204 | 204 | 'alias' => $alias |
| 205 | 205 | ); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function sum(string $column, string $alias) |
| 218 | 218 | { |
| 219 | - $this->columns[] = array( |
|
| 219 | + $this->columns[] = array( |
|
| 220 | 220 | 'type' => 'sum', |
| 221 | 221 | 'name' => $column, |
| 222 | 222 | 'alias' => $alias |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function min(string $column, string $alias) |
| 236 | 236 | { |
| 237 | - $this->columns[] = array( |
|
| 237 | + $this->columns[] = array( |
|
| 238 | 238 | 'type' => 'min', |
| 239 | 239 | 'name' => $column, |
| 240 | 240 | 'alias' => $alias |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function max(string $column, string $alias) |
| 254 | 254 | { |
| 255 | - $this->columns[] = array( |
|
| 255 | + $this->columns[] = array( |
|
| 256 | 256 | 'type' => 'max', |
| 257 | 257 | 'name' => $column, |
| 258 | 258 | 'alias' => $alias |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $this->topQuery = $query; |
| 117 | 117 | |
| 118 | 118 | // columns arguments |
| 119 | - if (! empty($args)) { |
|
| 119 | + if (!empty($args)) { |
|
| 120 | 120 | $this->parseColumnsArguments($args); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $cols = (count($args) === 1 && is_array($args[0])) ? $args[0] : $args; |
| 136 | 136 | |
| 137 | 137 | // parse column |
| 138 | - foreach ($cols as $key => $value){ |
|
| 138 | + foreach ($cols as $key => $value) { |
|
| 139 | 139 | |
| 140 | 140 | // Each arg could be a non indexed array of name, or |
| 141 | 141 | // an indexed array name => alias |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function where(): Where |
| 407 | 407 | { |
| 408 | - if (!isset($this->where)){ |
|
| 408 | + if (!isset($this->where)) { |
|
| 409 | 409 | $this->where = new Query\Where($this, $this->driver, $this->topQuery); |
| 410 | 410 | } |
| 411 | 411 | return $this->where; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | public function having(): Having |
| 437 | 437 | { |
| 438 | - if (!isset($this->having)){ |
|
| 438 | + if (!isset($this->having)) { |
|
| 439 | 439 | $this->having = new Query\Having($this, $this->driver, $this->topQuery); |
| 440 | 440 | } |
| 441 | 441 | return $this->having; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function limit($value) |
| 524 | 524 | { |
| 525 | - if (! is_null($value)) { |
|
| 525 | + if (!is_null($value)) { |
|
| 526 | 526 | $this->limit = (int) $value; |
| 527 | 527 | } |
| 528 | 528 | return $this; |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | public function offset($value) |
| 540 | 540 | { |
| 541 | - if (! is_null($value)) { |
|
| 541 | + if (!is_null($value)) { |
|
| 542 | 542 | $this->offset = (int) $value; |
| 543 | 543 | } |
| 544 | 544 | return $this; |