123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace yii\db\conditions;
- use yii\base\InvalidArgumentException;
- class BetweenCondition implements ConditionInterface
- {
-
- private $operator;
-
- private $column;
-
- private $intervalStart;
-
- private $intervalEnd;
-
- public function __construct($column, $operator, $intervalStart, $intervalEnd)
- {
- $this->column = $column;
- $this->operator = $operator;
- $this->intervalStart = $intervalStart;
- $this->intervalEnd = $intervalEnd;
- }
-
- public function getOperator()
- {
- return $this->operator;
- }
-
- public function getColumn()
- {
- return $this->column;
- }
-
- public function getIntervalStart()
- {
- return $this->intervalStart;
- }
-
- public function getIntervalEnd()
- {
- return $this->intervalEnd;
- }
-
- public static function fromArrayDefinition($operator, $operands)
- {
- if (!isset($operands[0], $operands[1], $operands[2])) {
- throw new InvalidArgumentException("Operator '$operator' requires three operands.");
- }
- return new static($operands[0], $operator, $operands[1], $operands[2]);
- }
- }
|