@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return Numeric |
| 21 | 21 | */ |
| 22 | - public function abs () { |
|
| 22 | + public function abs() { |
|
| 23 | 23 | return $this->db->factory(Numeric::class, $this->db, "ABS({$this})"); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param number|ValueInterface $arg |
| 30 | 30 | * @return Numeric |
| 31 | 31 | */ |
| 32 | - public function add ($arg) { |
|
| 32 | + public function add($arg) { |
|
| 33 | 33 | return $this->db->factory(Numeric::class, $this->db, "({$this} + {$arg})"); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return Numeric |
| 40 | 40 | */ |
| 41 | - public function ceil () { |
|
| 41 | + public function ceil() { |
|
| 42 | 42 | return $this->db->factory(Numeric::class, $this->db, "CEIL({$this})"); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param number|ValueInterface $arg |
| 49 | 49 | * @return Numeric |
| 50 | 50 | */ |
| 51 | - public function divide ($arg) { |
|
| 51 | + public function divide($arg) { |
|
| 52 | 52 | return $this->db->factory(Numeric::class, $this->db, "({$this} / {$arg})"); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return Numeric |
| 59 | 59 | */ |
| 60 | - public function floor () { |
|
| 60 | + public function floor() { |
|
| 61 | 61 | return $this->db->factory(Numeric::class, $this->db, "FLOOR({$this})"); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return Predicate |
| 68 | 68 | */ |
| 69 | - public function isEven () { |
|
| 69 | + public function isEven() { |
|
| 70 | 70 | return $this->db->factory(Predicate::class, "({$this} % 2) = 0"); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return Predicate |
| 77 | 77 | */ |
| 78 | - public function isNegative () { |
|
| 78 | + public function isNegative() { |
|
| 79 | 79 | return $this->db->factory(Predicate::class, "{$this} < 0"); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return Predicate |
| 86 | 86 | */ |
| 87 | - public function isOdd () { |
|
| 87 | + public function isOdd() { |
|
| 88 | 88 | return $this->db->factory(Predicate::class, "({$this} % 2) <> 0"); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return Predicate |
| 95 | 95 | */ |
| 96 | - public function isPositive () { |
|
| 96 | + public function isPositive() { |
|
| 97 | 97 | return $this->db->factory(Predicate::class, "{$this} > 0"); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param number|ValueInterface $arg |
| 104 | 104 | * @return Numeric |
| 105 | 105 | */ |
| 106 | - public function modulo ($arg) { |
|
| 106 | + public function modulo($arg) { |
|
| 107 | 107 | return $this->db->factory(Numeric::class, $this->db, "({$this} % {$arg})"); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param number|ValueInterface $arg |
| 114 | 114 | * @return Numeric |
| 115 | 115 | */ |
| 116 | - public function multiply ($arg) { |
|
| 116 | + public function multiply($arg) { |
|
| 117 | 117 | return $this->db->factory(Numeric::class, $this->db, "({$this} * {$arg})"); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param number|ValueInterface $exponent |
| 124 | 124 | * @return Numeric |
| 125 | 125 | */ |
| 126 | - public function pow ($exponent) { |
|
| 126 | + public function pow($exponent) { |
|
| 127 | 127 | return $this->db->factory(Numeric::class, $this->db, "POW({$this},{$exponent})"); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @param int $decimals |
| 134 | 134 | * @return Numeric |
| 135 | 135 | */ |
| 136 | - public function round (int $decimals = 0) { |
|
| 136 | + public function round(int $decimals = 0) { |
|
| 137 | 137 | return $this->db->factory(Numeric::class, $this->db, "ROUND({$this},{$decimals})"); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param number|ValueInterface $arg |
| 144 | 144 | * @return Numeric |
| 145 | 145 | */ |
| 146 | - public function subtract ($arg) { |
|
| 146 | + public function subtract($arg) { |
|
| 147 | 147 | return $this->db->factory(Numeric::class, $this->db, "({$this} - {$arg})"); |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param array $values |
| 29 | 29 | * @return Value |
| 30 | 30 | */ |
| 31 | - public function coalesce (array $values) { |
|
| 31 | + public function coalesce(array $values) { |
|
| 32 | 32 | array_unshift($values, $this); |
| 33 | 33 | $values = $this->db->quoteList($values); |
| 34 | 34 | return $this->db->factory(Value::class, $this->db, "COALESCE({$values})"); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param array $values `[when => then]` |
| 41 | 41 | * @return Choice |
| 42 | 42 | */ |
| 43 | - public function getChoice (array $values) { |
|
| 43 | + public function getChoice(array $values) { |
|
| 44 | 44 | return $this->db->factory(Choice::class, $this->db, "{$this}", $values); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param null|bool|number|string|Select $arg |
| 54 | 54 | * @return Predicate |
| 55 | 55 | */ |
| 56 | - public function is ($arg): Predicate { |
|
| 56 | + public function is($arg): Predicate { |
|
| 57 | 57 | $driver = $this->db->getDriver(); |
| 58 | 58 | if ($arg instanceof Select) { |
| 59 | 59 | switch ($driver) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @param number $max |
| 83 | 83 | * @return Predicate |
| 84 | 84 | */ |
| 85 | - public function isBetween ($min, $max) { |
|
| 85 | + public function isBetween($min, $max) { |
|
| 86 | 86 | $min = $this->db->quote($min); |
| 87 | 87 | $max = $this->db->quote($max); |
| 88 | 88 | return $this->db->factory(Predicate::class, "{$this} BETWEEN {$min} AND {$max}"); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @param bool|number|string|array|Select $arg |
| 95 | 95 | * @return Predicate |
| 96 | 96 | */ |
| 97 | - public function isEqual ($arg) { |
|
| 97 | + public function isEqual($arg) { |
|
| 98 | 98 | return $this->db->match($this, $arg); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param string $multi `ALL|ANY` |
| 111 | 111 | * @return Predicate |
| 112 | 112 | */ |
| 113 | - public function isGreater ($arg, string $multi = 'ALL') { |
|
| 113 | + public function isGreater($arg, string $multi = 'ALL') { |
|
| 114 | 114 | if ($arg instanceof Select) { |
| 115 | 115 | switch ($this->db) { |
| 116 | 116 | case 'sqlite': |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @param string $multi `ALL|ANY` |
| 142 | 142 | * @return Predicate |
| 143 | 143 | */ |
| 144 | - public function isGreaterOrEqual ($arg, string $multi = 'ALL') { |
|
| 144 | + public function isGreaterOrEqual($arg, string $multi = 'ALL') { |
|
| 145 | 145 | if ($arg instanceof Select) { |
| 146 | 146 | switch ($this->db) { |
| 147 | 147 | case 'sqlite': |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param string $multi `ALL|ANY` |
| 173 | 173 | * @return Predicate |
| 174 | 174 | */ |
| 175 | - public function isLess ($arg, string $multi = 'ALL') { |
|
| 175 | + public function isLess($arg, string $multi = 'ALL') { |
|
| 176 | 176 | if ($arg instanceof Select) { |
| 177 | 177 | switch ($this->db) { |
| 178 | 178 | case 'sqlite': |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param string $multi `ALL|ANY` |
| 204 | 204 | * @return Predicate |
| 205 | 205 | */ |
| 206 | - public function isLessOrEqual ($arg, string $multi = 'ALL') { |
|
| 206 | + public function isLessOrEqual($arg, string $multi = 'ALL') { |
|
| 207 | 207 | if ($arg instanceof Select) { |
| 208 | 208 | switch ($this->db) { |
| 209 | 209 | case 'sqlite': |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @param string $pattern |
| 229 | 229 | * @return Predicate |
| 230 | 230 | */ |
| 231 | - public function isLike (string $pattern) { |
|
| 231 | + public function isLike(string $pattern) { |
|
| 232 | 232 | $pattern = $this->db->quote($pattern); |
| 233 | 233 | return $this->db->factory(Predicate::class, "{$this} LIKE {$pattern}"); |
| 234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * @param null|bool|number|string|Select $arg |
| 240 | 240 | * @return Predicate |
| 241 | 241 | */ |
| 242 | - public function isNot ($arg) { |
|
| 242 | + public function isNot($arg) { |
|
| 243 | 243 | return $this->is($arg)->invert(); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @param number $max |
| 251 | 251 | * @return Predicate |
| 252 | 252 | */ |
| 253 | - public function isNotBetween ($min, $max) { |
|
| 253 | + public function isNotBetween($min, $max) { |
|
| 254 | 254 | $min = $this->db->quote($min); |
| 255 | 255 | $max = $this->db->quote($max); |
| 256 | 256 | return $this->db->factory(Predicate::class, "{$this} NOT BETWEEN {$min} AND {$max}"); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @param bool|number|string|array|Select $arg |
| 263 | 263 | * @return Predicate |
| 264 | 264 | */ |
| 265 | - public function isNotEqual ($arg) { |
|
| 265 | + public function isNotEqual($arg) { |
|
| 266 | 266 | if ($arg instanceof Select) { |
| 267 | 267 | return $this->db->factory(Predicate::class, "{$this} NOT IN ({$arg->toSql()})"); |
| 268 | 268 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @param string $pattern |
| 279 | 279 | * @return Predicate |
| 280 | 280 | */ |
| 281 | - public function isNotLike (string $pattern) { |
|
| 281 | + public function isNotLike(string $pattern) { |
|
| 282 | 282 | $pattern = $this->db->quote($pattern); |
| 283 | 283 | return $this->db->factory(Predicate::class, "{$this} NOT LIKE {$pattern}"); |
| 284 | 284 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * @param string $pattern |
| 290 | 290 | * @return Predicate |
| 291 | 291 | */ |
| 292 | - public function isNotRegExp (string $pattern) { |
|
| 292 | + public function isNotRegExp(string $pattern) { |
|
| 293 | 293 | $pattern = $this->db->quote($pattern); |
| 294 | 294 | return $this->db->factory(Predicate::class, "{$this} NOT REGEXP {$pattern}"); |
| 295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param string $pattern |
| 301 | 301 | * @return Predicate |
| 302 | 302 | */ |
| 303 | - public function isRegExp (string $pattern) { |
|
| 303 | + public function isRegExp(string $pattern) { |
|
| 304 | 304 | $pattern = $this->db->quote($pattern); |
| 305 | 305 | return $this->db->factory(Predicate::class, "{$this} REGEXP {$pattern}"); |
| 306 | 306 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @return Text |
| 16 | 16 | */ |
| 17 | - public function toText () { |
|
| 17 | + public function toText() { |
|
| 18 | 18 | if ($this->db == 'sqlite') { |
| 19 | 19 | return $this->db->factory(Text::class, $this->db, "CAST({$this} AS TEXT)"); |
| 20 | 20 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @param string|Select $table |
| 113 | 113 | * @param string[] $columns |
| 114 | 114 | */ |
| 115 | - public function __construct (DB $db, $table, array $columns) { |
|
| 115 | + public function __construct(DB $db, $table, array $columns) { |
|
| 116 | 116 | parent::__construct($db); |
| 117 | 117 | if ($table instanceof Select) { |
| 118 | 118 | $this->table = $table->toSubquery(); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param array $args |
| 133 | 133 | * @return Statement |
| 134 | 134 | */ |
| 135 | - public function __invoke (array $args = []) { |
|
| 135 | + public function __invoke(array $args = []) { |
|
| 136 | 136 | return $this->execute($args); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @return string |
| 143 | 143 | */ |
| 144 | - final public function __toString () { |
|
| 144 | + final public function __toString() { |
|
| 145 | 145 | return $this->alias; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @param array $args Execution arguments. |
| 152 | 152 | * @return int |
| 153 | 153 | */ |
| 154 | - public function count (array $args = []): int { |
|
| 154 | + public function count(array $args = []): int { |
|
| 155 | 155 | $clone = clone $this; |
| 156 | 156 | $clone->_columns = 'COUNT(*)'; |
| 157 | 157 | $clone->_order = ''; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param array $args |
| 165 | 165 | * @return Statement |
| 166 | 166 | */ |
| 167 | - public function execute (array $args = []) { |
|
| 167 | + public function execute(array $args = []) { |
|
| 168 | 168 | if (empty($args)) { |
| 169 | 169 | return $this->db->query($this->toSql()); |
| 170 | 170 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param array $args Execution arguments. |
| 180 | 180 | * @return array |
| 181 | 181 | */ |
| 182 | - public function getAll (array $args = []): array { |
|
| 182 | + public function getAll(array $args = []): array { |
|
| 183 | 183 | return iterator_to_array($this->fetcher->__invoke($this->execute($args))); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param array $args Execution arguments. |
| 193 | 193 | * @return Generator |
| 194 | 194 | */ |
| 195 | - public function getEach (array $args = []) { |
|
| 195 | + public function getEach(array $args = []) { |
|
| 196 | 196 | yield from $this->fetcher->__invoke($this->execute($args)); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param array $args |
| 205 | 205 | * @return mixed |
| 206 | 206 | */ |
| 207 | - public function getFirst (array $args = []) { |
|
| 207 | + public function getFirst(array $args = []) { |
|
| 208 | 208 | return $this->getEach($args)->current(); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @return Generator |
| 217 | 217 | */ |
| 218 | - public function getIterator () { |
|
| 218 | + public function getIterator() { |
|
| 219 | 219 | yield from $this->getEach(); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param string $column |
| 226 | 226 | * @return $this |
| 227 | 227 | */ |
| 228 | - public function group (string $column) { |
|
| 228 | + public function group(string $column) { |
|
| 229 | 229 | if (!strlen($this->_group)) { |
| 230 | 230 | $this->_group = " GROUP BY {$column}"; |
| 231 | 231 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @param string $condition |
| 242 | 242 | * @return $this |
| 243 | 243 | */ |
| 244 | - public function having (string $condition) { |
|
| 244 | + public function having(string $condition) { |
|
| 245 | 245 | if (!strlen($this->_having)) { |
| 246 | 246 | $this->_having = " HAVING {$condition}"; |
| 247 | 247 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @param bool $all |
| 259 | 259 | * @return $this |
| 260 | 260 | */ |
| 261 | - public function intersect (Select $select, $all = false) { |
|
| 261 | + public function intersect(Select $select, $all = false) { |
|
| 262 | 262 | $select = clone $select; |
| 263 | 263 | $select->_order = ''; |
| 264 | 264 | $select->_limit = ''; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return Predicate |
| 278 | 278 | */ |
| 279 | - public function isEmpty () { |
|
| 279 | + public function isEmpty() { |
|
| 280 | 280 | return $this->db->factory(Predicate::class, "NOT EXISTS ({$this->toSql()})"); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * |
| 286 | 286 | * @return Predicate |
| 287 | 287 | */ |
| 288 | - public function isNotEmpty () { |
|
| 288 | + public function isNotEmpty() { |
|
| 289 | 289 | return $this->db->factory(Predicate::class, "EXISTS ({$this->toSql()})"); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param string $type |
| 298 | 298 | * @return $this |
| 299 | 299 | */ |
| 300 | - public function join ($table, string $condition, string $type = 'INNER') { |
|
| 300 | + public function join($table, string $condition, string $type = 'INNER') { |
|
| 301 | 301 | if ($table instanceof Select) { |
| 302 | 302 | $table = $table->toSubquery(); |
| 303 | 303 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @param int $offset |
| 313 | 313 | * @return $this |
| 314 | 314 | */ |
| 315 | - public function limit (int $limit, int $offset = 0) { |
|
| 315 | + public function limit(int $limit, int $offset = 0) { |
|
| 316 | 316 | if ($limit == 0) { |
| 317 | 317 | $this->_limit = ''; |
| 318 | 318 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * @param mixed $offset Ordinal or reference name. |
| 332 | 332 | * @return bool |
| 333 | 333 | */ |
| 334 | - public function offsetExists ($offset): bool { |
|
| 334 | + public function offsetExists($offset): bool { |
|
| 335 | 335 | return isset($this->refs[$offset]); |
| 336 | 336 | } |
| 337 | 337 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * @param mixed $offset Ordinal or reference name. |
| 342 | 342 | * @return Column |
| 343 | 343 | */ |
| 344 | - public function offsetGet ($offset) { |
|
| 344 | + public function offsetGet($offset) { |
|
| 345 | 345 | return $this->refs[$offset]; |
| 346 | 346 | } |
| 347 | 347 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @param string $order |
| 352 | 352 | * @return $this |
| 353 | 353 | */ |
| 354 | - public function order (string $order) { |
|
| 354 | + public function order(string $order) { |
|
| 355 | 355 | if (strlen($order)) { |
| 356 | 356 | $order = " ORDER BY {$order}"; |
| 357 | 357 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | /** |
| 363 | 363 | * @return Statement |
| 364 | 364 | */ |
| 365 | - public function prepare () { |
|
| 365 | + public function prepare() { |
|
| 366 | 366 | return $this->db->prepare($this->toSql()); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | * @param string $alias |
| 371 | 371 | * @return $this |
| 372 | 372 | */ |
| 373 | - public function setAlias (string $alias) { |
|
| 373 | + public function setAlias(string $alias) { |
|
| 374 | 374 | $this->alias = $alias; |
| 375 | 375 | foreach ($this->refs as $k => $column) { |
| 376 | 376 | $this->refs[$k] = $column->setQualifier($alias); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @param string[] $columns |
| 385 | 385 | * @return $this |
| 386 | 386 | */ |
| 387 | - public function setColumns (array $columns) { |
|
| 387 | + public function setColumns(array $columns) { |
|
| 388 | 388 | $this->refs = []; |
| 389 | 389 | $_columns = []; |
| 390 | 390 | $i = 0; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * @param Closure $fetcher |
| 415 | 415 | * @return $this |
| 416 | 416 | */ |
| 417 | - public function setFetcher (Closure $fetcher) { |
|
| 417 | + public function setFetcher(Closure $fetcher) { |
|
| 418 | 418 | $this->fetcher = $fetcher; |
| 419 | 419 | return $this; |
| 420 | 420 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * |
| 425 | 425 | * @return string |
| 426 | 426 | */ |
| 427 | - public function toSql (): string { |
|
| 427 | + public function toSql(): string { |
|
| 428 | 428 | $sql = "SELECT {$this->_columns} FROM {$this->table}"; |
| 429 | 429 | $sql .= $this->_join; |
| 430 | 430 | $sql .= $this->_where; |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * |
| 442 | 442 | * @return string |
| 443 | 443 | */ |
| 444 | - public function toSubquery (): string { |
|
| 444 | + public function toSubquery(): string { |
|
| 445 | 445 | return "({$this->toSql()}) AS {$this->alias}"; |
| 446 | 446 | } |
| 447 | 447 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * @param bool $all |
| 453 | 453 | * @return $this |
| 454 | 454 | */ |
| 455 | - public function union (Select $select, $all = false) { |
|
| 455 | + public function union(Select $select, $all = false) { |
|
| 456 | 456 | $select = clone $select; |
| 457 | 457 | $select->_order = ''; |
| 458 | 458 | $select->_limit = ''; |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | * @param string $condition |
| 472 | 472 | * @return $this |
| 473 | 473 | */ |
| 474 | - public function where (string $condition) { |
|
| 474 | + public function where(string $condition) { |
|
| 475 | 475 | if (!strlen($this->_where)) { |
| 476 | 476 | $this->_where = " WHERE {$condition}"; |
| 477 | 477 | } |
@@ -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 | } |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | * @param mixed ...$args |
| 99 | 99 | * @return mixed |
| 100 | 100 | */ |
| 101 | - public function factory (string $class, ...$args) { |
|
| 101 | + public function factory(string $class, ...$args) { |
|
| 102 | 102 | return new $class(...$args); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * @return string |
| 107 | 107 | */ |
| 108 | - final public function getDriver (): string { |
|
| 108 | + final public function getDriver(): string { |
|
| 109 | 109 | return $this->driver; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string $interface |
| 116 | 116 | * @return Junction |
| 117 | 117 | */ |
| 118 | - public function getJunction ($interface) { |
|
| 118 | + public function getJunction($interface) { |
|
| 119 | 119 | if (!isset($this->junctions[$interface])) { |
| 120 | 120 | $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
| 121 | 121 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | /** |
| 126 | 126 | * @return Closure |
| 127 | 127 | */ |
| 128 | - public function getLogger () { |
|
| 128 | + public function getLogger() { |
|
| 129 | 129 | return $this->logger; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param string|EntityInterface $class |
| 136 | 136 | * @return Record |
| 137 | 137 | */ |
| 138 | - public function getRecord ($class) { |
|
| 138 | + public function getRecord($class) { |
|
| 139 | 139 | if (is_object($class)) { |
| 140 | 140 | $class = get_class($class); |
| 141 | 141 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @param mixed $b |
| 163 | 163 | * @return Predicate |
| 164 | 164 | */ |
| 165 | - public function match ($a, $b) { |
|
| 165 | + public function match($a, $b) { |
|
| 166 | 166 | if ($b instanceof Closure) { |
| 167 | 167 | return $b->__invoke($a, $this); |
| 168 | 168 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param string $class Class or interface name. |
| 183 | 183 | * @return bool |
| 184 | 184 | */ |
| 185 | - public function offsetExists ($class): bool { |
|
| 185 | + public function offsetExists($class): bool { |
|
| 186 | 186 | return (bool)$this->offsetGet($class); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @param string $class Class or interface name. |
| 191 | 191 | * @return null|Record|Junction |
| 192 | 192 | */ |
| 193 | - public function offsetGet ($class) { |
|
| 193 | + public function offsetGet($class) { |
|
| 194 | 194 | if (class_exists($class)) { |
| 195 | 195 | return $this->getRecord($class); |
| 196 | 196 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param string $class Class or interface name. |
| 205 | 205 | * @param Record|Junction $access |
| 206 | 206 | */ |
| 207 | - public function offsetSet ($class, $access) { |
|
| 207 | + public function offsetSet($class, $access) { |
|
| 208 | 208 | if ($access instanceof Record) { |
| 209 | 209 | $this->setRecord($class, $access); |
| 210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | /** |
| 217 | 217 | * @param string $class Class or interface name. |
| 218 | 218 | */ |
| 219 | - public function offsetUnset ($class) { |
|
| 219 | + public function offsetUnset($class) { |
|
| 220 | 220 | unset($this->records[$class]); |
| 221 | 221 | unset($this->junctions[$class]); |
| 222 | 222 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @param array $options |
| 229 | 229 | * @return Statement |
| 230 | 230 | */ |
| 231 | - public function prepare ($sql, $options = []) { |
|
| 231 | + public function prepare($sql, $options = []) { |
|
| 232 | 232 | $this->logger->__invoke($sql); |
| 233 | 233 | /** @var Statement $statement */ |
| 234 | 234 | $statement = parent::prepare($sql, $options); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param array $ctorargs Optional. |
| 245 | 245 | * @return Statement |
| 246 | 246 | */ |
| 247 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 247 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
| 248 | 248 | $this->logger->__invoke($sql); |
| 249 | 249 | /** @var Statement $statement */ |
| 250 | 250 | $statement = parent::query(...func_get_args()); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @param int $type Ignored. |
| 263 | 263 | * @return string|ExpressionInterface |
| 264 | 264 | */ |
| 265 | - public function quote ($value, $type = self::PARAM_STR) { |
|
| 265 | + public function quote($value, $type = self::PARAM_STR) { |
|
| 266 | 266 | if ($value instanceof ExpressionInterface) { |
| 267 | 267 | return $value; |
| 268 | 268 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param array $values |
| 283 | 283 | * @return string[] |
| 284 | 284 | */ |
| 285 | - public function quoteArray (array $values) { |
|
| 285 | + public function quoteArray(array $values) { |
|
| 286 | 286 | return array_map([$this, 'quote'], $values); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @param array $values |
| 293 | 293 | * @return string |
| 294 | 294 | */ |
| 295 | - public function quoteList (array $values): string { |
|
| 295 | + public function quoteList(array $values): string { |
|
| 296 | 296 | return implode(',', $this->quoteArray($values)); |
| 297 | 297 | } |
| 298 | 298 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @param EntityInterface $entity |
| 303 | 303 | * @return int ID |
| 304 | 304 | */ |
| 305 | - public function save (EntityInterface $entity): int { |
|
| 305 | + public function save(EntityInterface $entity): int { |
|
| 306 | 306 | return $this->getRecord($entity)->save($entity); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * @param Junction $junction |
| 312 | 312 | * @return $this |
| 313 | 313 | */ |
| 314 | - public function setJunction (string $interface, Junction $junction) { |
|
| 314 | + public function setJunction(string $interface, Junction $junction) { |
|
| 315 | 315 | $this->junctions[$interface] = $junction; |
| 316 | 316 | return $this; |
| 317 | 317 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @param Closure $logger |
| 321 | 321 | * @return $this |
| 322 | 322 | */ |
| 323 | - public function setLogger (Closure $logger) { |
|
| 323 | + public function setLogger(Closure $logger) { |
|
| 324 | 324 | $this->logger = $logger; |
| 325 | 325 | return $this; |
| 326 | 326 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * @param Record $record |
| 331 | 331 | * @return $this |
| 332 | 332 | */ |
| 333 | - public function setRecord (string $class, Record $record) { |
|
| 333 | + public function setRecord(string $class, Record $record) { |
|
| 334 | 334 | $this->records[$class] = $record; |
| 335 | 335 | return $this; |
| 336 | 336 | } |