@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string $interface |
| 30 | 30 | * @return Junction |
| 31 | 31 | */ |
| 32 | - public static function fromInterface (DB $db, string $interface) { |
|
| 32 | + public static function fromInterface(DB $db, string $interface) { |
|
| 33 | 33 | try { |
| 34 | 34 | $ref = new ReflectionClass($interface); |
| 35 | 35 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $table |
| 53 | 53 | * @param string[] $classes |
| 54 | 54 | */ |
| 55 | - public function __construct (DB $db, string $table, array $classes) { |
|
| 55 | + public function __construct(DB $db, string $table, array $classes) { |
|
| 56 | 56 | parent::__construct($db, $table, array_keys($classes)); |
| 57 | 57 | $this->classes = $classes; |
| 58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @param array $match Keyed by junction column. |
| 67 | 67 | * @return Select |
| 68 | 68 | */ |
| 69 | - public function getCollection (string $key, array $match = []) { |
|
| 69 | + public function getCollection(string $key, array $match = []) { |
|
| 70 | 70 | $record = $this->db->getRecord($this->classes[$key]); |
| 71 | 71 | $select = $record->select(); |
| 72 | 72 | $select->join($this, $this[$key]->isEqual($record['id'])); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param int[] $ids Keyed by column. |
| 83 | 83 | * @return int Rows affected. |
| 84 | 84 | */ |
| 85 | - public function link (array $ids): int { |
|
| 85 | + public function link(array $ids): int { |
|
| 86 | 86 | $link = $this->cache(__FUNCTION__, function() { |
| 87 | 87 | $columns = implode(',', array_keys($this->columns)); |
| 88 | 88 | $slots = implode(',', SQL::slots(array_keys($this->columns))); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param array $ids Keyed by Column |
| 107 | 107 | * @return int Rows affected |
| 108 | 108 | */ |
| 109 | - public function unlink (array $ids): int { |
|
| 109 | + public function unlink(array $ids): int { |
|
| 110 | 110 | return $this->delete($ids); |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | \ No newline at end of file |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $password |
| 53 | 53 | * @param array $options |
| 54 | 54 | */ |
| 55 | - public function __construct ($dsn, $username = null, $password = null, $options = null) { |
|
| 55 | + public function __construct($dsn, $username = null, $password = null, $options = null) { |
|
| 56 | 56 | parent::__construct($dsn, $username, $password, $options); |
| 57 | 57 | $this->driver = $this->getAttribute(self::ATTR_DRIVER_NAME); |
| 58 | 58 | $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - final public function __toString () { |
|
| 77 | + final public function __toString() { |
|
| 78 | 78 | return $this->driver; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param string $sql |
| 85 | 85 | * @return int |
| 86 | 86 | */ |
| 87 | - public function exec ($sql): int { |
|
| 87 | + public function exec($sql): int { |
|
| 88 | 88 | $this->logger->__invoke($sql); |
| 89 | 89 | return parent::exec($sql); |
| 90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * @return string |
| 94 | 94 | */ |
| 95 | - final public function getDriver (): string { |
|
| 95 | + final public function getDriver(): string { |
|
| 96 | 96 | return $this->driver; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param string $interface |
| 103 | 103 | * @return Junction |
| 104 | 104 | */ |
| 105 | - public function getJunction ($interface) { |
|
| 105 | + public function getJunction($interface) { |
|
| 106 | 106 | if (!isset($this->junctions[$interface])) { |
| 107 | 107 | $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
| 108 | 108 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * @return Closure |
| 114 | 114 | */ |
| 115 | - public function getLogger () { |
|
| 115 | + public function getLogger() { |
|
| 116 | 116 | return $this->logger; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param string|EntityInterface $class |
| 123 | 123 | * @return Record |
| 124 | 124 | */ |
| 125 | - public function getRecord ($class) { |
|
| 125 | + public function getRecord($class) { |
|
| 126 | 126 | if (is_object($class)) { |
| 127 | 127 | $class = get_class($class); |
| 128 | 128 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param mixed $b |
| 150 | 150 | * @return Predicate |
| 151 | 151 | */ |
| 152 | - public function match ($a, $b) { |
|
| 152 | + public function match($a, $b) { |
|
| 153 | 153 | if ($b instanceof Closure) { |
| 154 | 154 | return $b->__invoke($a, $this); |
| 155 | 155 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param string $class Class or interface name. |
| 170 | 170 | * @return bool |
| 171 | 171 | */ |
| 172 | - public function offsetExists ($class): bool { |
|
| 172 | + public function offsetExists($class): bool { |
|
| 173 | 173 | return (bool)$this->offsetGet($class); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $class Class or interface name. |
| 178 | 178 | * @return null|Record|Junction |
| 179 | 179 | */ |
| 180 | - public function offsetGet ($class) { |
|
| 180 | + public function offsetGet($class) { |
|
| 181 | 181 | if (class_exists($class)) { |
| 182 | 182 | return $this->getRecord($class); |
| 183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param string $class Class or interface name. |
| 192 | 192 | * @param Record|Junction $access |
| 193 | 193 | */ |
| 194 | - public function offsetSet ($class, $access) { |
|
| 194 | + public function offsetSet($class, $access) { |
|
| 195 | 195 | if ($access instanceof Record) { |
| 196 | 196 | $this->setRecord($class, $access); |
| 197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | /** |
| 204 | 204 | * @param string $class Class or interface name. |
| 205 | 205 | */ |
| 206 | - public function offsetUnset ($class) { |
|
| 206 | + public function offsetUnset($class) { |
|
| 207 | 207 | unset($this->records[$class]); |
| 208 | 208 | unset($this->junctions[$class]); |
| 209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @param array $options |
| 216 | 216 | * @return Statement |
| 217 | 217 | */ |
| 218 | - public function prepare ($sql, $options = []) { |
|
| 218 | + public function prepare($sql, $options = []) { |
|
| 219 | 219 | $this->logger->__invoke($sql); |
| 220 | 220 | /** @var Statement $statement */ |
| 221 | 221 | $statement = parent::prepare($sql, $options); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @param array $ctorargs Optional. |
| 232 | 232 | * @return Statement |
| 233 | 233 | */ |
| 234 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 234 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 235 | 235 | $this->logger->__invoke($sql); |
| 236 | 236 | /** @var Statement $statement */ |
| 237 | 237 | $statement = parent::query(...func_get_args()); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | * @param int $type Ignored. |
| 250 | 250 | * @return string|ExpressionInterface |
| 251 | 251 | */ |
| 252 | - public function quote ($value, $type = self::PARAM_STR) { |
|
| 252 | + public function quote($value, $type = self::PARAM_STR) { |
|
| 253 | 253 | if ($value instanceof ExpressionInterface) { |
| 254 | 254 | return $value; |
| 255 | 255 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param array $values |
| 270 | 270 | * @return string[] |
| 271 | 271 | */ |
| 272 | - public function quoteArray (array $values) { |
|
| 272 | + public function quoteArray(array $values) { |
|
| 273 | 273 | return array_map([$this, 'quote'], $values); |
| 274 | 274 | } |
| 275 | 275 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @param array $values |
| 280 | 280 | * @return string |
| 281 | 281 | */ |
| 282 | - public function quoteList (array $values): string { |
|
| 282 | + public function quoteList(array $values): string { |
|
| 283 | 283 | return implode(',', $this->quoteArray($values)); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @param EntityInterface $entity |
| 290 | 290 | * @return int ID |
| 291 | 291 | */ |
| 292 | - public function save (EntityInterface $entity): int { |
|
| 292 | + public function save(EntityInterface $entity): int { |
|
| 293 | 293 | return $this->getRecord($entity)->save($entity); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * @param Junction $junction |
| 299 | 299 | * @return $this |
| 300 | 300 | */ |
| 301 | - public function setJunction (string $interface, Junction $junction) { |
|
| 301 | + public function setJunction(string $interface, Junction $junction) { |
|
| 302 | 302 | $this->junctions[$interface] = $junction; |
| 303 | 303 | return $this; |
| 304 | 304 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @param Closure $logger |
| 308 | 308 | * @return $this |
| 309 | 309 | */ |
| 310 | - public function setLogger (Closure $logger) { |
|
| 310 | + public function setLogger(Closure $logger) { |
|
| 311 | 311 | $this->logger = $logger; |
| 312 | 312 | return $this; |
| 313 | 313 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | * @param Record $record |
| 318 | 318 | * @return $this |
| 319 | 319 | */ |
| 320 | - public function setRecord (string $class, Record $record) { |
|
| 320 | + public function setRecord(string $class, Record $record) { |
|
| 321 | 321 | $this->records[$class] = $record; |
| 322 | 322 | return $this; |
| 323 | 323 | } |