@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param string $passwd |
| 54 | 54 | * @param array $options |
| 55 | 55 | */ |
| 56 | - public function __construct ($dsn, $username = null, $passwd = null, $options = null) { |
|
| 56 | + public function __construct($dsn, $username = null, $passwd = null, $options = null) { |
|
| 57 | 57 | parent::__construct($dsn, $username, $passwd, $options); |
| 58 | 58 | $this->driver = $this->getAttribute(self::ATTR_DRIVER_NAME); |
| 59 | 59 | $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param string $sql |
| 76 | 76 | * @return int |
| 77 | 77 | */ |
| 78 | - public function exec ($sql): int { |
|
| 78 | + public function exec($sql): int { |
|
| 79 | 79 | $this->logger->__invoke($sql); |
| 80 | 80 | return parent::exec($sql); |
| 81 | 81 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - final public function getDriver (): string { |
|
| 86 | + final public function getDriver(): string { |
|
| 87 | 87 | return $this->driver; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $interface |
| 94 | 94 | * @return Junction |
| 95 | 95 | */ |
| 96 | - public function getJunction ($interface) { |
|
| 96 | + public function getJunction($interface) { |
|
| 97 | 97 | if (!isset($this->junctions[$interface])) { |
| 98 | 98 | $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
| 99 | 99 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @return Closure |
| 105 | 105 | */ |
| 106 | - public function getLogger () { |
|
| 106 | + public function getLogger() { |
|
| 107 | 107 | return $this->logger; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param string|EntityInterface $class |
| 114 | 114 | * @return Record |
| 115 | 115 | */ |
| 116 | - public function getRecord ($class) { |
|
| 116 | + public function getRecord($class) { |
|
| 117 | 117 | $name = $class; |
| 118 | 118 | if (is_object($name)) { |
| 119 | 119 | $name = get_class($name); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param mixed $b |
| 139 | 139 | * @return string |
| 140 | 140 | */ |
| 141 | - public function match ($a, $b) { |
|
| 141 | + public function match($a, $b) { |
|
| 142 | 142 | if ($b instanceof Closure) { |
| 143 | 143 | if (!$a instanceof Column) { |
| 144 | 144 | $a = new Column($this, $a); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param array $match |
| 165 | 165 | * @return string[] |
| 166 | 166 | */ |
| 167 | - public function matchArray (array $match) { |
|
| 167 | + public function matchArray(array $match) { |
|
| 168 | 168 | return array_map([$this, 'match'], array_keys($match), $match); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param string $class Class or interface name. |
| 173 | 173 | * @return bool |
| 174 | 174 | */ |
| 175 | - public function offsetExists ($class): bool { |
|
| 175 | + public function offsetExists($class): bool { |
|
| 176 | 176 | return (bool)$this->offsetGet($class); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param string $class Class or interface name. |
| 181 | 181 | * @return null|Record|Junction |
| 182 | 182 | */ |
| 183 | - public function offsetGet ($class) { |
|
| 183 | + public function offsetGet($class) { |
|
| 184 | 184 | if (class_exists($class)) { |
| 185 | 185 | return $this->getRecord($class); |
| 186 | 186 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param string $class Class or interface name. |
| 195 | 195 | * @param Record|Junction $access |
| 196 | 196 | */ |
| 197 | - public function offsetSet ($class, $access) { |
|
| 197 | + public function offsetSet($class, $access) { |
|
| 198 | 198 | if ($access instanceof Record) { |
| 199 | 199 | $this->setRecord($class, $access); |
| 200 | 200 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * @param string $class Class or interface name. |
| 209 | 209 | */ |
| 210 | - public function offsetUnset ($class) { |
|
| 210 | + public function offsetUnset($class) { |
|
| 211 | 211 | unset($this->records[$class]); |
| 212 | 212 | unset($this->junctions[$class]); |
| 213 | 213 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param array $options |
| 220 | 220 | * @return Statement |
| 221 | 221 | */ |
| 222 | - public function prepare ($sql, $options = []) { |
|
| 222 | + public function prepare($sql, $options = []) { |
|
| 223 | 223 | $this->logger->__invoke($sql); |
| 224 | 224 | /** @var Statement $statement */ |
| 225 | 225 | $statement = parent::prepare($sql, $options); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @param array $ctorargs |
| 236 | 236 | * @return Statement |
| 237 | 237 | */ |
| 238 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 238 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 239 | 239 | $this->logger->__invoke($sql); |
| 240 | 240 | /** @var Statement $statement */ |
| 241 | 241 | $statement = parent::query(...func_get_args()); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @param int $type Ignored. |
| 255 | 255 | * @return string |
| 256 | 256 | */ |
| 257 | - public function quote ($value, $type = null) { |
|
| 257 | + public function quote($value, $type = null) { |
|
| 258 | 258 | if ($value instanceof ExpressionInterface) { |
| 259 | 259 | return (string)$value; |
| 260 | 260 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @param array $values |
| 275 | 275 | * @return string[] |
| 276 | 276 | */ |
| 277 | - public function quoteArray (array $values): array { |
|
| 277 | + public function quoteArray(array $values): array { |
|
| 278 | 278 | return array_map([$this, 'quote'], $values); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @param mixed $value |
| 285 | 285 | * @return string|string[] |
| 286 | 286 | */ |
| 287 | - public function quoteMixed ($value) { |
|
| 287 | + public function quoteMixed($value) { |
|
| 288 | 288 | if (is_array($value)) { |
| 289 | 289 | return $this->quoteArray($value); |
| 290 | 290 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param EntityInterface $entity |
| 298 | 298 | * @return int ID |
| 299 | 299 | */ |
| 300 | - public function save (EntityInterface $entity): int { |
|
| 300 | + public function save(EntityInterface $entity): int { |
|
| 301 | 301 | return $this->getRecord($entity)->save($entity); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * @param Junction $junction |
| 307 | 307 | * @return $this |
| 308 | 308 | */ |
| 309 | - public function setJunction (string $interface, Junction $junction) { |
|
| 309 | + public function setJunction(string $interface, Junction $junction) { |
|
| 310 | 310 | $this->junctions[$interface] = $junction; |
| 311 | 311 | return $this; |
| 312 | 312 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @param Closure $logger |
| 316 | 316 | * @return $this |
| 317 | 317 | */ |
| 318 | - public function setLogger (Closure $logger) { |
|
| 318 | + public function setLogger(Closure $logger) { |
|
| 319 | 319 | $this->logger = $logger; |
| 320 | 320 | return $this; |
| 321 | 321 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @param Record $record |
| 326 | 326 | * @return $this |
| 327 | 327 | */ |
| 328 | - public function setRecord (string $class, Record $record) { |
|
| 328 | + public function setRecord(string $class, Record $record) { |
|
| 329 | 329 | $this->records[$class] = $record; |
| 330 | 330 | return $this; |
| 331 | 331 | } |
@@ -197,8 +197,7 @@ |
||
| 197 | 197 | public function offsetSet ($class, $access) { |
| 198 | 198 | if ($access instanceof Record) { |
| 199 | 199 | $this->setRecord($class, $access); |
| 200 | - } |
|
| 201 | - elseif ($access instanceof Junction) { |
|
| 200 | + } elseif ($access instanceof Junction) { |
|
| 202 | 201 | $this->setJunction($class, $access); |
| 203 | 202 | } |
| 204 | 203 | throw new InvalidArgumentException('Expected a Record or Junction.'); |