| Total Complexity | 8 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 8 | trait TableTrait |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string[] |
||
| 12 | */ |
||
| 13 | protected $table = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param string[]|string $table |
||
| 17 | * @param bool $clearAll |
||
| 18 | * |
||
| 19 | * @return $this |
||
| 20 | * @throws QueryBuilderException |
||
| 21 | */ |
||
| 22 | public function table($table, bool $clearAll = false) |
||
| 23 | { |
||
| 24 | if (empty($table)) { |
||
| 25 | throw new QueryBuilderException('You must pass $table to table method!'); |
||
| 26 | } |
||
| 27 | |||
| 28 | if (!\is_array($table)) { |
||
| 29 | $table = [$table]; |
||
| 30 | } |
||
| 31 | |||
| 32 | if ($clearAll == true) { |
||
|
|
|||
| 33 | $this->table = $table; |
||
| 34 | } else { |
||
| 35 | $this->table = \array_merge($this->table, $table); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $this; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return null|string |
||
| 43 | */ |
||
| 44 | protected function buildTableQueryPart(): ?string |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return null|string |
||
| 51 | */ |
||
| 52 | protected function buildFromQueryPart(): ?string |
||
| 57 | ; |
||
| 58 | } |
||
| 60 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.