summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Query/AST/InputParameter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/src/Query/AST/InputParameter.php')
-rw-r--r--vendor/doctrine/orm/src/Query/AST/InputParameter.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Query/AST/InputParameter.php b/vendor/doctrine/orm/src/Query/AST/InputParameter.php
new file mode 100644
index 0000000..a8e0a3b
--- /dev/null
+++ b/vendor/doctrine/orm/src/Query/AST/InputParameter.php
@@ -0,0 +1,35 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Query\AST;
6
7use Doctrine\ORM\Query\QueryException;
8use Doctrine\ORM\Query\SqlWalker;
9
10use function is_numeric;
11use function strlen;
12use function substr;
13
14class InputParameter extends Node
15{
16 public bool $isNamed;
17 public string $name;
18
19 /** @throws QueryException */
20 public function __construct(string $value)
21 {
22 if (strlen($value) === 1) {
23 throw QueryException::invalidParameterFormat($value);
24 }
25
26 $param = substr($value, 1);
27 $this->isNamed = ! is_numeric($param);
28 $this->name = $param;
29 }
30
31 public function dispatch(SqlWalker $walker): string
32 {
33 return $walker->walkInputParameter($this);
34 }
35}