| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 87.5% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class Join implements IJoin |
||
| 10 | { |
||
| 11 | public string $type; |
||
| 12 | public string $tableName; |
||
| 13 | public string|IQueryPart $on; |
||
| 14 | public ?string $alias; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Join constructor. |
||
| 18 | * |
||
| 19 | * @param string $type |
||
| 20 | * @param string $tableName |
||
| 21 | * @param string|IQueryPart $on |
||
| 22 | * @param string|null $alias |
||
| 23 | */ |
||
| 24 | 26 | public function __construct(string $type, string $tableName, string|IQueryPart $on, ?string $alias = null) |
|
| 25 | { |
||
| 26 | 26 | if (!in_array($type, IJoin::VALID_TYPES)) { |
|
| 27 | throw new \InvalidArgumentException(sprintf('Invalid join type: %s', $type)); |
||
| 28 | } |
||
| 29 | |||
| 30 | 26 | $this->type = $type; |
|
| 31 | 26 | $this->tableName = $tableName; |
|
| 32 | 26 | $this->on = $on; |
|
| 33 | 26 | $this->alias = $alias; |
|
| 34 | 26 | } |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | 23 | public function __toString(): string |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return array |
||
| 50 | */ |
||
| 51 | 5 | public function getParams(): array |
|
| 60 |