PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.1.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.1.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpexcel / Classes / PHPExcel / Style / Conditional.php

Conditional.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.1.0, at vendor/phpoffice/phpexcel/Classes/PHPExcel/Style/Conditional.php

294 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PHPExcel
4 *
5 * Copyright (c) 2006 - 2015 PHPExcel
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 * @category PHPExcel
22 * @package PHPExcel_Style
23 * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25 * @version ##VERSION##, ##DATE##
26 */
27
28
29 /**
30 * PHPExcel_Style_Conditional
31 *
32 * @category PHPExcel
33 * @package PHPExcel_Style
34 * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
35 */
36 class PHPExcel_Style_Conditional implements PHPExcel_IComparable
37 {
38 /* Condition types */
39 const CONDITION_NONE = 'none';
40 const CONDITION_CELLIS = 'cellIs';
41 const CONDITION_CONTAINSTEXT = 'containsText';
42 const CONDITION_EXPRESSION = 'expression';
43
44 /* Operator types */
45 const OPERATOR_NONE = '';
46 const OPERATOR_BEGINSWITH = 'beginsWith';
47 const OPERATOR_ENDSWITH = 'endsWith';
48 const OPERATOR_EQUAL = 'equal';
49 const OPERATOR_GREATERTHAN = 'greaterThan';
50 const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
51 const OPERATOR_LESSTHAN = 'lessThan';
52 const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
53 const OPERATOR_NOTEQUAL = 'notEqual';
54 const OPERATOR_CONTAINSTEXT = 'containsText';
55 const OPERATOR_NOTCONTAINS = 'notContains';
56 const OPERATOR_BETWEEN = 'between';
57
58 /**
59 * Condition type
60 *
61 * @var int
62 */
63 private $conditionType;
64
65 /**
66 * Operator type
67 *
68 * @var int
69 */
70 private $operatorType;
71
72 /**
73 * Text
74 *
75 * @var string
76 */
77 private $text;
78
79 /**
80 * Condition
81 *
82 * @var string[]
83 */
84 private $condition = array();
85
86 /**
87 * Style
88 *
89 * @var PHPExcel_Style
90 */
91 private $style;
92
93 /**
94 * Create a new PHPExcel_Style_Conditional
95 */
96 public function __construct()
97 {
98 // Initialise values
99 $this->conditionType = PHPExcel_Style_Conditional::CONDITION_NONE;
100 $this->operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
101 $this->text = null;
102 $this->condition = array();
103 $this->style = new PHPExcel_Style(false, true);
104 }
105
106 /**
107 * Get Condition type
108 *
109 * @return string
110 */
111 public function getConditionType()
112 {
113 return $this->conditionType;
114 }
115
116 /**
117 * Set Condition type
118 *
119 * @param string $pValue PHPExcel_Style_Conditional condition type
120 * @return PHPExcel_Style_Conditional
121 */
122 public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE)
123 {
124 $this->conditionType = $pValue;
125 return $this;
126 }
127
128 /**
129 * Get Operator type
130 *
131 * @return string
132 */
133 public function getOperatorType()
134 {
135 return $this->operatorType;
136 }
137
138 /**
139 * Set Operator type
140 *
141 * @param string $pValue PHPExcel_Style_Conditional operator type
142 * @return PHPExcel_Style_Conditional
143 */
144 public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE)
145 {
146 $this->operatorType = $pValue;
147 return $this;
148 }
149
150 /**
151 * Get text
152 *
153 * @return string
154 */
155 public function getText()
156 {
157 return $this->text;
158 }
159
160 /**
161 * Set text
162 *
163 * @param string $value
164 * @return PHPExcel_Style_Conditional
165 */
166 public function setText($value = null)
167 {
168 $this->text = $value;
169 return $this;
170 }
171
172 /**
173 * Get Condition
174 *
175 * @deprecated Deprecated, use getConditions instead
176 * @return string
177 */
178 public function getCondition()
179 {
180 if (isset($this->condition[0])) {
181 return $this->condition[0];
182 }
183
184 return '';
185 }
186
187 /**
188 * Set Condition
189 *
190 * @deprecated Deprecated, use setConditions instead
191 * @param string $pValue Condition
192 * @return PHPExcel_Style_Conditional
193 */
194 public function setCondition($pValue = '')
195 {
196 if (!is_array($pValue)) {
197 $pValue = array($pValue);
198 }
199
200 return $this->setConditions($pValue);
201 }
202
203 /**
204 * Get Conditions
205 *
206 * @return string[]
207 */
208 public function getConditions()
209 {
210 return $this->condition;
211 }
212
213 /**
214 * Set Conditions
215 *
216 * @param string[] $pValue Condition
217 * @return PHPExcel_Style_Conditional
218 */
219 public function setConditions($pValue)
220 {
221 if (!is_array($pValue)) {
222 $pValue = array($pValue);
223 }
224 $this->condition = $pValue;
225 return $this;
226 }
227
228 /**
229 * Add Condition
230 *
231 * @param string $pValue Condition
232 * @return PHPExcel_Style_Conditional
233 */
234 public function addCondition($pValue = '')
235 {
236 $this->condition[] = $pValue;
237 return $this;
238 }
239
240 /**
241 * Get Style
242 *
243 * @return PHPExcel_Style
244 */
245 public function getStyle()
246 {
247 return $this->style;
248 }
249
250 /**
251 * Set Style
252 *
253 * @param PHPExcel_Style $pValue
254 * @throws PHPExcel_Exception
255 * @return PHPExcel_Style_Conditional
256 */
257 public function setStyle(PHPExcel_Style $pValue = null)
258 {
259 $this->style = $pValue;
260 return $this;
261 }
262
263 /**
264 * Get hash code
265 *
266 * @return string Hash code
267 */
268 public function getHashCode()
269 {
270 return md5(
271 $this->conditionType .
272 $this->operatorType .
273 implode(';', $this->condition) .
274 $this->style->getHashCode() .
275 __CLASS__
276 );
277 }
278
279 /**
280 * Implement PHP __clone to create a deep clone, not just a shallow copy.
281 */
282 public function __clone()
283 {
284 $vars = get_object_vars($this);
285 foreach ($vars as $key => $value) {
286 if (is_object($value)) {
287 $this->$key = clone $value;
288 } else {
289 $this->$key = $value;
290 }
291 }
292 }
293 }
294