Skip to content

Commit caa0b23

Browse files
committed
added skip clause
1 parent fe8d322 commit caa0b23

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

src/Clauses/SkipClause.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
/*
4+
* Cypher DSL
5+
* Copyright (C) 2021 Wikibase Solutions
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20+
*/
21+
22+
namespace WikibaseSolutions\CypherDSL\Clauses;
23+
24+
use WikibaseSolutions\CypherDSL\Types\PropertyTypes\NumeralType;
25+
26+
/**
27+
* This class represents a LIMIT clause.
28+
*
29+
* @see https://neo4j.com/docs/cypher-manual/current/clauses/limit/
30+
*/
31+
class SkipClause extends Clause
32+
{
33+
/**
34+
* The expression of the LIMIT statement.
35+
*
36+
* @var NumeralType|null $skip
37+
*/
38+
private ?NumeralType $skip;
39+
40+
/**
41+
* Sets the expression that returns the limit.
42+
*
43+
* @param NumeralType $limit The limit
44+
* @return SkipClause
45+
*/
46+
public function setSkip(NumeralType $limit): self
47+
{
48+
$this->skip = $limit;
49+
50+
return $this;
51+
}
52+
53+
/**
54+
* @inheritDoc
55+
*/
56+
protected function getClause(): string
57+
{
58+
return "SKIP";
59+
}
60+
61+
/**
62+
* @inheritDoc
63+
*/
64+
protected function getSubject(): string
65+
{
66+
if (isset($this->skip)) {
67+
return $this->skip->toQuery();
68+
}
69+
70+
return "";
71+
}
72+
}

0 commit comments

Comments
 (0)