AST
9 months ago
Exec
9 months ago
Expr
9 months ago
Filter
9 months ago
Expr.php
9 months ago
FilterCollection.php
9 months ago
Lexer.php
9 months ago
OutputWalker.php
9 months ago
Parameter.php
9 months ago
ParameterTypeInferer.php
9 months ago
Parser.php
9 months ago
ParserResult.php
9 months ago
Printer.php
9 months ago
QueryException.php
9 months ago
QueryExpressionVisitor.php
9 months ago
ResultSetMapping.php
9 months ago
ResultSetMappingBuilder.php
9 months ago
SqlOutputWalker.php
9 months ago
SqlWalker.php
9 months ago
TokenType.php
9 months ago
TreeWalker.php
9 months ago
TreeWalkerAdapter.php
9 months ago
TreeWalkerChain.php
9 months ago
TreeWalkerChainIterator.php
9 months ago
index.php
9 months ago
Parameter.php
44 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\ORM\Query; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use function trim; |
| 6 | class Parameter |
| 7 | { |
| 8 | public static function normalizeName($name) |
| 9 | { |
| 10 | return trim((string) $name, ':'); |
| 11 | } |
| 12 | private $name; |
| 13 | private $value; |
| 14 | private $type; |
| 15 | private $typeSpecified; |
| 16 | public function __construct($name, $value, $type = null) |
| 17 | { |
| 18 | $this->name = self::normalizeName($name); |
| 19 | $this->typeSpecified = $type !== null; |
| 20 | $this->setValue($value, $type); |
| 21 | } |
| 22 | public function getName() |
| 23 | { |
| 24 | return $this->name; |
| 25 | } |
| 26 | public function getValue() |
| 27 | { |
| 28 | return $this->value; |
| 29 | } |
| 30 | public function getType() |
| 31 | { |
| 32 | return $this->type; |
| 33 | } |
| 34 | public function setValue($value, $type = null) |
| 35 | { |
| 36 | $this->value = $value; |
| 37 | $this->type = $type ?: ParameterTypeInferer::inferType($value); |
| 38 | } |
| 39 | public function typeWasSpecified() : bool |
| 40 | { |
| 41 | return $this->typeSpecified; |
| 42 | } |
| 43 | } |
| 44 |