Passed
Push — master ( 8b0690...6822a9 )
by y
01:22
created
src/DB/AttributesTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @return array
24 24
      */
25
-    public function getAttributes (): array {
25
+    public function getAttributes(): array {
26 26
         return $this->attributes ?: [];
27 27
     }
28 28
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @param mixed $offset
31 31
      * @return bool
32 32
      */
33
-    public function offsetExists ($offset): bool {
33
+    public function offsetExists($offset): bool {
34 34
         return $this->attributes and array_key_exists($offset, $this->attributes);
35 35
     }
36 36
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param mixed $offset
39 39
      * @return mixed Returns `NULL` for nonexistent attributes.
40 40
      */
41
-    public function offsetGet ($offset) {
41
+    public function offsetGet($offset) {
42 42
         return $this->attributes[$offset] ?? null;
43 43
     }
44 44
 
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
      * @param mixed $offset
47 47
      * @param mixed $value
48 48
      */
49
-    public function offsetSet ($offset, $value): void {
49
+    public function offsetSet($offset, $value): void {
50 50
         $this->attributes[$offset] = $value;
51 51
     }
52 52
 
53 53
     /**
54 54
      * @param mixed $offset
55 55
      */
56
-    public function offsetUnset ($offset): void {
56
+    public function offsetUnset($offset): void {
57 57
         unset($this->attributes[$offset]);
58 58
     }
59 59
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param array $attributes
62 62
      * @return $this
63 63
      */
64
-    public function setAttributes (array $attributes) {
64
+    public function setAttributes(array $attributes) {
65 65
         $this->attributes = $attributes;
66 66
         return $this;
67 67
     }
Please login to merge, or discard this patch.
src/DB/EntityInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/DB/Statement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/DB/Table.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param string $name
32 32
      * @param string[] $columns
33 33
      */
34
-    public function __construct (DB $db, $name, array $columns) {
34
+    public function __construct(DB $db, $name, array $columns) {
35 35
         parent::__construct($db);
36 36
         $this->name = $name;
37 37
         foreach ($columns as $column) {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @return string
46 46
      */
47
-    final public function __toString () {
47
+    final public function __toString() {
48 48
         return $this->name;
49 49
     }
50 50
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param array $match
57 57
      * @return int Rows affected.
58 58
      */
59
-    public function delete (array $match): int {
59
+    public function delete(array $match): int {
60 60
         $match = Predicate::all($this->db->matchArray($match));
61 61
         return $this->db->exec("DELETE FROM {$this} WHERE {$match}");
62 62
     }
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * @return Column[]
66 66
      */
67
-    final public function getColumns (): array {
67
+    final public function getColumns(): array {
68 68
         return $this->columns;
69 69
     }
70 70
 
71 71
     /**
72 72
      * @return string
73 73
      */
74
-    final public function getName (): string {
74
+    final public function getName(): string {
75 75
         return $this->name;
76 76
     }
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param array $values
82 82
      * @return Statement
83 83
      */
84
-    public function insert (array $values): Statement {
84
+    public function insert(array $values): Statement {
85 85
         $columns = implode(',', array_keys($values));
86 86
         $values = implode(', ', $this->db->quoteArray($values));
87 87
         return $this->db->query("INSERT INTO {$this} ($columns) VALUES ($values)");
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param string $name
92 92
      * @return bool
93 93
      */
94
-    public function offsetExists ($name): bool {
94
+    public function offsetExists($name): bool {
95 95
         return isset($this->columns[$name]);
96 96
     }
97 97
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param string $name
100 100
      * @return Column
101 101
      */
102
-    public function offsetGet ($name): Column {
102
+    public function offsetGet($name): Column {
103 103
         return $this->columns[$name];
104 104
     }
105 105
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      * @param string[] $columns Defaults to all columns.
110 110
      * @return Select
111 111
      */
112
-    public function select (array $columns = []): Select {
112
+    public function select(array $columns = []): Select {
113 113
         if (!$columns) {
114 114
             $columns = array_values($this->columns);
115 115
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param string $name
123 123
      * @return Table
124 124
      */
125
-    public function setName (string $name) {
125
+    public function setName(string $name) {
126 126
         $clone = clone $this;
127 127
         $clone->name = $name;
128 128
         foreach ($this->columns as $name => $column) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      * @param array $match
141 141
      * @return int Rows affected.
142 142
      */
143
-    public function update (array $values, array $match): int {
143
+    public function update(array $values, array $match): int {
144 144
         $values = implode(', ', $this->db->matchArray($values));
145 145
         $match = Predicate::all($this->db->matchArray($match));
146 146
         return $this->db->exec("UPDATE {$this} SET {$values} WHERE {$match}");
Please login to merge, or discard this patch.
src/DB/SQL.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param int|array|Countable $count
20 20
      * @return ExpressionInterface[]
21 21
      */
22
-    public static function marks ($count): array {
22
+    public static function marks($count): array {
23 23
         if (is_array($count) or $count instanceof Countable) {
24 24
             $count = count($count);
25 25
         }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param string[] $columns
35 35
      * @return string[] `["column" => ":column"]`
36 36
      */
37
-    public static function slots (array $columns): array {
37
+    public static function slots(array $columns): array {
38 38
         $slots = [];
39 39
         foreach ($columns as $column) {
40 40
             $slots[(string)$column] = ':' . str_replace('.', '__', $column);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param string[] $columns
47 47
      * @return string[] `["column" => "column=:column"]`
48 48
      */
49
-    public static function slotsEqual (array $columns): array {
49
+    public static function slotsEqual(array $columns): array {
50 50
         $slots = static::slots($columns);
51 51
         foreach ($slots as $column => $slot) {
52 52
             $slots[$column] = "{$column} = {$slot}";
@@ -54,5 +54,5 @@  discard block
 block discarded – undo
54 54
         return $slots;
55 55
     }
56 56
 
57
-    final private function __construct () { }
57
+    final private function __construct() { }
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/Column.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/DB/AbstractTable.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * @param DB $db
29 29
      */
30
-    public function __construct (DB $db) {
30
+    public function __construct(DB $db) {
31 31
         $this->db = $db;
32 32
     }
33 33
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @return string
38 38
      */
39
-    abstract public function __toString ();
39
+    abstract public function __toString();
40 40
 
41 41
     /**
42 42
      * Caches a prepared query.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param Closure $prepare `():Statement`
46 46
      * @return Statement
47 47
      */
48
-    protected function cache (string $key, Closure $prepare): Statement {
48
+    protected function cache(string $key, Closure $prepare): Statement {
49 49
         return $this->_cache[$key] ?? $this->_cache[$key] = $prepare->__invoke();
50 50
     }
51 51
 
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
      * @param string $name
54 54
      * @return bool
55 55
      */
56
-    abstract public function offsetExists ($name): bool;
56
+    abstract public function offsetExists($name): bool;
57 57
 
58 58
     /**
59 59
      * @param string $name
60 60
      * @return Column
61 61
      */
62
-    abstract public function offsetGet ($name): Column;
62
+    abstract public function offsetGet($name): Column;
63 63
 
64 64
     /**
65 65
      * Throws.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param void $value
69 69
      * @throws Exception
70 70
      */
71
-    final public function offsetSet ($name, $value): void {
71
+    final public function offsetSet($name, $value): void {
72 72
         throw new Exception('Tables are immutable.');
73 73
     }
74 74
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @param void $name
79 79
      * @throws Exception
80 80
      */
81
-    final public function offsetUnset ($name): void {
81
+    final public function offsetUnset($name): void {
82 82
         $this->offsetSet($name, null);
83 83
     }
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/SQL/DateTimeTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      *
20 20
      * @return Text
21 21
      */
22
-    public function getDate () {
22
+    public function getDate() {
23 23
         return new Text($this->db, $this->getDateTimeFormat('%Y-%m-%d'));
24 24
     }
25 25
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
         if (is_array($format)) {
34 34
             $format = $format[$this->db->getDriver()];
35 35
         }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return Numeric
50 50
      */
51
-    public function getDay () {
51
+    public function getDay() {
52 52
         return new Numeric($this->db, $this->getDateTimeFormat('%d'));
53 53
     }
54 54
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return Numeric
59 59
      */
60
-    public function getDayOfWeek () {
60
+    public function getDayOfWeek() {
61 61
         return new Numeric($this->db, $this->getDateTimeFormat('%w'));
62 62
     }
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return Numeric
68 68
      */
69
-    public function getDayOfYear () {
69
+    public function getDayOfYear() {
70 70
         return new Numeric($this->db, $this->getDateTimeFormat('%j'));
71 71
     }
72 72
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return Numeric
77 77
      */
78
-    public function getHours () {
78
+    public function getHours() {
79 79
         return new Numeric($this->db, $this->getDateTimeFormat('%H'));
80 80
     }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      *
85 85
      * @return Numeric
86 86
      */
87
-    public function getMinutes () {
87
+    public function getMinutes() {
88 88
         return new Numeric($this->db, $this->getDateTimeFormat([
89 89
             'mysql' => '%i',
90 90
             'sqlite' => '%M'
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @return Numeric
98 98
      */
99
-    public function getMonth () {
99
+    public function getMonth() {
100 100
         return new Numeric($this->db, $this->getDateTimeFormat('%m'));
101 101
     }
102 102
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @return Numeric
107 107
      */
108
-    public function getSeconds () {
108
+    public function getSeconds() {
109 109
         return new Numeric($this->db, $this->getDateTimeFormat('%S'));
110 110
     }
111 111
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @return Text
116 116
      */
117
-    public function getTime () {
117
+    public function getTime() {
118 118
         return new Text($this->db, $this->getDateTimeFormat([
119 119
             'mysql' => '%H:%i:%S',
120 120
             'sqlite' => '%H:%M:%S'
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      *
127 127
      * @return Numeric
128 128
      */
129
-    public function getTimestamp () {
129
+    public function getTimestamp() {
130 130
         switch ($this->db->getDriver()) {
131 131
             case 'sqlite':
132 132
                 return new Numeric($this->db, "STRFTIME('%s',{$this})");
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @return Numeric
142 142
      */
143
-    public function getWeekOfYear () {
143
+    public function getWeekOfYear() {
144 144
         return new Numeric($this->db, $this->getDateTimeFormat([
145 145
             'mysql' => '%U',
146 146
             'sqlite' => '%W'
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      *
153 153
      * @return Numeric
154 154
      */
155
-    public function getYear () {
155
+    public function getYear() {
156 156
         return new Numeric($this->db, $this->getDateTimeFormat('%Y'));
157 157
     }
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/SQL/NumericTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
29 29
      * @param number|ExpressionInterface $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
 block discarded – undo
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
 block discarded – undo
48 48
      * @param number|ExpressionInterface $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
103 103
      * @param number|ExpressionInterface $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
 block discarded – undo
113 113
      * @param number|ExpressionInterface $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
 block discarded – undo
123 123
      * @param int $decimals
124 124
      * @return Numeric
125 125
      */
126
-    public function round (int $decimals = 0) {
126
+    public function round(int $decimals = 0) {
127 127
         return new Numeric($this->db, "ROUND({$this},{$decimals})");
128 128
     }
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @param number|ExpressionInterface $arg
134 134
      * @return Numeric
135 135
      */
136
-    public function subtract ($arg) {
136
+    public function subtract($arg) {
137 137
         return new Numeric($this->db, "({$this} - {$arg})");
138 138
     }
139 139
 }
140 140
\ No newline at end of file
Please login to merge, or discard this patch.