ConjunctionCondition.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\db\conditions;
  8. /**
  9. * Class ConjunctionCondition
  10. *
  11. * @author Dmytro Naumenko <d.naumenko.a@gmail.com>
  12. * @since 2.0.14
  13. */
  14. abstract class ConjunctionCondition implements ConditionInterface
  15. {
  16. /**
  17. * @var mixed[]
  18. */
  19. protected $expressions;
  20. /**
  21. * @param mixed $expressions
  22. */
  23. public function __construct($expressions) // TODO: use variadic params when PHP>5.6
  24. {
  25. $this->expressions = $expressions;
  26. }
  27. /**
  28. * @return mixed[]
  29. */
  30. public function getExpressions()
  31. {
  32. return $this->expressions;
  33. }
  34. /**
  35. * Returns the operator that is represented by this condition class, e.g. `AND`, `OR`.
  36. * @return string
  37. */
  38. abstract public function getOperator();
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public static function fromArrayDefinition($operator, $operands)
  43. {
  44. return new static($operands);
  45. }
  46. }