| 1 | <?php |
||
| 14 | class Select implements Query |
||
| 15 | { |
||
| 16 | use |
||
| 17 | EscaperAware, |
||
| 18 | Builders\Join, |
||
| 19 | Builders\Where, |
||
| 20 | Builders\GroupBy, |
||
| 21 | Builders\OrderBy, |
||
| 22 | Builders\Limit; |
||
| 23 | |||
| 24 | private |
||
| 25 | $select, |
||
|
1 ignored issue
–
show
|
|||
| 26 | $from, |
||
| 27 | $having; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param array[string|Selectable] | string|Selectable $columns |
||
| 31 | */ |
||
| 32 | 23 | public function __construct($columns = []) |
|
| 42 | |||
| 43 | 22 | public function toString(): string |
|
| 58 | |||
| 59 | /** |
||
| 60 | * @param Snippets\TableName|string $table |
||
| 61 | */ |
||
| 62 | 21 | public function from($table, ?string $alias = null): self |
|
| 68 | |||
| 69 | /** |
||
| 70 | * @param array[string|Selectable] | string|Selectable $columns |
||
| 71 | */ |
||
| 72 | 23 | public function select($columns): self |
|
| 78 | |||
| 79 | 1 | public function having(Condition $condition): self |
|
| 85 | |||
| 86 | 22 | private function buildSelect(): string |
|
| 90 | |||
| 91 | 20 | private function buildFrom(): string |
|
| 100 | |||
| 101 | 19 | private function buildHaving(): string |
|
| 107 | } |
||
| 108 |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.