@@ -53,8 +53,7 @@ |
||
53 | 53 | * Class SQLServer |
54 | 54 | * @package Platine\Database\Driver |
55 | 55 | */ |
56 | -class SQLServer extends Driver |
|
57 | -{ |
|
56 | +class SQLServer extends Driver { |
|
58 | 57 | |
59 | 58 | /** |
60 | 59 | * @inheritdoc |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * Class MySQL |
53 | 53 | * @package Platine\Database\Driver |
54 | 54 | */ |
55 | -class MySQL extends Driver |
|
56 | -{ |
|
55 | +class MySQL extends Driver { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * @inheritdoc |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * Class PostgreSQL |
54 | 54 | * @package Platine\Database\Driver |
55 | 55 | */ |
56 | -class PostgreSQL extends Driver |
|
57 | -{ |
|
56 | +class PostgreSQL extends Driver { |
|
58 | 57 | |
59 | 58 | /** |
60 | 59 | * @inheritDoc |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | * Class ResultSet |
55 | 55 | * @package Platine\Database |
56 | 56 | */ |
57 | -class ResultSet |
|
58 | -{ |
|
57 | +class ResultSet { |
|
59 | 58 | |
60 | 59 | /** |
61 | 60 | * The PDOStatement instance |
@@ -67,16 +66,14 @@ discard block |
||
67 | 66 | * Class constructor |
68 | 67 | * @param PDOStatement $statement |
69 | 68 | */ |
70 | - public function __construct(PDOStatement $statement) |
|
71 | - { |
|
69 | + public function __construct(PDOStatement $statement) { |
|
72 | 70 | $this->statement = $statement; |
73 | 71 | } |
74 | 72 | |
75 | 73 | /** |
76 | 74 | * Destructor of the class |
77 | 75 | */ |
78 | - public function __desctruct() |
|
79 | - { |
|
76 | + public function __desctruct() { |
|
80 | 77 | $this->statement->closeCursor(); |
81 | 78 | } |
82 | 79 | |
@@ -124,8 +121,7 @@ discard block |
||
124 | 121 | * @param callable $callable |
125 | 122 | * @return mixed |
126 | 123 | */ |
127 | - public function get(callable $callable = null) |
|
128 | - { |
|
124 | + public function get(callable $callable = null) { |
|
129 | 125 | $result = $this->statement->fetch(); |
130 | 126 | $this->statement->closeCursor(); |
131 | 127 | if ($callable !== null) { |
@@ -140,8 +136,7 @@ discard block |
||
140 | 136 | * |
141 | 137 | * @return mixed |
142 | 138 | */ |
143 | - public function next() |
|
144 | - { |
|
139 | + public function next() { |
|
145 | 140 | return $this->statement->fetch(); |
146 | 141 | } |
147 | 142 | |
@@ -149,8 +144,7 @@ discard block |
||
149 | 144 | * Close the cursor |
150 | 145 | * @return mixed |
151 | 146 | */ |
152 | - public function flush() |
|
153 | - { |
|
147 | + public function flush() { |
|
154 | 148 | return $this->statement->closeCursor(); |
155 | 149 | } |
156 | 150 | |
@@ -160,8 +154,7 @@ discard block |
||
160 | 154 | * |
161 | 155 | * @return mixed |
162 | 156 | */ |
163 | - public function column(int $col = 0) |
|
164 | - { |
|
157 | + public function column(int $col = 0) { |
|
165 | 158 | return $this->statement->fetchColumn($col); |
166 | 159 | } |
167 | 160 |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | * Class Schema |
54 | 54 | * @package Platine\Database |
55 | 55 | */ |
56 | -class Schema |
|
57 | -{ |
|
56 | +class Schema { |
|
58 | 57 | |
59 | 58 | /** |
60 | 59 | * The Connection instance |
@@ -84,8 +83,7 @@ discard block |
||
84 | 83 | * Class constructor |
85 | 84 | * @param Connection $connection |
86 | 85 | */ |
87 | - public function __construct(Connection $connection) |
|
88 | - { |
|
86 | + public function __construct(Connection $connection) { |
|
89 | 87 | $this->connection = $connection; |
90 | 88 | } |
91 | 89 |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | * Class Select |
54 | 54 | * @package Platine\Database\Query |
55 | 55 | */ |
56 | -class Select extends SelectStatement |
|
57 | -{ |
|
56 | +class Select extends SelectStatement { |
|
58 | 57 | |
59 | 58 | /** |
60 | 59 | * @var Connection |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | * @param string|array $tables |
68 | 67 | * @param QueryStatement|null $queryStatement |
69 | 68 | */ |
70 | - public function __construct(Connection $connection, $tables, QueryStatement $queryStatement = null) |
|
71 | - { |
|
69 | + public function __construct(Connection $connection, $tables, QueryStatement $queryStatement = null) { |
|
72 | 70 | parent::__construct($tables, $queryStatement); |
73 | 71 | $this->connection = $connection; |
74 | 72 | } |
@@ -78,8 +76,7 @@ discard block |
||
78 | 76 | * |
79 | 77 | * @return ResultSet |
80 | 78 | */ |
81 | - public function select($columns = []) |
|
82 | - { |
|
79 | + public function select($columns = []) { |
|
83 | 80 | parent::select($columns); |
84 | 81 | $driver = $this->connection->getDriver(); |
85 | 82 | |
@@ -94,8 +91,7 @@ discard block |
||
94 | 91 | * |
95 | 92 | * @return mixed|false |
96 | 93 | */ |
97 | - public function column($name) |
|
98 | - { |
|
94 | + public function column($name) { |
|
99 | 95 | parent::column($name); |
100 | 96 | return $this->getColumnResultSet(); |
101 | 97 | } |
@@ -118,8 +114,7 @@ discard block |
||
118 | 114 | * |
119 | 115 | * @return int|float |
120 | 116 | */ |
121 | - public function avg($column, bool $distinct = false) |
|
122 | - { |
|
117 | + public function avg($column, bool $distinct = false) { |
|
123 | 118 | parent::avg($column, $distinct); |
124 | 119 | return $this->getColumnResultSet(); |
125 | 120 | } |
@@ -130,8 +125,7 @@ discard block |
||
130 | 125 | * |
131 | 126 | * @return int|float |
132 | 127 | */ |
133 | - public function sum($column, bool $distinct = false) |
|
134 | - { |
|
128 | + public function sum($column, bool $distinct = false) { |
|
135 | 129 | parent::sum($column, $distinct); |
136 | 130 | return $this->getColumnResultSet(); |
137 | 131 | } |
@@ -142,8 +136,7 @@ discard block |
||
142 | 136 | * |
143 | 137 | * @return int|float |
144 | 138 | */ |
145 | - public function min($column, bool $distinct = false) |
|
146 | - { |
|
139 | + public function min($column, bool $distinct = false) { |
|
147 | 140 | parent::min($column, $distinct); |
148 | 141 | return $this->getColumnResultSet(); |
149 | 142 | } |
@@ -154,8 +147,7 @@ discard block |
||
154 | 147 | * |
155 | 148 | * @return int|float |
156 | 149 | */ |
157 | - public function max($column, bool $distinct = false) |
|
158 | - { |
|
150 | + public function max($column, bool $distinct = false) { |
|
159 | 151 | parent::max($column, $distinct); |
160 | 152 | return $this->getColumnResultSet(); |
161 | 153 | } |
@@ -164,8 +156,7 @@ discard block |
||
164 | 156 | * Return the result set for column |
165 | 157 | * @return mixed |
166 | 158 | */ |
167 | - protected function getColumnResultSet() |
|
168 | - { |
|
159 | + protected function getColumnResultSet() { |
|
169 | 160 | $driver = $this->connection->getDriver(); |
170 | 161 | |
171 | 162 | return $this->connection->column( |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * Class Query |
53 | 53 | * @package Platine\Database\Query |
54 | 54 | */ |
55 | -class Query extends BaseStatement |
|
56 | -{ |
|
55 | +class Query extends BaseStatement { |
|
57 | 56 | |
58 | 57 | /** |
59 | 58 | * @var Connection |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | * |
88 | 87 | * @return Select|SelectStatement |
89 | 88 | */ |
90 | - public function distinct(bool $value = true) |
|
91 | - { |
|
89 | + public function distinct(bool $value = true) { |
|
92 | 90 | return $this->buildSelect()->distinct($value); |
93 | 91 | } |
94 | 92 | |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @return Select|SelectStatement |
99 | 97 | */ |
100 | - public function groupBy($columns) |
|
101 | - { |
|
98 | + public function groupBy($columns) { |
|
102 | 99 | $this->buildSelect()->groupBy($columns); |
103 | 100 | } |
104 | 101 | |
@@ -107,8 +104,7 @@ discard block |
||
107 | 104 | * |
108 | 105 | * @return Select|SelectStatement |
109 | 106 | */ |
110 | - public function having($column, \Closure $value = null) |
|
111 | - { |
|
107 | + public function having($column, \Closure $value = null) { |
|
112 | 108 | $this->buildSelect()->having($column, $value); |
113 | 109 | } |
114 | 110 | |
@@ -117,8 +113,7 @@ discard block |
||
117 | 113 | * |
118 | 114 | * @return Select|SelectStatement |
119 | 115 | */ |
120 | - public function orHaving($column, \Closure $value = null) |
|
121 | - { |
|
116 | + public function orHaving($column, \Closure $value = null) { |
|
122 | 117 | $this->buildSelect()->orHaving($column, $value); |
123 | 118 | } |
124 | 119 | |
@@ -128,8 +123,7 @@ discard block |
||
128 | 123 | * |
129 | 124 | * @return Select|SelectStatement |
130 | 125 | */ |
131 | - public function orderBy($columns, string $order = 'ASC') |
|
132 | - { |
|
126 | + public function orderBy($columns, string $order = 'ASC') { |
|
133 | 127 | return $this->buildSelect()->orderBy($columns, $order); |
134 | 128 | } |
135 | 129 | |
@@ -138,8 +132,7 @@ discard block |
||
138 | 132 | * |
139 | 133 | * @return Select|SelectStatement |
140 | 134 | */ |
141 | - public function limit(int $value) |
|
142 | - { |
|
135 | + public function limit(int $value) { |
|
143 | 136 | return $this->buildSelect()->limit($value); |
144 | 137 | } |
145 | 138 | |
@@ -148,8 +141,7 @@ discard block |
||
148 | 141 | * |
149 | 142 | * @return Select|SelectStatement |
150 | 143 | */ |
151 | - public function offset(int $value) |
|
152 | - { |
|
144 | + public function offset(int $value) { |
|
153 | 145 | return $this->buildSelect()->offset($value); |
154 | 146 | } |
155 | 147 | |
@@ -158,8 +150,7 @@ discard block |
||
158 | 150 | * @param string|null $database |
159 | 151 | * @return Select|SelectStatement |
160 | 152 | */ |
161 | - public function into(string $table, string $database = null) |
|
162 | - { |
|
153 | + public function into(string $table, string $database = null) { |
|
163 | 154 | return $this->buildSelect()->into($table, $database); |
164 | 155 | } |
165 | 156 | |
@@ -168,8 +159,7 @@ discard block |
||
168 | 159 | * |
169 | 160 | * @return Select|SelectStatement |
170 | 161 | */ |
171 | - public function select($columns = []) |
|
172 | - { |
|
162 | + public function select($columns = []) { |
|
173 | 163 | return $this->buildSelect()->select($columns); |
174 | 164 | } |
175 | 165 | |
@@ -187,8 +177,7 @@ discard block |
||
187 | 177 | * |
188 | 178 | * @return Select|SelectStatement |
189 | 179 | */ |
190 | - public function column($name) |
|
191 | - { |
|
180 | + public function column($name) { |
|
192 | 181 | return $this->buildSelect()->column($name); |
193 | 182 | } |
194 | 183 | |
@@ -209,8 +198,7 @@ discard block |
||
209 | 198 | * |
210 | 199 | * @return int|float |
211 | 200 | */ |
212 | - public function avg($column, bool $distinct = false) |
|
213 | - { |
|
201 | + public function avg($column, bool $distinct = false) { |
|
214 | 202 | return $this->buildSelect()->avg($column, $distinct); |
215 | 203 | } |
216 | 204 | |
@@ -220,8 +208,7 @@ discard block |
||
220 | 208 | * |
221 | 209 | * @return int|float |
222 | 210 | */ |
223 | - public function sum($column, bool $distinct = false) |
|
224 | - { |
|
211 | + public function sum($column, bool $distinct = false) { |
|
225 | 212 | return $this->buildSelect()->sum($column, $distinct); |
226 | 213 | } |
227 | 214 | |
@@ -231,8 +218,7 @@ discard block |
||
231 | 218 | * |
232 | 219 | * @return int|float |
233 | 220 | */ |
234 | - public function min($column, bool $distinct = false) |
|
235 | - { |
|
221 | + public function min($column, bool $distinct = false) { |
|
236 | 222 | return $this->buildSelect()->min($column, $distinct); |
237 | 223 | } |
238 | 224 | |
@@ -242,8 +228,7 @@ discard block |
||
242 | 228 | * |
243 | 229 | * @return int|float |
244 | 230 | */ |
245 | - public function max($column, bool $distinct = false) |
|
246 | - { |
|
231 | + public function max($column, bool $distinct = false) { |
|
247 | 232 | return $this->buildSelect()->max($column, $distinct); |
248 | 233 | } |
249 | 234 |
@@ -36,8 +36,7 @@ |
||
36 | 36 | * Class ConnectionException |
37 | 37 | * @package Platine\Database\Exception |
38 | 38 | */ |
39 | -class ConnectionException extends \Exception |
|
40 | -{ |
|
39 | +class ConnectionException extends \Exception { |
|
41 | 40 | |
42 | 41 | /** |
43 | 42 | * Throw when connection is not established |