summaryrefslogtreecommitdiff
path: root/vendor/doctrine/collections/src/Expr/ExpressionVisitor.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
committerpolo <ordipolo@gmx.fr>2024-08-13 23:45:21 +0200
commitbf6655a534a6775d30cafa67bd801276bda1d98d (patch)
treec6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/collections/src/Expr/ExpressionVisitor.php
parent94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff)
downloadAppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/collections/src/Expr/ExpressionVisitor.php')
-rw-r--r--vendor/doctrine/collections/src/Expr/ExpressionVisitor.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/doctrine/collections/src/Expr/ExpressionVisitor.php b/vendor/doctrine/collections/src/Expr/ExpressionVisitor.php
new file mode 100644
index 0000000..afbd3d1
--- /dev/null
+++ b/vendor/doctrine/collections/src/Expr/ExpressionVisitor.php
@@ -0,0 +1,52 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\Common\Collections\Expr;
6
7use RuntimeException;
8
9/**
10 * An Expression visitor walks a graph of expressions and turns them into a
11 * query for the underlying implementation.
12 */
13abstract class ExpressionVisitor
14{
15 /**
16 * Converts a comparison expression into the target query language output.
17 *
18 * @return mixed
19 */
20 abstract public function walkComparison(Comparison $comparison);
21
22 /**
23 * Converts a value expression into the target query language part.
24 *
25 * @return mixed
26 */
27 abstract public function walkValue(Value $value);
28
29 /**
30 * Converts a composite expression into the target query language output.
31 *
32 * @return mixed
33 */
34 abstract public function walkCompositeExpression(CompositeExpression $expr);
35
36 /**
37 * Dispatches walking an expression to the appropriate handler.
38 *
39 * @return mixed
40 *
41 * @throws RuntimeException
42 */
43 public function dispatch(Expression $expr)
44 {
45 return match (true) {
46 $expr instanceof Comparison => $this->walkComparison($expr),
47 $expr instanceof Value => $this->walkValue($expr),
48 $expr instanceof CompositeExpression => $this->walkCompositeExpression($expr),
49 default => throw new RuntimeException('Unknown Expression ' . $expr::class),
50 };
51 }
52}