12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace yii\db\conditions;
- use yii\base\InvalidArgumentException;
- class SimpleCondition implements ConditionInterface
- {
-
- private $operator;
-
- private $column;
-
- private $value;
-
- public function __construct($column, $operator, $value)
- {
- $this->column = $column;
- $this->operator = $operator;
- $this->value = $value;
- }
-
- public function getOperator()
- {
- return $this->operator;
- }
-
- public function getColumn()
- {
- return $this->column;
- }
-
- public function getValue()
- {
- return $this->value;
- }
-
- public static function fromArrayDefinition($operator, $operands)
- {
- if (count($operands) !== 2) {
- throw new InvalidArgumentException("Operator '$operator' requires two operands.");
- }
- return new static($operands[0], $operator, $operands[1]);
- }
- }
|