diff options
Diffstat (limited to 'vendor/doctrine/orm/src/Query/AST/OrderByItem.php')
-rw-r--r-- | vendor/doctrine/orm/src/Query/AST/OrderByItem.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Query/AST/OrderByItem.php b/vendor/doctrine/orm/src/Query/AST/OrderByItem.php new file mode 100644 index 0000000..64b3f40 --- /dev/null +++ b/vendor/doctrine/orm/src/Query/AST/OrderByItem.php | |||
@@ -0,0 +1,38 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Query\AST; | ||
6 | |||
7 | use Doctrine\ORM\Query\SqlWalker; | ||
8 | |||
9 | use function strtoupper; | ||
10 | |||
11 | /** | ||
12 | * OrderByItem ::= (ResultVariable | StateFieldPathExpression) ["ASC" | "DESC"] | ||
13 | * | ||
14 | * @link www.doctrine-project.org | ||
15 | */ | ||
16 | class OrderByItem extends Node | ||
17 | { | ||
18 | public string $type; | ||
19 | |||
20 | public function __construct(public mixed $expression) | ||
21 | { | ||
22 | } | ||
23 | |||
24 | public function isAsc(): bool | ||
25 | { | ||
26 | return strtoupper($this->type) === 'ASC'; | ||
27 | } | ||
28 | |||
29 | public function isDesc(): bool | ||
30 | { | ||
31 | return strtoupper($this->type) === 'DESC'; | ||
32 | } | ||
33 | |||
34 | public function dispatch(SqlWalker $walker): string | ||
35 | { | ||
36 | return $walker->walkOrderByItem($this); | ||
37 | } | ||
38 | } | ||