@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param string $password |
| 61 | 61 | * @param array $options |
| 62 | 62 | */ |
| 63 | - public function __construct ($dsn, $username = null, $password = null, array $options = []) { |
|
| 63 | + public function __construct($dsn, $username = null, $password = null, array $options = []) { |
|
| 64 | 64 | $options += [ |
| 65 | 65 | self::ATTR_STATEMENT_CLASS => [Statement::class, [$this]] |
| 66 | 66 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - final public function __toString () { |
|
| 86 | + final public function __toString() { |
|
| 87 | 87 | return $this->driver; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $sql |
| 94 | 94 | * @return int |
| 95 | 95 | */ |
| 96 | - public function exec ($sql): int { |
|
| 96 | + public function exec($sql): int { |
|
| 97 | 97 | $this->logger->__invoke($sql); |
| 98 | 98 | return parent::exec($sql); |
| 99 | 99 | } |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | * @param mixed ...$args |
| 110 | 110 | * @return mixed |
| 111 | 111 | */ |
| 112 | - public function factory (string $class, ...$args) { |
|
| 112 | + public function factory(string $class, ...$args) { |
|
| 113 | 113 | return new $class($this, ...$args); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * @return string |
| 118 | 118 | */ |
| 119 | - final public function getDriver (): string { |
|
| 119 | + final public function getDriver(): string { |
|
| 120 | 120 | return $this->driver; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | * @param string $interface |
| 127 | 127 | * @return Junction |
| 128 | 128 | */ |
| 129 | - public function getJunction ($interface) { |
|
| 129 | + public function getJunction($interface) { |
|
| 130 | 130 | return $this->junctions[$interface] ??= Junction::fromInterface($this, $interface); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @return Closure |
| 135 | 135 | */ |
| 136 | - public function getLogger () { |
|
| 136 | + public function getLogger() { |
|
| 137 | 137 | return $this->logger; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string|EntityInterface $class |
| 144 | 144 | * @return Record |
| 145 | 145 | */ |
| 146 | - public function getRecord ($class) { |
|
| 146 | + public function getRecord($class) { |
|
| 147 | 147 | if (is_object($class)) { |
| 148 | 148 | $class = get_class($class); |
| 149 | 149 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param string $name |
| 155 | 155 | * @return null|Table |
| 156 | 156 | */ |
| 157 | - public function getTable (string $name) { |
|
| 157 | + public function getTable(string $name) { |
|
| 158 | 158 | if (!isset($this->tables[$name])) { |
| 159 | 159 | if ($this->isSQLite()) { |
| 160 | 160 | $info = $this->query("PRAGMA table_info({$this->quote($name)})")->fetchAll(); |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | /** |
| 177 | 177 | * @return bool |
| 178 | 178 | */ |
| 179 | - final public function isMySQL (): bool { |
|
| 179 | + final public function isMySQL(): bool { |
|
| 180 | 180 | return $this->driver === 'mysql'; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @return bool |
| 185 | 185 | */ |
| 186 | - final public function isPostgreSQL (): bool { |
|
| 186 | + final public function isPostgreSQL(): bool { |
|
| 187 | 187 | return $this->driver === 'pgsql'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * @return bool |
| 192 | 192 | */ |
| 193 | - final public function isSQLite (): bool { |
|
| 193 | + final public function isSQLite(): bool { |
|
| 194 | 194 | return $this->driver === 'sqlite'; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param mixed $b |
| 212 | 212 | * @return Predicate |
| 213 | 213 | */ |
| 214 | - public function match ($a, $b) { |
|
| 214 | + public function match($a, $b) { |
|
| 215 | 215 | if ($b instanceof Closure) { |
| 216 | 216 | return $b->__invoke($a, $this); |
| 217 | 217 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param string $table |
| 234 | 234 | * @return bool |
| 235 | 235 | */ |
| 236 | - final public function offsetExists ($table): bool { |
|
| 236 | + final public function offsetExists($table): bool { |
|
| 237 | 237 | return (bool)$this->getTable($table); |
| 238 | 238 | } |
| 239 | 239 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param string $table |
| 244 | 244 | * @return null|Table |
| 245 | 245 | */ |
| 246 | - final public function offsetGet ($table) { |
|
| 246 | + final public function offsetGet($table) { |
|
| 247 | 247 | return $this->getTable($table); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param $value |
| 253 | 253 | * @throws LogicException |
| 254 | 254 | */ |
| 255 | - final public function offsetSet ($offset, $value) { |
|
| 255 | + final public function offsetSet($offset, $value) { |
|
| 256 | 256 | throw new LogicException('Raw table access is immutable.'); |
| 257 | 257 | } |
| 258 | 258 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @param $offset |
| 261 | 261 | * @throws LogicException |
| 262 | 262 | */ |
| 263 | - final public function offsetUnset ($offset) { |
|
| 263 | + final public function offsetUnset($offset) { |
|
| 264 | 264 | throw new LogicException('Raw table access is immutable.'); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param array $options |
| 272 | 272 | * @return Statement |
| 273 | 273 | */ |
| 274 | - public function prepare ($sql, $options = []) { |
|
| 274 | + public function prepare($sql, $options = []) { |
|
| 275 | 275 | $this->logger->__invoke($sql); |
| 276 | 276 | /** @var Statement $statement */ |
| 277 | 277 | $statement = parent::prepare($sql, $options); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * @param array $ctorargs Optional. |
| 288 | 288 | * @return Statement |
| 289 | 289 | */ |
| 290 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 290 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 291 | 291 | $this->logger->__invoke($sql); |
| 292 | 292 | /** @var Statement $statement */ |
| 293 | 293 | $statement = parent::query(...func_get_args()); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @param int $type Ignored. |
| 306 | 306 | * @return string|ExpressionInterface |
| 307 | 307 | */ |
| 308 | - public function quote ($value, $type = self::PARAM_STR) { |
|
| 308 | + public function quote($value, $type = self::PARAM_STR) { |
|
| 309 | 309 | if ($value instanceof ExpressionInterface) { |
| 310 | 310 | return $value; |
| 311 | 311 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @param array $values |
| 326 | 326 | * @return string[] |
| 327 | 327 | */ |
| 328 | - public function quoteArray (array $values) { |
|
| 328 | + public function quoteArray(array $values) { |
|
| 329 | 329 | return array_map([$this, 'quote'], $values); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | * @param array $values |
| 336 | 336 | * @return string |
| 337 | 337 | */ |
| 338 | - public function quoteList (array $values): string { |
|
| 338 | + public function quoteList(array $values): string { |
|
| 339 | 339 | return implode(',', $this->quoteArray($values)); |
| 340 | 340 | } |
| 341 | 341 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | * @param EntityInterface $entity |
| 346 | 346 | * @return int ID |
| 347 | 347 | */ |
| 348 | - public function save (EntityInterface $entity): int { |
|
| 348 | + public function save(EntityInterface $entity): int { |
|
| 349 | 349 | return $this->getRecord($entity)->save($entity); |
| 350 | 350 | } |
| 351 | 351 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | * @param Junction $junction |
| 355 | 355 | * @return $this |
| 356 | 356 | */ |
| 357 | - public function setJunction (string $interface, Junction $junction) { |
|
| 357 | + public function setJunction(string $interface, Junction $junction) { |
|
| 358 | 358 | $this->junctions[$interface] = $junction; |
| 359 | 359 | return $this; |
| 360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @param Closure $logger |
| 364 | 364 | * @return $this |
| 365 | 365 | */ |
| 366 | - public function setLogger (Closure $logger) { |
|
| 366 | + public function setLogger(Closure $logger) { |
|
| 367 | 367 | $this->logger = $logger; |
| 368 | 368 | return $this; |
| 369 | 369 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * @param Record $record |
| 374 | 374 | * @return $this |
| 375 | 375 | */ |
| 376 | - public function setRecord (string $class, Record $record) { |
|
| 376 | + public function setRecord(string $class, Record $record) { |
|
| 377 | 377 | $this->records[$class] = $record; |
| 378 | 378 | return $this; |
| 379 | 379 | } |