123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
-
-
- namespace Doctrine\ORM\Query\Expr;
-
-
- class Math
- {
- private $_leftExpr;
- private $_operator;
- private $_rightExpr;
-
- public function __construct($leftExpr, $operator, $rightExpr)
- {
- $this->_leftExpr = $leftExpr;
- $this->_operator = $operator;
- $this->_rightExpr = $rightExpr;
- }
-
- public function __toString()
- {
-
- $leftExpr = (string) $this->_leftExpr;
-
- if ($this->_leftExpr instanceof Math) {
- $leftExpr = '(' . $leftExpr . ')';
- }
-
-
- $rightExpr = (string) $this->_rightExpr;
-
- if ($this->_rightExpr instanceof Math) {
- $rightExpr = '(' . $rightExpr . ')';
- }
-
- return $leftExpr . ' ' . $this->_operator . ' ' . $rightExpr;
- }
- }
|