Skip to content

Commit 1a89c2f

Browse files
authored
Review (parts 2). Without folder QueryBuilder (#514)
1 parent ab49a2d commit 1a89c2f

3 files changed

Lines changed: 59 additions & 58 deletions

File tree

src/Query/Query.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,18 @@ class Query implements QueryInterface
6767
protected array $groupBy = [];
6868
protected array|ExpressionInterface|string|null $having = null;
6969
protected array $join = [];
70-
private array $orderBy = [];
70+
protected array $orderBy = [];
7171
protected array $params = [];
7272
protected array $union = [];
7373
protected array $withQueries = [];
74+
protected Closure|string|null $indexBy = null;
75+
protected ExpressionInterface|int|null $limit = null;
76+
protected ExpressionInterface|int|null $offset = null;
77+
protected array|string|ExpressionInterface|null $where = null;
78+
7479
private bool $emulateExecution = false;
75-
private Closure|string|null $indexBy = null;
76-
private ExpressionInterface|int|null $limit = null;
77-
private ExpressionInterface|int|null $offset = null;
78-
private array|string|ExpressionInterface|null $where = null;
7980

80-
public function __construct(private ConnectionInterface $db)
81+
public function __construct(protected ConnectionInterface $db)
8182
{
8283
}
8384

src/Schema/AbstractColumnSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ protected function typecast(mixed $value): mixed
254254

255255
if (
256256
$value === null
257-
|| gettype($value) === $this->phpType
258257
|| $value instanceof ExpressionInterface
258+
|| gettype($value) === $this->phpType
259259
) {
260260
return $value;
261261
}

src/Schema/AbstractColumnSchemaBuilder.php

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,56 @@ public function asString(): string
176176
return $this->buildCompleteString($format);
177177
}
178178

179+
public function getType(): string|null
180+
{
181+
return $this->type;
182+
}
183+
184+
public function getLength(): array|int|string|null
185+
{
186+
return $this->length;
187+
}
188+
189+
public function isNotNull(): bool|null
190+
{
191+
return $this->isNotNull;
192+
}
193+
194+
public function isUnique(): bool
195+
{
196+
return $this->isUnique;
197+
}
198+
199+
public function getCheck(): string|null
200+
{
201+
return $this->check;
202+
}
203+
204+
public function getDefault(): mixed
205+
{
206+
return $this->default;
207+
}
208+
209+
public function getAppend(): string|null
210+
{
211+
return $this->append;
212+
}
213+
214+
public function isUnsigned(): bool
215+
{
216+
return $this->isUnsigned;
217+
}
218+
219+
public function getCategoryMap(): array
220+
{
221+
return $this->categoryMap;
222+
}
223+
224+
public function getComment(): string|null
225+
{
226+
return $this->comment;
227+
}
228+
179229
/**
180230
* Builds the length, precision part of the column.
181231
*
@@ -228,7 +278,7 @@ protected function buildUniqueString(): string
228278
*
229279
* @return string|null string with default value of column.
230280
*/
231-
protected function buildDefaultValue()
281+
protected function buildDefaultValue(): string|null
232282
{
233283
if ($this->default === null) {
234284
return $this->isNotNull === false ? 'NULL' : null;
@@ -328,54 +378,4 @@ protected function buildCompleteString(string $format): string
328378

329379
return strtr($format, $placeholderValues);
330380
}
331-
332-
public function getType(): string|null
333-
{
334-
return $this->type;
335-
}
336-
337-
public function getLength(): array|int|string|null
338-
{
339-
return $this->length;
340-
}
341-
342-
public function isNotNull(): bool|null
343-
{
344-
return $this->isNotNull;
345-
}
346-
347-
public function isUnique(): bool
348-
{
349-
return $this->isUnique;
350-
}
351-
352-
public function getCheck(): string|null
353-
{
354-
return $this->check;
355-
}
356-
357-
public function getDefault(): mixed
358-
{
359-
return $this->default;
360-
}
361-
362-
public function getAppend(): string|null
363-
{
364-
return $this->append;
365-
}
366-
367-
public function isUnsigned(): bool
368-
{
369-
return $this->isUnsigned;
370-
}
371-
372-
public function getCategoryMap(): array
373-
{
374-
return $this->categoryMap;
375-
}
376-
377-
public function getComment(): string|null
378-
{
379-
return $this->comment;
380-
}
381381
}

0 commit comments

Comments
 (0)