Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
condition.php
1<?php
13
21{
23 protected $column;
24
26 protected $operator;
27
29 protected $value;
30
39 {
40 $this->column = $column;
41 $this->operator = $operator;
42 $this->value = $value;
43 }
44
48 public function getColumn()
49 {
50 return $this->column;
51 }
52
56 public function setColumn($column)
57 {
58 $this->column = $column;
59 }
60
64 public function getOperator()
65 {
66 return $this->operator;
67 }
68
72 public function setOperator($operator)
73 {
74 $this->operator = $operator;
75 }
76
80 public function getValue()
81 {
82 return $this->value;
83 }
84
88 public function setValue($value)
89 {
90 $this->value = $value;
91 }
92
105 public function getAtomicValues()
106 {
107 if ($this->hasMultiValues())
108 {
109 return $this->value;
110 }
111
112 return array($this->value);
113 }
114
120 public function hasMultiValues()
121 {
122 return in_array($this->operator, array('in', 'between'), true) && is_array($this->value);
123 }
124
128 public function getDefinition()
129 {
130 return $this->getColumn();
131 }
132
136 public function setDefinition($definition)
137 {
138 $this->setColumn($definition);
139 }
140
141 public function __clone()
142 {
143 // clone value if there any filter expressions
144 $newValues = array();
145
146 foreach ($this->getAtomicValues() as $atomicValue)
147 {
148 $newValues[] = ($atomicValue instanceof FilterExpression) ? clone $atomicValue : $atomicValue;
149 }
150
151 $this->value = $this->hasMultiValues() ? $newValues : $newValues[0];
152
153 // clone field
154 if ($this->column instanceof Field)
155 {
156 $this->column = clone $this->column;
157 }
158 }
159}
__construct($column, $operator, $value)
Definition condition.php:38