@@ -12,7 +12,7 @@ |
||
| 12 | 12 | use ComparisonTrait; |
| 13 | 13 | use AggregateTrait; |
| 14 | 14 | |
| 15 | - public function __construct (DB $db, string $expression) { |
|
| 15 | + public function __construct(DB $db, string $expression) { |
|
| 16 | 16 | $this->db = $db; |
| 17 | 17 | parent::__construct($expression); |
| 18 | 18 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param array $values |
| 24 | 24 | * @return Value |
| 25 | 25 | */ |
| 26 | - public function coalesce (array $values) { |
|
| 26 | + public function coalesce(array $values) { |
|
| 27 | 27 | array_unshift($values, $this); |
| 28 | 28 | $values = implode(',', $this->db->quoteArray($values)); |
| 29 | 29 | return new Value($this->db, "COALESCE({$values})"); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param string[] $values `[when => then]` |
| 36 | 36 | * @return Choice |
| 37 | 37 | */ |
| 38 | - public function getChoice (array $values) { |
|
| 38 | + public function getChoice(array $values) { |
|
| 39 | 39 | return new Choice($this->db, $this, $values); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param null|bool|string|Select $arg |
| 49 | 49 | * @return Predicate |
| 50 | 50 | */ |
| 51 | - public function is ($arg): Predicate { |
|
| 51 | + public function is($arg): Predicate { |
|
| 52 | 52 | if ($arg === null or is_bool($arg)) { |
| 53 | 53 | $arg = ['' => 'NULL', 1 => 'TRUE', 0 => 'FALSE'][$arg]; |
| 54 | 54 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @param number|string $max |
| 67 | 67 | * @return Predicate |
| 68 | 68 | */ |
| 69 | - public function isBetween ($min, $max) { |
|
| 69 | + public function isBetween($min, $max) { |
|
| 70 | 70 | return new Predicate("{$this} BETWEEN {$this->db->quote($min)} AND {$this->db->quote($max)}"); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string|array|Select $arg |
| 77 | 77 | * @return Predicate |
| 78 | 78 | */ |
| 79 | - public function isEqual ($arg) { |
|
| 79 | + public function isEqual($arg) { |
|
| 80 | 80 | return Predicate::compare($this, $this->db->quoteMixed($arg)); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param string|Select $arg |
| 87 | 87 | * @return Predicate |
| 88 | 88 | */ |
| 89 | - public function isGreater ($arg) { |
|
| 89 | + public function isGreater($arg) { |
|
| 90 | 90 | return Predicate::compare($this, $this->db->quote($arg), '>', 'ALL'); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param string|Select $arg |
| 97 | 97 | * @return Predicate |
| 98 | 98 | */ |
| 99 | - public function isGreaterOrEqual ($arg) { |
|
| 99 | + public function isGreaterOrEqual($arg) { |
|
| 100 | 100 | return Predicate::compare($this, $this->db->quote($arg), '>=', 'ALL'); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * @param string|Select $arg |
| 107 | 107 | * @return Predicate |
| 108 | 108 | */ |
| 109 | - public function isLess ($arg) { |
|
| 109 | + public function isLess($arg) { |
|
| 110 | 110 | return Predicate::compare($this, $this->db->quote($arg), '<', 'ALL'); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param string|Select $arg |
| 117 | 117 | * @return Predicate |
| 118 | 118 | */ |
| 119 | - public function isLessOrEqual ($arg) { |
|
| 119 | + public function isLessOrEqual($arg) { |
|
| 120 | 120 | return Predicate::compare($this, $this->db->quote($arg), '<=', 'ALL'); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string $pattern |
| 127 | 127 | * @return Predicate |
| 128 | 128 | */ |
| 129 | - public function isLike (string $pattern) { |
|
| 129 | + public function isLike(string $pattern) { |
|
| 130 | 130 | return Predicate::compare($this, $this->db->quote($pattern), 'LIKE'); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param null|bool|string|Select $arg |
| 137 | 137 | * @return Predicate |
| 138 | 138 | */ |
| 139 | - public function isNot ($arg) { |
|
| 139 | + public function isNot($arg) { |
|
| 140 | 140 | return $this->is($arg)->invert(); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param number|string $max |
| 148 | 148 | * @return Predicate |
| 149 | 149 | */ |
| 150 | - public function isNotBetween ($min, $max) { |
|
| 150 | + public function isNotBetween($min, $max) { |
|
| 151 | 151 | return new Predicate("{$this} NOT BETWEEN {$this->db->quote($min)} AND {$this->db->quote($max)}"); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|array|Select $arg |
| 158 | 158 | * @return Predicate |
| 159 | 159 | */ |
| 160 | - public function isNotEqual ($arg) { |
|
| 160 | + public function isNotEqual($arg) { |
|
| 161 | 161 | return Predicate::compare($this, $this->db->quoteMixed($arg), '<>', 'ALL', 'NOT IN'); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param string $pattern |
| 168 | 168 | * @return Predicate |
| 169 | 169 | */ |
| 170 | - public function isNotLike (string $pattern) { |
|
| 170 | + public function isNotLike(string $pattern) { |
|
| 171 | 171 | return Predicate::compare($this, $this->db->quote($pattern), 'NOT LIKE'); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $pattern |
| 178 | 178 | * @return Predicate |
| 179 | 179 | */ |
| 180 | - public function isNotRegExp (string $pattern) { |
|
| 180 | + public function isNotRegExp(string $pattern) { |
|
| 181 | 181 | return Predicate::compare($this, $this->db->quote($pattern), 'NOT REGEXP'); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param string $pattern |
| 188 | 188 | * @return Predicate |
| 189 | 189 | */ |
| 190 | - public function isRegExp (string $pattern) { |
|
| 190 | + public function isRegExp(string $pattern) { |
|
| 191 | 191 | return Predicate::compare($this, $this->db->quote($pattern), 'REGEXP'); |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | \ No newline at end of file |
@@ -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 |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string|ValueInterface $subject |
| 53 | 53 | * @param array $values `[when => then]` for the subject. |
| 54 | 54 | */ |
| 55 | - public function __construct (DB $db, $subject = null, array $values = []) { |
|
| 55 | + public function __construct(DB $db, $subject = null, array $values = []) { |
|
| 56 | 56 | parent::__construct($db, ''); |
| 57 | 57 | $this->subject = (string)$this->db->quote($subject); |
| 58 | 58 | $this->setValues($values); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * @return string |
| 63 | 63 | */ |
| 64 | - public function __toString () { |
|
| 64 | + public function __toString() { |
|
| 65 | 65 | $sql = 'CASE'; |
| 66 | 66 | if (strlen($this->subject)) { |
| 67 | 67 | $sql .= " {$this->subject}"; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param string|ValueInterface |
| 81 | 81 | * @return $this |
| 82 | 82 | */ |
| 83 | - public function setElse ($else) { |
|
| 83 | + public function setElse($else) { |
|
| 84 | 84 | $this->else = (string)$this->db->quote($else); |
| 85 | 85 | return $this; |
| 86 | 86 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param string|ValueInterface $then |
| 93 | 93 | * @return $this |
| 94 | 94 | */ |
| 95 | - public function setValue ($when, $then) { |
|
| 95 | + public function setValue($when, $then) { |
|
| 96 | 96 | $when = (string)$this->db->quote($when); |
| 97 | 97 | $then = (string)$this->db->quote($then); |
| 98 | 98 | $this->values[$when] = $then; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param array $values `[when => then]` |
| 106 | 106 | * @return $this |
| 107 | 107 | */ |
| 108 | - public function setValues (array $values) { |
|
| 108 | + public function setValues(array $values) { |
|
| 109 | 109 | foreach ($values as $when => $then) { |
| 110 | 110 | $this->setValue($when, $then); |
| 111 | 111 | } |
@@ -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 new Numeric($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 new Numeric($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 new Numeric($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 new Numeric($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 new Numeric($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 new Predicate("({$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 new Predicate("{$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 new Predicate("({$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 new Predicate("{$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 new Numeric($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 new Numeric($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 new Numeric($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 new Numeric($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 new Numeric($this->db, "({$this} - {$arg})"); |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | \ No newline at end of file |