Updated gui for user facility settings (#1327)
[openemr.git] / vendor / phpoffice / phpexcel / Classes / PHPExcel / Style / Conditional.php
blobaebf1e31333b219714edac922239a77bcbb7f98a
1 <?php
2 /**
3 * PHPExcel
5 * Copyright (c) 2006 - 2014 PHPExcel
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.
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.
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
21 * @category PHPExcel
22 * @package PHPExcel_Style
23 * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
24 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25 * @version ##VERSION##, ##DATE##
29 /**
30 * PHPExcel_Style_Conditional
32 * @category PHPExcel
33 * @package PHPExcel_Style
34 * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
36 class PHPExcel_Style_Conditional implements PHPExcel_IComparable
38 /* Condition types */
39 const CONDITION_NONE = 'none';
40 const CONDITION_CELLIS = 'cellIs';
41 const CONDITION_CONTAINSTEXT = 'containsText';
42 const CONDITION_EXPRESSION = 'expression';
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';
58 /**
59 * Condition type
61 * @var int
63 private $_conditionType;
65 /**
66 * Operator type
68 * @var int
70 private $_operatorType;
72 /**
73 * Text
75 * @var string
77 private $_text;
79 /**
80 * Condition
82 * @var string[]
84 private $_condition = array();
86 /**
87 * Style
89 * @var PHPExcel_Style
91 private $_style;
93 /**
94 * Create a new PHPExcel_Style_Conditional
96 public function __construct()
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);
107 * Get Condition type
109 * @return string
111 public function getConditionType() {
112 return $this->_conditionType;
116 * Set Condition type
118 * @param string $pValue PHPExcel_Style_Conditional condition type
119 * @return PHPExcel_Style_Conditional
121 public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE) {
122 $this->_conditionType = $pValue;
123 return $this;
127 * Get Operator type
129 * @return string
131 public function getOperatorType() {
132 return $this->_operatorType;
136 * Set Operator type
138 * @param string $pValue PHPExcel_Style_Conditional operator type
139 * @return PHPExcel_Style_Conditional
141 public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE) {
142 $this->_operatorType = $pValue;
143 return $this;
147 * Get text
149 * @return string
151 public function getText() {
152 return $this->_text;
156 * Set text
158 * @param string $value
159 * @return PHPExcel_Style_Conditional
161 public function setText($value = null) {
162 $this->_text = $value;
163 return $this;
167 * Get Condition
169 * @deprecated Deprecated, use getConditions instead
170 * @return string
172 public function getCondition() {
173 if (isset($this->_condition[0])) {
174 return $this->_condition[0];
177 return '';
181 * Set Condition
183 * @deprecated Deprecated, use setConditions instead
184 * @param string $pValue Condition
185 * @return PHPExcel_Style_Conditional
187 public function setCondition($pValue = '') {
188 if (!is_array($pValue))
189 $pValue = array($pValue);
191 return $this->setConditions($pValue);
195 * Get Conditions
197 * @return string[]
199 public function getConditions() {
200 return $this->_condition;
204 * Set Conditions
206 * @param string[] $pValue Condition
207 * @return PHPExcel_Style_Conditional
209 public function setConditions($pValue) {
210 if (!is_array($pValue))
211 $pValue = array($pValue);
213 $this->_condition = $pValue;
214 return $this;
218 * Add Condition
220 * @param string $pValue Condition
221 * @return PHPExcel_Style_Conditional
223 public function addCondition($pValue = '') {
224 $this->_condition[] = $pValue;
225 return $this;
229 * Get Style
231 * @return PHPExcel_Style
233 public function getStyle() {
234 return $this->_style;
238 * Set Style
240 * @param PHPExcel_Style $pValue
241 * @throws PHPExcel_Exception
242 * @return PHPExcel_Style_Conditional
244 public function setStyle(PHPExcel_Style $pValue = null) {
245 $this->_style = $pValue;
246 return $this;
250 * Get hash code
252 * @return string Hash code
254 public function getHashCode() {
255 return md5(
256 $this->_conditionType
257 . $this->_operatorType
258 . implode(';', $this->_condition)
259 . $this->_style->getHashCode()
260 . __CLASS__
265 * Implement PHP __clone to create a deep clone, not just a shallow copy.
267 public function __clone() {
268 $vars = get_object_vars($this);
269 foreach ($vars as $key => $value) {
270 if (is_object($value)) {
271 $this->$key = clone $value;
272 } else {
273 $this->$key = $value;