1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace LaravelFreelancerNL\FluentAQL\Clauses; |
||
6 | |||
7 | use LaravelFreelancerNL\FluentAQL\Expressions\Expression; |
||
8 | use LaravelFreelancerNL\FluentAQL\QueryBuilder; |
||
9 | |||
10 | class TraverseClause extends Clause |
||
11 | { |
||
12 | protected string|QueryBuilder|Expression $direction; |
||
13 | |||
14 | protected string|QueryBuilder|Expression $startVertex; |
||
15 | |||
16 | protected null|string|QueryBuilder|Expression $toVertex; |
||
17 | |||
18 | /** |
||
19 | * TraverseClause constructor. |
||
20 | * |
||
21 | * @SuppressWarnings(PHPMD.BooleanArgumentFlag) |
||
22 | */ |
||
23 | 5 | public function __construct( |
|
24 | string|QueryBuilder|Expression $startVertex, |
||
25 | string|QueryBuilder|Expression $direction = 'outbound', |
||
26 | string|QueryBuilder|Expression $toVertex = null |
||
27 | ) { |
||
28 | 5 | $this->direction = $direction; |
|
29 | 5 | $this->startVertex = $startVertex; |
|
30 | 5 | $this->toVertex = $toVertex; |
|
31 | } |
||
32 | |||
33 | 5 | public function compile(QueryBuilder $queryBuilder): string |
|
34 | { |
||
35 | 5 | $this->startVertex = $queryBuilder->normalizeArgument($this->startVertex, 'Id'); |
|
36 | 5 | $this->direction = $queryBuilder->normalizeArgument($this->direction, 'GraphDirection'); |
|
37 | |||
38 | 5 | if ($this->toVertex !== null) { |
|
39 | 3 | $this->toVertex = $queryBuilder->normalizeArgument($this->toVertex, 'Id'); |
|
40 | } |
||
41 | |||
42 | |||
43 | 5 | $output = $this->direction->compile($queryBuilder); |
|
44 | |||
45 | 5 | $output .= $this->traverseType(); |
|
46 | |||
47 | 5 | $output .= ' ' . $this->startVertex->compile($queryBuilder); |
|
48 | 5 | if (isset($this->toVertex)) { |
|
49 | 3 | $output .= ' TO ' . $this->toVertex->compile($queryBuilder); |
|
0 ignored issues
–
show
|
|||
50 | } |
||
51 | |||
52 | 5 | return $output; |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * Default path type |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 2 | protected function traverseType(): string |
|
61 | { |
||
62 | 2 | return ''; |
|
63 | } |
||
64 | } |
||
65 |
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.