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 | |||
8 | namespace yii\db\conditions; |
||
9 | |||
10 | use yii\base\InvalidArgumentException; |
||
11 | use yii\db\ExpressionInterface; |
||
12 | use yii\db\Query; |
||
13 | |||
14 | /** |
||
15 | * Class BetweenColumnCondition represents a `BETWEEN` condition where |
||
16 | * values is between two columns. For example: |
||
17 | * |
||
18 | * ```php |
||
19 | * new BetweenColumnsCondition(42, 'BETWEEN', 'min_value', 'max_value') |
||
20 | * // Will be build to: |
||
21 | * // 42 BETWEEN min_value AND max_value |
||
22 | * ``` |
||
23 | * |
||
24 | * And a more complex example: |
||
25 | * |
||
26 | * ```php |
||
27 | * new BetweenColumnsCondition( |
||
28 | * new Expression('NOW()'), |
||
29 | * 'NOT BETWEEN', |
||
30 | * (new Query)->select('time')->from('log')->orderBy('id ASC')->limit(1), |
||
31 | * 'update_time' |
||
32 | * ); |
||
33 | * |
||
34 | * // Will be built to: |
||
35 | * // NOW() NOT BETWEEN (SELECT time FROM log ORDER BY id ASC LIMIT 1) AND update_time |
||
36 | * ``` |
||
37 | * |
||
38 | * @author Dmytro Naumenko <[email protected]> |
||
39 | * @since 2.0.14 |
||
40 | */ |
||
41 | class BetweenColumnsCondition implements ConditionInterface |
||
42 | { |
||
43 | /** |
||
44 | * @var string $operator the operator to use (e.g. `BETWEEN` or `NOT BETWEEN`) |
||
45 | */ |
||
46 | private $operator; |
||
47 | /** |
||
48 | * @var mixed the value to compare against |
||
49 | */ |
||
50 | private $value; |
||
51 | /** |
||
52 | * @var string|ExpressionInterface|Query the column name or expression that is a beginning of the interval |
||
53 | */ |
||
54 | private $intervalStartColumn; |
||
55 | /** |
||
56 | * @var string|ExpressionInterface|Query the column name or expression that is an end of the interval |
||
57 | */ |
||
58 | private $intervalEndColumn; |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Creates a condition with the `BETWEEN` operator. |
||
63 | * |
||
64 | * @param mixed the value to compare against |
||
0 ignored issues
–
show
|
|||
65 | * @param string $operator the operator to use (e.g. `BETWEEN` or `NOT BETWEEN`) |
||
66 | * @param string|ExpressionInterface $intervalStartColumn the column name or expression that is a beginning of the interval |
||
67 | * @param string|ExpressionInterface $intervalEndColumn the column name or expression that is an end of the interval |
||
68 | */ |
||
69 | public function __construct($value, $operator, $intervalStartColumn, $intervalEndColumn) |
||
70 | { |
||
71 | $this->value = $value; |
||
72 | $this->operator = $operator; |
||
73 | $this->intervalStartColumn = $intervalStartColumn; |
||
74 | $this->intervalEndColumn = $intervalEndColumn; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return string |
||
79 | */ |
||
80 | 25 | public function getOperator() |
|
81 | { |
||
82 | 25 | return $this->operator; |
|
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return mixed |
||
87 | */ |
||
88 | 25 | public function getValue() |
|
89 | { |
||
90 | 25 | return $this->value; |
|
91 | } |
||
92 | |||
93 | /** |
||
94 | * @return string|ExpressionInterface|Query |
||
95 | */ |
||
96 | 25 | public function getIntervalStartColumn() |
|
97 | { |
||
98 | 25 | return $this->intervalStartColumn; |
|
99 | } |
||
100 | |||
101 | /** |
||
102 | * @return string|ExpressionInterface|Query |
||
103 | */ |
||
104 | 25 | public function getIntervalEndColumn() |
|
105 | { |
||
106 | 25 | return $this->intervalEndColumn; |
|
107 | } |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | * @throws InvalidArgumentException if wrong number of operands have been given. |
||
112 | */ |
||
113 | public static function fromArrayDefinition($operator, $operands) |
||
114 | { |
||
115 | if (!isset($operands[0], $operands[1], $operands[2])) { |
||
116 | throw new InvalidArgumentException("Operator '$operator' requires three operands."); |
||
117 | } |
||
118 | |||
119 | return new static($operands[0], $operator, $operands[1], $operands[2]); |
||
120 | } |
||
121 | } |
||
122 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths