LaravelFreelancerNL /
fluentaql
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | |||||
| 5 | namespace LaravelFreelancerNL\FluentAQL\Clauses; |
||||
| 6 | |||||
| 7 | use LaravelFreelancerNL\FluentAQL\Exceptions\ExpressionTypeException; |
||||
| 8 | use LaravelFreelancerNL\FluentAQL\Expressions\Expression; |
||||
| 9 | use LaravelFreelancerNL\FluentAQL\QueryBuilder; |
||||
| 10 | |||||
| 11 | class WindowClause extends Clause |
||||
| 12 | { |
||||
| 13 | /** |
||||
| 14 | * @var array<array-key, string>|object $offsets |
||||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||||
| 15 | */ |
||||
| 16 | protected array|object $offsets; |
||||
| 17 | |||||
| 18 | protected null|string|QueryBuilder|Expression $rangeValue; |
||||
| 19 | |||||
| 20 | /** |
||||
| 21 | * CollectClause constructor. |
||||
| 22 | * @param array<array-key, string>|object $offsets |
||||
|
0 ignored issues
–
show
|
|||||
| 23 | */ |
||||
| 24 | 4 | public function __construct( |
|||
| 25 | array|object $offsets, |
||||
| 26 | null|string|QueryBuilder|Expression $rangeValue = null |
||||
| 27 | ) { |
||||
| 28 | 4 | parent::__construct(); |
|||
| 29 | |||||
| 30 | 4 | $this->offsets = $offsets; |
|||
| 31 | 4 | $this->rangeValue = $rangeValue; |
|||
| 32 | } |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * @throws ExpressionTypeException |
||||
| 36 | */ |
||||
| 37 | 4 | public function compile(QueryBuilder $queryBuilder): string |
|||
| 38 | { |
||||
| 39 | 4 | $this->offsets = $queryBuilder->normalizeArgument( |
|||
| 40 | 4 | $this->offsets, |
|||
| 41 | 4 | ['List', 'Reference', 'Function', 'Query', 'Bind'], |
|||
| 42 | ); |
||||
| 43 | |||||
| 44 | 4 | if (isset($this->rangeValue)) { |
|||
| 45 | 3 | $this->rangeValue = $queryBuilder->normalizeArgument( |
|||
| 46 | 3 | $this->rangeValue, |
|||
| 47 | 3 | ['Reference', 'Function', 'Query', 'Bind'], |
|||
| 48 | ); |
||||
| 49 | } |
||||
| 50 | |||||
| 51 | 4 | $output = 'WINDOW'; |
|||
| 52 | 4 | if (isset($this->rangeValue)) { |
|||
| 53 | /** @phpstan-ignore-next-line */ |
||||
| 54 | 3 | $output .= ' ' . $this->rangeValue->compile($queryBuilder); |
|||
|
0 ignored issues
–
show
The method
compile() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||
| 55 | 3 | $output .= ' WITH'; |
|||
| 56 | } |
||||
| 57 | 4 | $output .= ' ' . $this->offsets->compile($queryBuilder); |
|||
| 58 | |||||
| 59 | 4 | return $output; |
|||
| 60 | } |
||||
| 61 | } |
||||
| 62 |