File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace WikibaseSolutions \CypherDSL \Clauses ;
4
+
5
+ /**
6
+ * This class represents the union clause.
7
+ *
8
+ * @see https://neo4j.com/docs/cypher-manual/current/clauses/union/
9
+ */
10
+ class UnionClause extends Clause
11
+ {
12
+ /** @var bool Whether the union should include all results or remove the duplicates instead. */
13
+ private bool $ all ;
14
+
15
+ /**
16
+ * @param bool $all Whether the union should include all results or remove the duplicates instead.
17
+ */
18
+ public function __construct (bool $ all = false )
19
+ {
20
+ $ this ->all = $ all ;
21
+ }
22
+
23
+ /**
24
+ * Returns whether the union includes all results or removes the duplicates instead.
25
+ *
26
+ * @return bool
27
+ */
28
+ public function includesAll (): bool
29
+ {
30
+ return $ this ->all ;
31
+ }
32
+
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ public function canBeEmpty (): bool
37
+ {
38
+ return true ;
39
+ }
40
+
41
+ /**
42
+ * @inheritDoc
43
+ */
44
+ protected function getSubject (): string
45
+ {
46
+ return 'UNION ' ;
47
+ }
48
+
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ protected function getClause (): string
53
+ {
54
+ return $ this ->all ? 'ALL ' : '' ;
55
+ }
56
+ }
You can’t perform that action at this time.
0 commit comments