Skip to content

Commit 7cc5f5f

Browse files
committed
added getters to Clauses
1 parent caa0b23 commit 7cc5f5f

14 files changed

+211
-1
lines changed

src/Clauses/CallProcedureClause.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,36 @@ public function setProcedure(string $procedure): self
6464
return $this;
6565
}
6666

67+
/**
68+
* Returns the variables to yield.
69+
*
70+
* @return Variable[]
71+
*/
72+
public function getYieldVariables(): array
73+
{
74+
return $this->yieldVariables;
75+
}
76+
77+
/**
78+
* Returns the procedure to call.
79+
*
80+
* @return string|null
81+
*/
82+
public function getProcedure(): ?string
83+
{
84+
return $this->procedure;
85+
}
86+
87+
/**
88+
* Returns the arguments of the procedure.
89+
*
90+
* @return AnyType[]
91+
*/
92+
public function getArguments(): array
93+
{
94+
return $this->arguments;
95+
}
96+
6797
/**
6898
* Sets the arguments to pass to this procedure call. This overwrites any previously passed
6999
* arguments.

src/Clauses/CreateClause.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public function addPattern(StructuralType $pattern): self
4848
return $this;
4949
}
5050

51+
/**
52+
* Returns the patterns of the create clause.
53+
*
54+
* @return StructuralType[]
55+
*/
56+
public function getPatterns(): array
57+
{
58+
return $this->patterns;
59+
}
60+
5161
/**
5262
* @inheritDoc
5363
*/

src/Clauses/DeleteClause.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,26 @@ public function addNode(NodeType $node): self
7272
return $this;
7373
}
7474

75+
/**
76+
* Returns whether the deletion detaches the relationships.
77+
*
78+
* @return bool
79+
*/
80+
public function detachesDeletion(): bool
81+
{
82+
return $this->detach;
83+
}
84+
85+
/**
86+
* Returns the nodes to delete.
87+
*
88+
* @return AnyType[]
89+
*/
90+
public function getNodes(): array
91+
{
92+
return $this->nodes;
93+
}
94+
7595
/**
7696
* @inheritDoc
7797
*/

src/Clauses/LimitClause.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class LimitClause extends Clause
3737
*/
3838
private ?NumeralType $limit;
3939

40+
/**
41+
* Returns the actual limit of the clause.
42+
*
43+
* @return NumeralType|null
44+
*/
45+
public function getLimit(): ?NumeralType
46+
{
47+
return $this->limit;
48+
}
49+
4050
/**
4151
* Sets the expression that returns the limit.
4252
*

src/Clauses/MatchClause.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ class MatchClause extends Clause
3535
*/
3636
private array $patterns = [];
3737

38+
/**
39+
* Returns the patterns to match.
40+
*
41+
* @return StructuralType[]
42+
*/
43+
public function getPatterns(): array
44+
{
45+
return $this->patterns;
46+
}
47+
3848
/**
3949
* Add a pattern to the match clause.
4050
*

src/Clauses/MergeClause.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,36 @@ class MergeClause extends Clause
4545
*/
4646
private ?Clause $matchClause;
4747

48+
/**
49+
* Returns the clause to execute when the pattern is matched.
50+
*
51+
* @return Clause|null
52+
*/
53+
public function getOnCreateClause(): ?Clause
54+
{
55+
return $this->createClause;
56+
}
57+
58+
/**
59+
* Returns the clause to execute when the pattern is matched.
60+
*
61+
* @return Clause|null
62+
*/
63+
public function getOnMatchClause(): ?Clause
64+
{
65+
return $this->matchClause;
66+
}
67+
68+
/**
69+
* Returns the pattern to MERGE.
70+
*
71+
* @return StructuralType|null
72+
*/
73+
public function getPattern(): ?StructuralType
74+
{
75+
return $this->pattern;
76+
}
77+
4878
/**
4979
* Sets the pattern to merge.
5080
*

src/Clauses/OptionalMatchClause.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ class OptionalMatchClause extends Clause
3535
*/
3636
private array $patterns = [];
3737

38+
/**
39+
* Returns the patterns to optionally match.
40+
*
41+
* @return StructuralType[]
42+
*/
43+
public function getPatterns(): array
44+
{
45+
return $this->patterns;
46+
}
47+
3848
/**
3949
* Add a pattern to the optional match clause.
4050
*

src/Clauses/OrderByClause.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ public function addProperty(Property $property): self
5757
return $this;
5858
}
5959

60+
/**
61+
* Returns the properties to order.
62+
*
63+
* @return Property[]
64+
*/
65+
public function getProperties(): array
66+
{
67+
return $this->properties;
68+
}
69+
70+
/**
71+
* Returns whether the ordering is in descending order.
72+
*
73+
* @return bool
74+
*/
75+
public function isDescending(): bool
76+
{
77+
return $this->descending;
78+
}
79+
6080
/**
6181
* Set to sort in a DESCENDING order.
6282
*

src/Clauses/RemoveClause.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ class RemoveClause extends Clause
3838
*/
3939
private array $expressions = [];
4040

41+
/**
42+
* Returns the expressions in the REMOVE clause.
43+
*
44+
* @return Label[]|Property[]
45+
*/
46+
public function getExpressions(): array
47+
{
48+
return $this->expressions;
49+
}
50+
4151
/**
4252
* Add an expression to the REMOVE clause. This expression usually returns a property (a.b) or a label (a:b).
4353
*

src/Clauses/ReturnClause.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ReturnClause extends Clause
3939
private bool $distinct = false;
4040

4141
/**
42-
* @var array The expressions to return
42+
* @var AnyType[] The expressions to return
4343
*/
4444
private array $columns = [];
4545

@@ -57,6 +57,26 @@ public function setDistinct(bool $distinct = true): self
5757
return $this;
5858
}
5959

60+
/**
61+
* Returns the columns to return. Aliased columns have string keys instead of integers.
62+
*
63+
* @return AnyType[]
64+
*/
65+
public function getColumns(): array
66+
{
67+
return $this->columns;
68+
}
69+
70+
/**
71+
* Returns whether the returned results are distinct.
72+
*
73+
* @return bool
74+
*/
75+
public function isDistinct(): bool
76+
{
77+
return $this->distinct;
78+
}
79+
6080
/**
6181
* Add a new column to this RETURN clause.
6282
*

0 commit comments

Comments
 (0)