Skip to content

Commit 271b66b

Browse files
committed
added getters of patterns
1 parent 5ef5c90 commit 271b66b

File tree

2 files changed

+129
-11
lines changed

2 files changed

+129
-11
lines changed

src/Patterns/Node.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,36 @@ class Node implements NodeType
5656
*/
5757
private ?MapType $properties;
5858

59+
/**
60+
* Returns the labels of the node.
61+
*
62+
* @return string[]
63+
*/
64+
public function getLabels(): array
65+
{
66+
return $this->labels;
67+
}
68+
69+
/**
70+
* Returns the properties added to the node.
71+
*
72+
* @return MapType|null
73+
*/
74+
public function getProperties(): ?MapType
75+
{
76+
return $this->properties;
77+
}
78+
79+
/**
80+
* Returns the variable name of the node.
81+
*
82+
* @return Variable|null
83+
*/
84+
public function getVariable(): ?Variable
85+
{
86+
return $this->variable;
87+
}
88+
5989
/**
6090
* Node constructor.
6191
*

src/Patterns/Path.php

Lines changed: 99 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class Path implements PathType
4444
use EscapeTrait;
4545
use PathTypeTrait;
4646

47-
const DIR_RIGHT = ["-", "->"];
48-
const DIR_LEFT = ["<-", "-"];
49-
const DIR_UNI = ["-", "-"];
47+
public const DIR_RIGHT = ["-", "->"];
48+
public const DIR_LEFT = ["<-", "-"];
49+
public const DIR_UNI = ["-", "-"];
5050

5151
/**
5252
* @var StructuralType The pattern left of the relationship
@@ -69,24 +69,24 @@ class Path implements PathType
6969
private array $types = [];
7070

7171
/**
72-
* @var Variable
72+
* @var ?Variable
7373
*/
74-
private Variable $variable;
74+
private ?Variable $variable;
7575

7676
/**
77-
* @var int The minimum number of `relationship->node` hops away to search
77+
* @var ?int The minimum number of `relationship->node` hops away to search
7878
*/
79-
private int $minHops;
79+
private ?int $minHops;
8080

8181
/**
82-
* @var int The maximum number of `relationship->node` hops away to search
82+
* @var ?int The maximum number of `relationship->node` hops away to search
8383
*/
84-
private int $maxHops;
84+
private ?int $maxHops;
8585

8686
/**
87-
* @var int The exact number of `relationship->node` hops away to search
87+
* @var ?int The exact number of `relationship->node` hops away to search
8888
*/
89-
private int $exactHops;
89+
private ?int $exactHops;
9090

9191
/**
9292
* @var MapType|null
@@ -322,4 +322,92 @@ private function conditionToString(): string
322322

323323
return sprintf("[%s]", $conditionInner);
324324
}
325+
326+
/**
327+
* @return MapType|null
328+
*/
329+
public function getProperties(): ?MapType
330+
{
331+
return $this->properties;
332+
}
333+
334+
/**
335+
* Returns the variable of the path.
336+
*
337+
* @return Variable
338+
*/
339+
public function getVariable(): ?Variable
340+
{
341+
return $this->variable;
342+
}
343+
344+
/**
345+
* Returns the left structure of the relationship.
346+
*
347+
* @return StructuralType
348+
*/
349+
public function getA(): StructuralType
350+
{
351+
return $this->a;
352+
}
353+
354+
/**
355+
* Returns the right structure of the relationship.
356+
*
357+
* @return StructuralType
358+
*/
359+
public function getB(): StructuralType
360+
{
361+
return $this->b;
362+
}
363+
364+
/**
365+
* Returns the direction of the path.
366+
*
367+
* @return string[]
368+
*/
369+
public function getDirection(): array
370+
{
371+
return $this->direction;
372+
}
373+
374+
/**
375+
* Returns the exact amount of hops configured.
376+
*
377+
* @return ?int
378+
*/
379+
public function getExactHops(): ?int
380+
{
381+
return $this->exactHops;
382+
}
383+
384+
/**
385+
* Returns the maximum amount of hops configured
386+
*
387+
* @return ?int
388+
*/
389+
public function getMaxHops(): ?int
390+
{
391+
return $this->maxHops;
392+
}
393+
394+
/**
395+
* Returns the minimum amount of hops configured.
396+
*
397+
* @return ?int
398+
*/
399+
public function getMinHops(): int
400+
{
401+
return $this->minHops;
402+
}
403+
404+
/**
405+
* Returns the types of the relationship.
406+
*
407+
* @return string[]
408+
*/
409+
public function getTypes(): array
410+
{
411+
return $this->types;
412+
}
325413
}

0 commit comments

Comments
 (0)