Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class QueryAsTable implements ITable |
||
10 | { |
||
11 | protected IQueryPart|string $query; |
||
12 | |||
13 | protected string $alias; |
||
14 | |||
15 | /** |
||
16 | * TableQuery constructor. |
||
17 | * |
||
18 | * @param IQueryPart|string $query |
||
19 | * @param string $alias |
||
20 | */ |
||
21 | 4 | public function __construct(IQueryPart|string $query, string $alias) |
|
22 | { |
||
23 | 4 | $this->query = $query; |
|
24 | 4 | $this->alias = $alias; |
|
25 | 4 | } |
|
26 | |||
27 | /** |
||
28 | * @return string |
||
29 | */ |
||
30 | 3 | public function __toString(): string |
|
31 | { |
||
32 | 3 | return sprintf('(%s) AS %s', (string)$this->query, $this->alias); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return array |
||
37 | */ |
||
38 | 3 | public function getParams(): array |
|
45 | } |
||
46 | } |
||
47 |