@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @param string[] $conditions |
18 | 18 | * @return Predicate |
19 | 19 | */ |
20 | - public static function all (array $conditions) { |
|
20 | + public static function all(array $conditions) { |
|
21 | 21 | if (count($conditions) === 1) { |
22 | 22 | return new static(reset($conditions)); |
23 | 23 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string[] $conditions |
31 | 31 | * @return Predicate |
32 | 32 | */ |
33 | - public static function any (array $conditions) { |
|
33 | + public static function any(array $conditions) { |
|
34 | 34 | if (count($conditions) === 1) { |
35 | 35 | return new static(reset($conditions)); |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return Predicate |
44 | 44 | */ |
45 | - public function invert () { |
|
45 | + public function invert() { |
|
46 | 46 | return new static("NOT({$this})"); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @return Predicate |
14 | 14 | */ |
15 | - public function isFalse () { |
|
15 | + public function isFalse() { |
|
16 | 16 | return $this->db->factory(Predicate::class, "{$this} IS FALSE"); |
17 | 17 | } |
18 | 18 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return Predicate |
23 | 23 | */ |
24 | - public function isNotNull () { |
|
24 | + public function isNotNull() { |
|
25 | 25 | return $this->db->factory(Predicate::class, "{$this} IS NOT NULL"); |
26 | 26 | } |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return Predicate |
32 | 32 | */ |
33 | - public function isNull () { |
|
33 | + public function isNull() { |
|
34 | 34 | return $this->db->factory(Predicate::class, "{$this} IS NULL"); |
35 | 35 | } |
36 | 36 | } |
37 | 37 | \ 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 | switch ($this->db) { |
19 | 19 | case 'sqlite': |
20 | 20 | return $this->db->factory(Numeric::class, $this->db, "CAST({$this} AS REAL)"); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return Numeric |
30 | 30 | */ |
31 | - public function toInt () { |
|
31 | + public function toInt() { |
|
32 | 32 | switch ($this->db) { |
33 | 33 | case 'sqlite': |
34 | 34 | return $this->db->factory(Numeric::class, $this->db, "CAST({$this} AS INTEGER)"); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param string $aggregate `ALL|DISTINCT` |
21 | 21 | * @return Numeric |
22 | 22 | */ |
23 | - public function getAvg ($aggregate = 'ALL') { |
|
23 | + public function getAvg($aggregate = 'ALL') { |
|
24 | 24 | return $this->db->factory(Numeric::class, $this->db, "AVG({$aggregate} {$this})"); |
25 | 25 | } |
26 | 26 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string $delimiter |
31 | 31 | * @return Text |
32 | 32 | */ |
33 | - public function getConcat (string $delimiter = ',') { |
|
33 | + public function getConcat(string $delimiter = ',') { |
|
34 | 34 | $delimiter = $this->db->quote($delimiter); |
35 | 35 | switch ($this->db) { |
36 | 36 | case 'sqlite': |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string $aggregate `ALL|DISTINCT` |
47 | 47 | * @return Numeric |
48 | 48 | */ |
49 | - public function getCount (string $aggregate = 'ALL') { |
|
49 | + public function getCount(string $aggregate = 'ALL') { |
|
50 | 50 | return $this->db->factory(Numeric::class, $this->db, "COUNT({$aggregate} {$this})"); |
51 | 51 | } |
52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return Numeric |
57 | 57 | */ |
58 | - public function getMax () { |
|
58 | + public function getMax() { |
|
59 | 59 | return $this->db->factory(Numeric::class, $this->db, "MAX({$this})"); |
60 | 60 | } |
61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return Numeric |
66 | 66 | */ |
67 | - public function getMin () { |
|
67 | + public function getMin() { |
|
68 | 68 | return $this->db->factory(Numeric::class, $this->db, "MIN({$this})"); |
69 | 69 | } |
70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $aggregate `ALL|DISTINCT` |
75 | 75 | * @return Numeric |
76 | 76 | */ |
77 | - public function getSum (string $aggregate = 'ALL') { |
|
77 | + public function getSum(string $aggregate = 'ALL') { |
|
78 | 78 | return $this->db->factory(Numeric::class, $this->db, "SUM({$aggregate} {$this})"); |
79 | 79 | } |
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @return Text |
19 | 19 | */ |
20 | - public function getHex () { |
|
20 | + public function getHex() { |
|
21 | 21 | return $this->db->factory(Text::class, $this->db, "HEX({$this})"); |
22 | 22 | } |
23 | 23 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return Numeric |
30 | 30 | */ |
31 | - public function getLength () { |
|
31 | + public function getLength() { |
|
32 | 32 | switch ($this->db) { |
33 | 33 | case 'sqlite': |
34 | 34 | return $this->db->factory(Numeric::class, $this->db, "LENGTH(CAST({$this} AS TEXT))"); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return Text |
44 | 44 | */ |
45 | - public function getLower () { |
|
45 | + public function getLower() { |
|
46 | 46 | return $this->db->factory(Text::class, $this->db, "LOWER({$this})"); |
47 | 47 | } |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $substring |
55 | 55 | * @return Numeric |
56 | 56 | */ |
57 | - public function getPosition (string $substring) { |
|
57 | + public function getPosition(string $substring) { |
|
58 | 58 | $substring = $this->db->quote($substring); |
59 | 59 | switch ($this->db) { |
60 | 60 | case 'sqlite': |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param string $replace |
72 | 72 | * @return Text |
73 | 73 | */ |
74 | - public function getReplacement (string $search, string $replace) { |
|
74 | + public function getReplacement(string $search, string $replace) { |
|
75 | 75 | $search = $this->db->quote($search); |
76 | 76 | $replace = $this->db->quote($replace); |
77 | 77 | return $this->db->factory(Text::class, $this->db, "REPLACE({$this},{$search},{$replace})"); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return Numeric |
84 | 84 | */ |
85 | - public function getSize () { |
|
85 | + public function getSize() { |
|
86 | 86 | switch ($this->db) { |
87 | 87 | case 'sqlite': |
88 | 88 | return $this->db->factory(Numeric::class, $this->db, "LENGTH(CAST({$this} AS BLOB))"); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param int $length |
99 | 99 | * @return Text |
100 | 100 | */ |
101 | - public function getSubstring (int $start, int $length = null) { |
|
101 | + public function getSubstring(int $start, int $length = null) { |
|
102 | 102 | if (isset($length)) { |
103 | 103 | return $this->db->factory(Text::class, $this->db, "SUBSTR({$this},{$start},{$length})"); |
104 | 104 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return Text |
112 | 112 | */ |
113 | - public function getUpper () { |
|
113 | + public function getUpper() { |
|
114 | 114 | return $this->db->factory(Text::class, $this->db, "UPPER({$this})"); |
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return Text |
21 | 21 | */ |
22 | - public function getDate () { |
|
22 | + public function getDate() { |
|
23 | 23 | return $this->db->factory(Text::class, $this->db, $this->getDateTimeFormat('%Y-%m-%d')); |
24 | 24 | } |
25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param string|array $format Format, or formats keyed by driver name. |
30 | 30 | * @return Text |
31 | 31 | */ |
32 | - public function getDateTimeFormat ($format) { |
|
32 | + public function getDateTimeFormat($format) { |
|
33 | 33 | $driver = $this->db->getDriver(); |
34 | 34 | if (is_array($format)) { |
35 | 35 | $format = $format[$driver]; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return Numeric |
50 | 50 | */ |
51 | - public function getDay () { |
|
51 | + public function getDay() { |
|
52 | 52 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%d')); |
53 | 53 | } |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return Numeric |
59 | 59 | */ |
60 | - public function getDayOfWeek () { |
|
60 | + public function getDayOfWeek() { |
|
61 | 61 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%w')); |
62 | 62 | } |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return Numeric |
68 | 68 | */ |
69 | - public function getDayOfYear () { |
|
69 | + public function getDayOfYear() { |
|
70 | 70 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%j')); |
71 | 71 | } |
72 | 72 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return Numeric |
77 | 77 | */ |
78 | - public function getHours () { |
|
78 | + public function getHours() { |
|
79 | 79 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%H')); |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return Numeric |
86 | 86 | */ |
87 | - public function getMinutes () { |
|
87 | + public function getMinutes() { |
|
88 | 88 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat([ |
89 | 89 | 'mysql' => '%i', |
90 | 90 | 'sqlite' => '%M' |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return Numeric |
98 | 98 | */ |
99 | - public function getMonth () { |
|
99 | + public function getMonth() { |
|
100 | 100 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%m')); |
101 | 101 | } |
102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return Numeric |
107 | 107 | */ |
108 | - public function getSeconds () { |
|
108 | + public function getSeconds() { |
|
109 | 109 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%S')); |
110 | 110 | } |
111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return Text |
116 | 116 | */ |
117 | - public function getTime () { |
|
117 | + public function getTime() { |
|
118 | 118 | return $this->db->factory(Text::class, $this->db, $this->getDateTimeFormat([ |
119 | 119 | 'mysql' => '%H:%i:%S', |
120 | 120 | 'sqlite' => '%H:%M:%S' |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return Numeric |
128 | 128 | */ |
129 | - public function getTimestamp () { |
|
129 | + public function getTimestamp() { |
|
130 | 130 | switch ($this->db) { |
131 | 131 | case 'sqlite': |
132 | 132 | return $this->db->factory(Numeric::class, $this->db, "STRFTIME('%s',{$this})"); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return Numeric |
142 | 142 | */ |
143 | - public function getWeekOfYear () { |
|
143 | + public function getWeekOfYear() { |
|
144 | 144 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat([ |
145 | 145 | 'mysql' => '%U', |
146 | 146 | 'sqlite' => '%W' |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return Numeric |
154 | 154 | */ |
155 | - public function getYear () { |
|
155 | + public function getYear() { |
|
156 | 156 | return $this->db->factory(Numeric::class, $this->db, $this->getDateTimeFormat('%Y')); |
157 | 157 | } |
158 | 158 | } |
159 | 159 | \ No newline at end of file |
@@ -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 |
@@ -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 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param string $password |
60 | 60 | * @param array $options |
61 | 61 | */ |
62 | - public function __construct ($dsn, $username = null, $password = null, $options = null) { |
|
62 | + public function __construct($dsn, $username = null, $password = null, $options = null) { |
|
63 | 63 | parent::__construct($dsn, $username, $password, $options); |
64 | 64 | $this->driver = $this->getAttribute(self::ATTR_DRIVER_NAME); |
65 | 65 | $this->setAttribute(self::ATTR_DEFAULT_FETCH_MODE, self::FETCH_ASSOC); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return string |
83 | 83 | */ |
84 | - final public function __toString () { |
|
84 | + final public function __toString() { |
|
85 | 85 | return $this->driver; |
86 | 86 | } |
87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param string $sql |
92 | 92 | * @return int |
93 | 93 | */ |
94 | - public function exec ($sql): int { |
|
94 | + public function exec($sql): int { |
|
95 | 95 | $this->logger->__invoke($sql); |
96 | 96 | return parent::exec($sql); |
97 | 97 | } |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param mixed ...$args |
106 | 106 | * @return mixed |
107 | 107 | */ |
108 | - public function factory (string $class, ...$args) { |
|
108 | + public function factory(string $class, ...$args) { |
|
109 | 109 | return new $class(...$args); |
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - final public function getDriver (): string { |
|
115 | + final public function getDriver(): string { |
|
116 | 116 | return $this->driver; |
117 | 117 | } |
118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param string $interface |
123 | 123 | * @return Junction |
124 | 124 | */ |
125 | - public function getJunction ($interface) { |
|
125 | + public function getJunction($interface) { |
|
126 | 126 | return $this->junctions[$interface] |
127 | 127 | ?? $this->junctions[$interface] = Junction::fromInterface($this, $interface); |
128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * @return Closure |
132 | 132 | */ |
133 | - public function getLogger () { |
|
133 | + public function getLogger() { |
|
134 | 134 | return $this->logger; |
135 | 135 | } |
136 | 136 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param string|EntityInterface $class |
141 | 141 | * @return Record |
142 | 142 | */ |
143 | - public function getRecord ($class) { |
|
143 | + public function getRecord($class) { |
|
144 | 144 | if (is_object($class)) { |
145 | 145 | $class = get_class($class); |
146 | 146 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @param string $name |
153 | 153 | * @return null|Table |
154 | 154 | */ |
155 | - public function getTable (string $name) { |
|
155 | + public function getTable(string $name) { |
|
156 | 156 | if (!isset($this->tables[$name])) { |
157 | 157 | if ($this->isSQLite()) { |
158 | 158 | $info = $this->query("PRAGMA table_info({$this->quote($name)})")->fetchAll(); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | "SELECT column_name FROM information_schema.tables WHERE table_name = {$this->quote($name)}" |
164 | 164 | )->fetchAll(self::FETCH_COLUMN); |
165 | 165 | } |
166 | - if (!$cols){ |
|
166 | + if (!$cols) { |
|
167 | 167 | return null; |
168 | 168 | } |
169 | 169 | $this->tables[$name] = $this->factory(Table::class, $this, $name, $cols); |
@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * @return bool |
176 | 176 | */ |
177 | - final public function isMySQL (): bool { |
|
177 | + final public function isMySQL(): bool { |
|
178 | 178 | return $this->driver === 'mysql'; |
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
182 | 182 | * @return bool |
183 | 183 | */ |
184 | - final public function isPostgreSQL (): bool { |
|
184 | + final public function isPostgreSQL(): bool { |
|
185 | 185 | return $this->driver === 'pgsql'; |
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | 189 | * @return bool |
190 | 190 | */ |
191 | - final public function isSQLite (): bool { |
|
191 | + final public function isSQLite(): bool { |
|
192 | 192 | return $this->driver === 'sqlite'; |
193 | 193 | } |
194 | 194 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param mixed $b |
210 | 210 | * @return Predicate |
211 | 211 | */ |
212 | - public function match ($a, $b) { |
|
212 | + public function match($a, $b) { |
|
213 | 213 | if ($b instanceof Closure) { |
214 | 214 | return $b->__invoke($a, $this); |
215 | 215 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param string $class Class or interface name. |
230 | 230 | * @return bool |
231 | 231 | */ |
232 | - public function offsetExists ($class): bool { |
|
232 | + public function offsetExists($class): bool { |
|
233 | 233 | return (bool)$this->offsetGet($class); |
234 | 234 | } |
235 | 235 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @param string $class Class or interface name. |
238 | 238 | * @return null|Table|Record|Junction |
239 | 239 | */ |
240 | - public function offsetGet ($class) { |
|
240 | + public function offsetGet($class) { |
|
241 | 241 | if (is_a($class, EntityInterface::class, true)) { |
242 | 242 | return $this->getRecord($class); |
243 | 243 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param mixed $class Class or interface name. |
254 | 254 | * @param Table|Record|Junction $access |
255 | 255 | */ |
256 | - public function offsetSet ($class, $access) { |
|
256 | + public function offsetSet($class, $access) { |
|
257 | 257 | if ($access instanceof Record) { |
258 | 258 | $this->setRecord($class, $access); |
259 | 259 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | /** |
269 | 269 | * @param string $class Class or interface name. |
270 | 270 | */ |
271 | - public function offsetUnset ($class) { |
|
271 | + public function offsetUnset($class) { |
|
272 | 272 | unset($this->records[$class]); |
273 | 273 | unset($this->junctions[$class]); |
274 | 274 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param array $options |
281 | 281 | * @return Statement |
282 | 282 | */ |
283 | - public function prepare ($sql, $options = []) { |
|
283 | + public function prepare($sql, $options = []) { |
|
284 | 284 | $this->logger->__invoke($sql); |
285 | 285 | /** @var Statement $statement */ |
286 | 286 | $statement = parent::prepare($sql, $options); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param array $ctorargs Optional. |
297 | 297 | * @return Statement |
298 | 298 | */ |
299 | - public function query ($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
299 | + public function query($sql, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) { |
|
300 | 300 | $this->logger->__invoke($sql); |
301 | 301 | /** @var Statement $statement */ |
302 | 302 | $statement = parent::query(...func_get_args()); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param int $type Ignored. |
315 | 315 | * @return string|ExpressionInterface |
316 | 316 | */ |
317 | - public function quote ($value, $type = self::PARAM_STR) { |
|
317 | + public function quote($value, $type = self::PARAM_STR) { |
|
318 | 318 | if ($value instanceof ExpressionInterface) { |
319 | 319 | return $value; |
320 | 320 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * @param array $values |
335 | 335 | * @return string[] |
336 | 336 | */ |
337 | - public function quoteArray (array $values) { |
|
337 | + public function quoteArray(array $values) { |
|
338 | 338 | return array_map([$this, 'quote'], $values); |
339 | 339 | } |
340 | 340 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @param array $values |
345 | 345 | * @return string |
346 | 346 | */ |
347 | - public function quoteList (array $values): string { |
|
347 | + public function quoteList(array $values): string { |
|
348 | 348 | return implode(',', $this->quoteArray($values)); |
349 | 349 | } |
350 | 350 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @param EntityInterface $entity |
355 | 355 | * @return int ID |
356 | 356 | */ |
357 | - public function save (EntityInterface $entity): int { |
|
357 | + public function save(EntityInterface $entity): int { |
|
358 | 358 | return $this->getRecord($entity)->save($entity); |
359 | 359 | } |
360 | 360 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @param Junction $junction |
364 | 364 | * @return $this |
365 | 365 | */ |
366 | - public function setJunction (string $interface, Junction $junction) { |
|
366 | + public function setJunction(string $interface, Junction $junction) { |
|
367 | 367 | $this->junctions[$interface] = $junction; |
368 | 368 | return $this; |
369 | 369 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @param Closure $logger |
373 | 373 | * @return $this |
374 | 374 | */ |
375 | - public function setLogger (Closure $logger) { |
|
375 | + public function setLogger(Closure $logger) { |
|
376 | 376 | $this->logger = $logger; |
377 | 377 | return $this; |
378 | 378 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * @param Record $record |
383 | 383 | * @return $this |
384 | 384 | */ |
385 | - public function setRecord (string $class, Record $record) { |
|
385 | + public function setRecord(string $class, Record $record) { |
|
386 | 386 | $this->records[$class] = $record; |
387 | 387 | return $this; |
388 | 388 | } |
@@ -157,8 +157,7 @@ discard block |
||
157 | 157 | if ($this->isSQLite()) { |
158 | 158 | $info = $this->query("PRAGMA table_info({$this->quote($name)})")->fetchAll(); |
159 | 159 | $cols = array_column($info, 'name'); |
160 | - } |
|
161 | - else { |
|
160 | + } else { |
|
162 | 161 | $cols = $this->query( |
163 | 162 | "SELECT column_name FROM information_schema.tables WHERE table_name = {$this->quote($name)}" |
164 | 163 | )->fetchAll(self::FETCH_COLUMN); |
@@ -240,11 +239,9 @@ discard block |
||
240 | 239 | public function offsetGet ($class) { |
241 | 240 | if (is_a($class, EntityInterface::class, true)) { |
242 | 241 | return $this->getRecord($class); |
243 | - } |
|
244 | - elseif (interface_exists($class)) { |
|
242 | + } elseif (interface_exists($class)) { |
|
245 | 243 | return $this->getJunction($class); |
246 | - } |
|
247 | - else { |
|
244 | + } else { |
|
248 | 245 | return $this->getTable($class); |
249 | 246 | } |
250 | 247 | } |
@@ -256,11 +253,9 @@ discard block |
||
256 | 253 | public function offsetSet ($class, $access) { |
257 | 254 | if ($access instanceof Record) { |
258 | 255 | $this->setRecord($class, $access); |
259 | - } |
|
260 | - elseif ($access instanceof Junction) { |
|
256 | + } elseif ($access instanceof Junction) { |
|
261 | 257 | $this->setJunction($class, $access); |
262 | - } |
|
263 | - else { |
|
258 | + } else { |
|
264 | 259 | throw new LogicException('Raw table access is immutable.'); |
265 | 260 | } |
266 | 261 | } |