diff options
Diffstat (limited to 'vendor/doctrine/orm/src/Query/AST/InputParameter.php')
| -rw-r--r-- | vendor/doctrine/orm/src/Query/AST/InputParameter.php | 35 |
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 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\ORM\Query\AST; | ||
| 6 | |||
| 7 | use Doctrine\ORM\Query\QueryException; | ||
| 8 | use Doctrine\ORM\Query\SqlWalker; | ||
| 9 | |||
| 10 | use function is_numeric; | ||
| 11 | use function strlen; | ||
| 12 | use function substr; | ||
| 13 | |||
| 14 | class 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 | } | ||
