@@ -10,5 +10,5 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * @return int |
| 12 | 12 | */ |
| 13 | - public function getId (); |
|
| 13 | + public function getId(); |
|
| 14 | 14 | } |
| 15 | 15 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param DB $db |
| 23 | 23 | */ |
| 24 | - protected function __construct (DB $db) { |
|
| 24 | + protected function __construct(DB $db) { |
|
| 25 | 25 | $this->db = $db; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param array $args |
| 32 | 32 | * @return $this |
| 33 | 33 | */ |
| 34 | - public function __invoke (array $args = null) { |
|
| 34 | + public function __invoke(array $args = null) { |
|
| 35 | 35 | $this->execute($args); |
| 36 | 36 | return $this; |
| 37 | 37 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return string |
| 43 | 43 | */ |
| 44 | - public function __toString () { |
|
| 44 | + public function __toString() { |
|
| 45 | 45 | return $this->queryString; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @return bool |
| 55 | 55 | * @throws ArgumentCountError |
| 56 | 56 | */ |
| 57 | - public function execute ($args = null) { |
|
| 57 | + public function execute($args = null) { |
|
| 58 | 58 | $this->db->getLogger()->__invoke($this->queryString); |
| 59 | 59 | if ($result = !parent::execute($args)) { |
| 60 | 60 | $info = $this->errorInfo(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @return int |
| 73 | 73 | */ |
| 74 | - public function getId (): int { |
|
| 74 | + public function getId(): int { |
|
| 75 | 75 | return (int)$this->db->lastInsertId(); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param string $name |
| 39 | 39 | * @param string $qualifier |
| 40 | 40 | */ |
| 41 | - public function __construct (DB $db, string $name, string $qualifier = '') { |
|
| 41 | + public function __construct(DB $db, string $name, string $qualifier = '') { |
|
| 42 | 42 | $this->db = $db; |
| 43 | 43 | $this->name = $name; |
| 44 | 44 | $this->qualifier = $qualifier; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | - public function __toString (): string { |
|
| 52 | + public function __toString(): string { |
|
| 53 | 53 | if (strlen($this->qualifier)) { |
| 54 | 54 | return "{$this->qualifier}.{$this->name}"; |
| 55 | 55 | } |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * @return string |
| 61 | 61 | */ |
| 62 | - final public function getName (): string { |
|
| 62 | + final public function getName(): string { |
|
| 63 | 63 | return $this->name; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @return string |
| 68 | 68 | */ |
| 69 | - final public function getQualifier (): string { |
|
| 69 | + final public function getQualifier(): string { |
|
| 70 | 70 | return $this->qualifier; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param string $name |
| 75 | 75 | * @return $this |
| 76 | 76 | */ |
| 77 | - public function setName (string $name) { |
|
| 77 | + public function setName(string $name) { |
|
| 78 | 78 | $clone = clone $this; |
| 79 | 79 | $clone->name = $name; |
| 80 | 80 | return $clone; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param string $qualifier |
| 85 | 85 | * @return $this |
| 86 | 86 | */ |
| 87 | - public function setQualifier (string $qualifier) { |
|
| 87 | + public function setQualifier(string $qualifier) { |
|
| 88 | 88 | $clone = clone $this; |
| 89 | 89 | $clone->qualifier = $qualifier; |
| 90 | 90 | return $clone; |
@@ -10,5 +10,5 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * @return string |
| 12 | 12 | */ |
| 13 | - public function __toString (); |
|
| 13 | + public function __toString(); |
|
| 14 | 14 | } |
| 15 | 15 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - public function getAttributes (): array { |
|
| 33 | + public function getAttributes(): array { |
|
| 34 | 34 | return $this->attributes ?? []; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param mixed $attr |
| 39 | 39 | * @return bool |
| 40 | 40 | */ |
| 41 | - public function offsetExists ($attr): bool { |
|
| 41 | + public function offsetExists($attr): bool { |
|
| 42 | 42 | return isset($this->attributes) and array_key_exists($attr, $this->attributes); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param mixed $attr |
| 47 | 47 | * @return null|mixed |
| 48 | 48 | */ |
| 49 | - public function offsetGet ($attr) { |
|
| 49 | + public function offsetGet($attr) { |
|
| 50 | 50 | return $this->attributes[$attr] ?? null; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param mixed $attr |
| 55 | 55 | * @param mixed $value |
| 56 | 56 | */ |
| 57 | - public function offsetSet ($attr, $value): void { |
|
| 57 | + public function offsetSet($attr, $value): void { |
|
| 58 | 58 | if (isset($attr)) { |
| 59 | 59 | $this->attributes[$attr] = $value; |
| 60 | 60 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | /** |
| 67 | 67 | * @param mixed $attr |
| 68 | 68 | */ |
| 69 | - public function offsetUnset ($attr): void { |
|
| 69 | + public function offsetUnset($attr): void { |
|
| 70 | 70 | unset($this->attributes[$attr]); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param array $attributes |
| 75 | 75 | * @return $this |
| 76 | 76 | */ |
| 77 | - public function setAttributes (array $attributes) { |
|
| 77 | + public function setAttributes(array $attributes) { |
|
| 78 | 78 | $this->attributes = $attributes; |
| 79 | 79 | return $this; |
| 80 | 80 | } |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - abstract public function __toString (); |
|
| 19 | + abstract public function __toString(); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @param int|string $column |
| 23 | 23 | * @return null|Column |
| 24 | 24 | */ |
| 25 | - abstract public function offsetGet ($column); |
|
| 25 | + abstract public function offsetGet($column); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var DB |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @param DB $db |
| 34 | 34 | */ |
| 35 | - public function __construct (DB $db) { |
|
| 35 | + public function __construct(DB $db) { |
|
| 36 | 36 | $this->db = $db; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param int|string $column |
| 41 | 41 | * @return bool |
| 42 | 42 | */ |
| 43 | - public function offsetExists ($column): bool { |
|
| 43 | + public function offsetExists($column): bool { |
|
| 44 | 44 | return $this->offsetGet($column) !== null; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @param void $value |
| 52 | 52 | * @throws Exception |
| 53 | 53 | */ |
| 54 | - final public function offsetSet ($offset, $value): void { |
|
| 54 | + final public function offsetSet($offset, $value): void { |
|
| 55 | 55 | throw new Exception('Tables are immutable.'); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param void $name |
| 62 | 62 | * @throws Exception |
| 63 | 63 | */ |
| 64 | - final public function offsetUnset ($name): void { |
|
| 64 | + final public function offsetUnset($name): void { |
|
| 65 | 65 | $this->offsetSet($name, null); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | * @param int|array|Countable $count |
| 19 | 19 | * @return ExpressionInterface[] |
| 20 | 20 | */ |
| 21 | - public static function marks ($count): array { |
|
| 21 | + public static function marks($count): array { |
|
| 22 | 22 | static $mark; |
| 23 | 23 | $mark ??= new class implements ExpressionInterface { |
| 24 | 24 | |
| 25 | - public function __toString () { |
|
| 25 | + public function __toString() { |
|
| 26 | 26 | return '?'; |
| 27 | 27 | } |
| 28 | 28 | }; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param string[] $columns |
| 42 | 42 | * @return string[] `["column" => ":column"]` |
| 43 | 43 | */ |
| 44 | - public static function slots (array $columns): array { |
|
| 44 | + public static function slots(array $columns): array { |
|
| 45 | 45 | $slots = []; |
| 46 | 46 | foreach ($columns as $column) { |
| 47 | 47 | $slots[$column] = ':' . str_replace('.', '__', $column); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param string[] $columns |
| 54 | 54 | * @return string[] `["column" => "column=:column"]` |
| 55 | 55 | */ |
| 56 | - public static function slotsEqual (array $columns): array { |
|
| 56 | + public static function slotsEqual(array $columns): array { |
|
| 57 | 57 | $slots = static::slots($columns); |
| 58 | 58 | foreach ($slots as $column => $slot) { |
| 59 | 59 | $slots[$column] = "{$column} = {$slot}"; |
@@ -61,6 +61,6 @@ discard block |
||
| 61 | 61 | return $slots; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - final private function __construct () { |
|
| 64 | + final private function __construct() { |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | trait DateTimeTrait { |
| 11 | 11 | |
| 12 | - abstract public function __toString (); |
|
| 12 | + abstract public function __toString(); |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @var DB |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return Text |
| 23 | 23 | */ |
| 24 | - public function getDate () { |
|
| 24 | + public function getDate() { |
|
| 25 | 25 | return Text::factory($this->db, $this->getDateTimeFormat('%Y-%m-%d')); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param string|array $format Format, or formats keyed by driver name. |
| 32 | 32 | * @return Text |
| 33 | 33 | */ |
| 34 | - public function getDateTimeFormat ($format) { |
|
| 34 | + public function getDateTimeFormat($format) { |
|
| 35 | 35 | if (is_array($format)) { |
| 36 | 36 | $format = $format[$this->db->getDriver()]; |
| 37 | 37 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @return Numeric |
| 49 | 49 | */ |
| 50 | - public function getDay () { |
|
| 50 | + public function getDay() { |
|
| 51 | 51 | return Numeric::factory($this->db, $this->getDateTimeFormat('%d')); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return Numeric |
| 58 | 58 | */ |
| 59 | - public function getDayOfWeek () { |
|
| 59 | + public function getDayOfWeek() { |
|
| 60 | 60 | return Numeric::factory($this->db, $this->getDateTimeFormat('%w')); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return Numeric |
| 67 | 67 | */ |
| 68 | - public function getDayOfYear () { |
|
| 68 | + public function getDayOfYear() { |
|
| 69 | 69 | return Numeric::factory($this->db, $this->getDateTimeFormat('%j')); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return Numeric |
| 76 | 76 | */ |
| 77 | - public function getHours () { |
|
| 77 | + public function getHours() { |
|
| 78 | 78 | return Numeric::factory($this->db, $this->getDateTimeFormat('%H')); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return Numeric |
| 85 | 85 | */ |
| 86 | - public function getMinutes () { |
|
| 86 | + public function getMinutes() { |
|
| 87 | 87 | return Numeric::factory($this->db, $this->getDateTimeFormat([ |
| 88 | 88 | 'mysql' => '%i', |
| 89 | 89 | 'sqlite' => '%M' |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return Numeric |
| 97 | 97 | */ |
| 98 | - public function getMonth () { |
|
| 98 | + public function getMonth() { |
|
| 99 | 99 | return Numeric::factory($this->db, $this->getDateTimeFormat('%m')); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return Numeric |
| 106 | 106 | */ |
| 107 | - public function getSeconds () { |
|
| 107 | + public function getSeconds() { |
|
| 108 | 108 | return Numeric::factory($this->db, $this->getDateTimeFormat('%S')); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return Text |
| 115 | 115 | */ |
| 116 | - public function getTime () { |
|
| 116 | + public function getTime() { |
|
| 117 | 117 | return Text::factory($this->db, $this->getDateTimeFormat([ |
| 118 | 118 | 'mysql' => '%H:%i:%S', |
| 119 | 119 | 'sqlite' => '%H:%M:%S' |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @return Numeric |
| 127 | 127 | */ |
| 128 | - public function getTimestamp () { |
|
| 128 | + public function getTimestamp() { |
|
| 129 | 129 | if ($this->db->isSQLite()) { |
| 130 | 130 | return Numeric::factory($this->db, "STRFTIME('%s',{$this})"); |
| 131 | 131 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return Numeric |
| 139 | 139 | */ |
| 140 | - public function getWeekOfYear () { |
|
| 140 | + public function getWeekOfYear() { |
|
| 141 | 141 | return Numeric::factory($this->db, $this->getDateTimeFormat([ |
| 142 | 142 | 'mysql' => '%U', |
| 143 | 143 | 'sqlite' => '%W' |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * |
| 150 | 150 | * @return Numeric |
| 151 | 151 | */ |
| 152 | - public function getYear () { |
|
| 152 | + public function getYear() { |
|
| 153 | 153 | return Numeric::factory($this->db, $this->getDateTimeFormat('%Y')); |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @return Numeric |
| 16 | 16 | */ |
| 17 | - public function toFloat () { |
|
| 17 | + public function toFloat() { |
|
| 18 | 18 | if ($this->db->isSQLite()) { |
| 19 | 19 | return Numeric::factory($this->db, "CAST({$this} AS REAL)"); |
| 20 | 20 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return Numeric |
| 28 | 28 | */ |
| 29 | - public function toInt () { |
|
| 29 | + public function toInt() { |
|
| 30 | 30 | if ($this->db->isSQLite()) { |
| 31 | 31 | return Numeric::factory($this->db, "CAST({$this} AS INTEGER)"); |
| 32 | 32 | } |