vendor/doctrine/orm/src/Query/Expr/Comparison.php line 12

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\ORM\Query\Expr;
  4. /**
  5. * Expression class for DQL comparison expressions.
  6. *
  7. * @link www.doctrine-project.org
  8. */
  9. class Comparison
  10. {
  11. public const EQ = '=';
  12. public const NEQ = '<>';
  13. public const LT = '<';
  14. public const LTE = '<=';
  15. public const GT = '>';
  16. public const GTE = '>=';
  17. /** @var mixed */
  18. protected $leftExpr;
  19. /** @var string */
  20. protected $operator;
  21. /** @var mixed */
  22. protected $rightExpr;
  23. /**
  24. * Creates a comparison expression with the given arguments.
  25. *
  26. * @param mixed $leftExpr
  27. * @param string $operator
  28. * @param mixed $rightExpr
  29. */
  30. public function __construct($leftExpr, $operator, $rightExpr)
  31. {
  32. $this->leftExpr = $leftExpr;
  33. $this->operator = $operator;
  34. $this->rightExpr = $rightExpr;
  35. }
  36. /** @return mixed */
  37. public function getLeftExpr()
  38. {
  39. return $this->leftExpr;
  40. }
  41. /** @return string */
  42. public function getOperator()
  43. {
  44. return $this->operator;
  45. }
  46. /** @return mixed */
  47. public function getRightExpr()
  48. {
  49. return $this->rightExpr;
  50. }
  51. /** @return string */
  52. public function __toString()
  53. {
  54. return $this->leftExpr . ' ' . $this->operator . ' ' . $this->rightExpr;
  55. }
  56. }