← All changes
|
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/FormulaToken.php
+100
-100
3.1.2
→
3.0.10
View file →
| @@ -1,33 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | -/* | |
| 4 | -PARTLY BASED ON: | |
| 5 | - Copyright (c) 2007 E. W. Bachtal, Inc. | |
| 6 | - | |
| 7 | - Permission is hereby granted, free of charge, to any person obtaining a copy of this software | |
| 8 | - and associated documentation files (the "Software"), to deal in the Software without restriction, | |
| 9 | - including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 10 | - and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | |
| 11 | - subject to the following conditions: | |
| 12 | - | |
| 13 | - The above copyright notice and this permission notice shall be included in all copies or substantial | |
| 14 | - portions of the Software. | |
| 15 | - | |
| 16 | - The software is provided "as is", without warranty of any kind, express or implied, including but not | |
| 17 | - limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In | |
| 18 | - no event shall the authors or copyright holders be liable for any claim, damages or other liability, | |
| 19 | - whether in an action of contract, tort or otherwise, arising from, out of or in connection with the | |
| 20 | - software or the use or other dealings in the software. | |
| 21 | - | |
| 22 | - http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html | |
| 23 | - http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html | |
| 24 | -*/ | |
| 25 | - | |
| 26 | 2 | /** |
| 27 | - * PHPExcel_Calculation_FormulaToken | |
| 3 | + * PHPExcel | |
| 28 | 4 | * |
| 29 | - * Copyright (c) 2006 - 2015 PHPExcel | |
| 5 | + * Copyright (c) 2006 - 2014 PHPExcel | |
| 30 | 6 | * |
| 31 | 7 | * This library is free software; you can redistribute it and/or |
| 32 | 8 | * modify it under the terms of the GNU Lesser General Public |
| 33 | 9 | * License as published by the Free Software Foundation; either |
| @@ -43,76 +19,106 @@ | ||
| 43 | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 44 | 20 | * |
| 45 | 21 | * @category PHPExcel |
| 46 | 22 | * @package PHPExcel_Calculation |
| 47 | - * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) | |
| 48 | - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL | |
| 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 | |
| 49 | 25 | * @version ##VERSION##, ##DATE## |
| 50 | 26 | */ |
| 51 | 27 | |
| 52 | 28 | |
| 53 | -class PHPExcel_Calculation_FormulaToken | |
| 54 | -{ | |
| 55 | - /* Token types */ | |
| 56 | - const TOKEN_TYPE_NOOP = 'Noop'; | |
| 57 | - const TOKEN_TYPE_OPERAND = 'Operand'; | |
| 58 | - const TOKEN_TYPE_FUNCTION = 'Function'; | |
| 59 | - const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression'; | |
| 60 | - const TOKEN_TYPE_ARGUMENT = 'Argument'; | |
| 61 | - const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix'; | |
| 62 | - const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix'; | |
| 63 | - const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix'; | |
| 64 | - const TOKEN_TYPE_WHITESPACE = 'Whitespace'; | |
| 65 | - const TOKEN_TYPE_UNKNOWN = 'Unknown'; | |
| 29 | +/* | |
| 30 | +PARTLY BASED ON: | |
| 31 | + Copyright (c) 2007 E. W. Bachtal, Inc. | |
| 66 | 32 | |
| 67 | - /* Token subtypes */ | |
| 68 | - const TOKEN_SUBTYPE_NOTHING = 'Nothing'; | |
| 69 | - const TOKEN_SUBTYPE_START = 'Start'; | |
| 70 | - const TOKEN_SUBTYPE_STOP = 'Stop'; | |
| 71 | - const TOKEN_SUBTYPE_TEXT = 'Text'; | |
| 72 | - const TOKEN_SUBTYPE_NUMBER = 'Number'; | |
| 73 | - const TOKEN_SUBTYPE_LOGICAL = 'Logical'; | |
| 74 | - const TOKEN_SUBTYPE_ERROR = 'Error'; | |
| 75 | - const TOKEN_SUBTYPE_RANGE = 'Range'; | |
| 76 | - const TOKEN_SUBTYPE_MATH = 'Math'; | |
| 77 | - const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation'; | |
| 78 | - const TOKEN_SUBTYPE_INTERSECTION = 'Intersection'; | |
| 79 | - const TOKEN_SUBTYPE_UNION = 'Union'; | |
| 33 | + Permission is hereby granted, free of charge, to any person obtaining a copy of this software | |
| 34 | + and associated documentation files (the "Software"), to deal in the Software without restriction, | |
| 35 | + including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 36 | + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | |
| 37 | + subject to the following conditions: | |
| 80 | 38 | |
| 81 | - /** | |
| 82 | - * Value | |
| 83 | - * | |
| 84 | - * @var string | |
| 85 | - */ | |
| 86 | - private $value; | |
| 39 | + The above copyright notice and this permission notice shall be included in all copies or substantial | |
| 40 | + portions of the Software. | |
| 87 | 41 | |
| 88 | - /** | |
| 89 | - * Token Type (represented by TOKEN_TYPE_*) | |
| 90 | - * | |
| 91 | - * @var string | |
| 92 | - */ | |
| 93 | - private $tokenType; | |
| 42 | + The software is provided "as is", without warranty of any kind, express or implied, including but not | |
| 43 | + limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In | |
| 44 | + no event shall the authors or copyright holders be liable for any claim, damages or other liability, | |
| 45 | + whether in an action of contract, tort or otherwise, arising from, out of or in connection with the | |
| 46 | + software or the use or other dealings in the software. | |
| 94 | 47 | |
| 95 | - /** | |
| 96 | - * Token SubType (represented by TOKEN_SUBTYPE_*) | |
| 97 | - * | |
| 98 | - * @var string | |
| 99 | - */ | |
| 100 | - private $tokenSubType; | |
| 48 | + http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html | |
| 49 | + http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html | |
| 50 | +*/ | |
| 101 | 51 | |
| 52 | + | |
| 53 | +/** | |
| 54 | + * PHPExcel_Calculation_FormulaToken | |
| 55 | + * | |
| 56 | + * @category PHPExcel | |
| 57 | + * @package PHPExcel_Calculation | |
| 58 | + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) | |
| 59 | + */ | |
| 60 | +class PHPExcel_Calculation_FormulaToken { | |
| 61 | + /* Token types */ | |
| 62 | + const TOKEN_TYPE_NOOP = 'Noop'; | |
| 63 | + const TOKEN_TYPE_OPERAND = 'Operand'; | |
| 64 | + const TOKEN_TYPE_FUNCTION = 'Function'; | |
| 65 | + const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression'; | |
| 66 | + const TOKEN_TYPE_ARGUMENT = 'Argument'; | |
| 67 | + const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix'; | |
| 68 | + const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix'; | |
| 69 | + const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix'; | |
| 70 | + const TOKEN_TYPE_WHITESPACE = 'Whitespace'; | |
| 71 | + const TOKEN_TYPE_UNKNOWN = 'Unknown'; | |
| 72 | + | |
| 73 | + /* Token subtypes */ | |
| 74 | + const TOKEN_SUBTYPE_NOTHING = 'Nothing'; | |
| 75 | + const TOKEN_SUBTYPE_START = 'Start'; | |
| 76 | + const TOKEN_SUBTYPE_STOP = 'Stop'; | |
| 77 | + const TOKEN_SUBTYPE_TEXT = 'Text'; | |
| 78 | + const TOKEN_SUBTYPE_NUMBER = 'Number'; | |
| 79 | + const TOKEN_SUBTYPE_LOGICAL = 'Logical'; | |
| 80 | + const TOKEN_SUBTYPE_ERROR = 'Error'; | |
| 81 | + const TOKEN_SUBTYPE_RANGE = 'Range'; | |
| 82 | + const TOKEN_SUBTYPE_MATH = 'Math'; | |
| 83 | + const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation'; | |
| 84 | + const TOKEN_SUBTYPE_INTERSECTION = 'Intersection'; | |
| 85 | + const TOKEN_SUBTYPE_UNION = 'Union'; | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * Value | |
| 89 | + * | |
| 90 | + * @var string | |
| 91 | + */ | |
| 92 | + private $_value; | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * Token Type (represented by TOKEN_TYPE_*) | |
| 96 | + * | |
| 97 | + * @var string | |
| 98 | + */ | |
| 99 | + private $_tokenType; | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Token SubType (represented by TOKEN_SUBTYPE_*) | |
| 103 | + * | |
| 104 | + * @var string | |
| 105 | + */ | |
| 106 | + private $_tokenSubType; | |
| 107 | + | |
| 102 | 108 | /** |
| 103 | 109 | * Create a new PHPExcel_Calculation_FormulaToken |
| 104 | 110 | * |
| 105 | - * @param string $pValue | |
| 106 | - * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) | |
| 107 | - * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) | |
| 111 | + * @param string $pValue | |
| 112 | + * @param string $pTokenType Token type (represented by TOKEN_TYPE_*) | |
| 113 | + * @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) | |
| 108 | 114 | */ |
| 109 | 115 | public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) |
| 110 | 116 | { |
| 111 | - // Initialise values | |
| 112 | - $this->value = $pValue; | |
| 113 | - $this->tokenType = $pTokenType; | |
| 114 | - $this->tokenSubType = $pTokenSubType; | |
| 117 | + // Initialise values | |
| 118 | + $this->_value = $pValue; | |
| 119 | + $this->_tokenType = $pTokenType; | |
| 120 | + $this->_tokenSubType = $pTokenSubType; | |
| 115 | 121 | } |
| 116 | 122 | |
| 117 | 123 | /** |
| 118 | 124 | * Get Value |
| @@ -118,21 +124,19 @@ | ||
| 118 | 124 | * Get Value |
| 119 | 125 | * |
| 120 | 126 | * @return string |
| 121 | 127 | */ |
| 122 | - public function getValue() | |
| 123 | - { | |
| 124 | - return $this->value; | |
| 128 | + public function getValue() { | |
| 129 | + return $this->_value; | |
| 125 | 130 | } |
| 126 | 131 | |
| 127 | 132 | /** |
| 128 | 133 | * Set Value |
| 129 | 134 | * |
| 130 | - * @param string $value | |
| 135 | + * @param string $value | |
| 131 | 136 | */ |
| 132 | - public function setValue($value) | |
| 133 | - { | |
| 134 | - $this->value = $value; | |
| 137 | + public function setValue($value) { | |
| 138 | + $this->_value = $value; | |
| 135 | 139 | } |
| 136 | 140 | |
| 137 | 141 | /** |
| 138 | 142 | * Get Token Type (represented by TOKEN_TYPE_*) |
| @@ -138,21 +142,19 @@ | ||
| 138 | 142 | * Get Token Type (represented by TOKEN_TYPE_*) |
| 139 | 143 | * |
| 140 | 144 | * @return string |
| 141 | 145 | */ |
| 142 | - public function getTokenType() | |
| 143 | - { | |
| 144 | - return $this->tokenType; | |
| 146 | + public function getTokenType() { | |
| 147 | + return $this->_tokenType; | |
| 145 | 148 | } |
| 146 | 149 | |
| 147 | 150 | /** |
| 148 | 151 | * Set Token Type |
| 149 | 152 | * |
| 150 | - * @param string $value | |
| 153 | + * @param string $value | |
| 151 | 154 | */ |
| 152 | - public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) | |
| 153 | - { | |
| 154 | - $this->tokenType = $value; | |
| 155 | + public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { | |
| 156 | + $this->_tokenType = $value; | |
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | /** |
| 158 | 160 | * Get Token SubType (represented by TOKEN_SUBTYPE_*) |
| @@ -158,19 +160,17 @@ | ||
| 158 | 160 | * Get Token SubType (represented by TOKEN_SUBTYPE_*) |
| 159 | 161 | * |
| 160 | 162 | * @return string |
| 161 | 163 | */ |
| 162 | - public function getTokenSubType() | |
| 163 | - { | |
| 164 | - return $this->tokenSubType; | |
| 164 | + public function getTokenSubType() { | |
| 165 | + return $this->_tokenSubType; | |
| 165 | 166 | } |
| 166 | 167 | |
| 167 | 168 | /** |
| 168 | 169 | * Set Token SubType |
| 169 | 170 | * |
| 170 | - * @param string $value | |
| 171 | + * @param string $value | |
| 171 | 172 | */ |
| 172 | - public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) | |
| 173 | - { | |
| 174 | - $this->tokenSubType = $value; | |
| 173 | + public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { | |
| 174 | + $this->_tokenSubType = $value; | |
| 175 | 175 | } |
| 176 | 176 | } |