@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @access public |
99 | 99 | * @category Logical Functions |
100 | - * @param mixed $arg,... Data values |
|
101 | - * @return boolean The logical AND of the arguments. |
|
100 | + * @return string|boolean The logical AND of the arguments. |
|
102 | 101 | */ |
103 | 102 | public static function LOGICAL_AND() { |
104 | 103 | // Return value |
@@ -152,8 +151,7 @@ discard block |
||
152 | 151 | * |
153 | 152 | * @access public |
154 | 153 | * @category Logical Functions |
155 | - * @param mixed $arg,... Data values |
|
156 | - * @return boolean The logical OR of the arguments. |
|
154 | + * @return string|boolean The logical OR of the arguments. |
|
157 | 155 | */ |
158 | 156 | public static function LOGICAL_OR() { |
159 | 157 | // Return value |
@@ -207,7 +205,7 @@ discard block |
||
207 | 205 | * @access public |
208 | 206 | * @category Logical Functions |
209 | 207 | * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE |
210 | - * @return boolean The boolean inverse of the argument. |
|
208 | + * @return boolean|string The boolean inverse of the argument. |
|
211 | 209 | */ |
212 | 210 | public static function NOT($logical=FALSE) { |
213 | 211 | $logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical); |
@@ -252,8 +250,8 @@ discard block |
||
252 | 250 | * |
253 | 251 | * @access public |
254 | 252 | * @category Logical Functions |
255 | - * @param mixed $condition Condition to evaluate |
|
256 | - * @param mixed $returnIfTrue Value to return when condition is true |
|
253 | + * @param boolean $condition Condition to evaluate |
|
254 | + * @param integer $returnIfTrue Value to return when condition is true |
|
257 | 255 | * @param mixed $returnIfFalse Optional value to return when condition is false |
258 | 256 | * @return mixed The value of returnIfTrue or returnIfFalse determined by condition |
259 | 257 | */ |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * PHPExcel |
|
4 | - * |
|
5 | - * Copyright (c) 2006 - 2012 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_Calculation |
|
23 | - * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) |
|
24 | - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|
25 | - * @version 1.7.7, 2012-05-19 |
|
26 | - */ |
|
3 | + * PHPExcel |
|
4 | + * |
|
5 | + * Copyright (c) 2006 - 2012 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_Calculation |
|
23 | + * @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) |
|
24 | + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|
25 | + * @version 1.7.7, 2012-05-19 |
|
26 | + */ |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // Is it a boolean value? |
112 | 112 | if (is_bool($arg)) { |
113 | 113 | $returnValue = $returnValue && $arg; |
114 | - } elseif ((is_numeric($arg)) && (!is_string($arg))) { |
|
114 | + } elseif ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
115 | 115 | $returnValue = $returnValue && ($arg != 0); |
116 | 116 | } elseif (is_string($arg)) { |
117 | 117 | $arg = strtoupper($arg); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | // Is it a boolean value? |
167 | 167 | if (is_bool($arg)) { |
168 | 168 | $returnValue = $returnValue || $arg; |
169 | - } elseif ((is_numeric($arg)) && (!is_string($arg))) { |
|
169 | + } elseif ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
170 | 170 | $returnValue = $returnValue || ($arg != 0); |
171 | 171 | } elseif (is_string($arg)) { |
172 | 172 | $arg = strtoupper($arg); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE |
210 | 210 | * @return boolean The boolean inverse of the argument. |
211 | 211 | */ |
212 | - public static function NOT($logical=FALSE) { |
|
212 | + public static function NOT($logical = FALSE) { |
|
213 | 213 | $logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical); |
214 | 214 | if (is_string($logical)) { |
215 | 215 | $logical = strtoupper($logical); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - return !$logical; |
|
225 | + return ! $logical; |
|
226 | 226 | } // function NOT() |
227 | 227 | |
228 | 228 | /** |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | * @return mixed The value of returnIfTrue or returnIfFalse determined by condition |
259 | 259 | */ |
260 | 260 | public static function STATEMENT_IF($condition = TRUE, $returnIfTrue = 0, $returnIfFalse = FALSE) { |
261 | - $condition = (is_null($condition)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition); |
|
262 | - $returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue); |
|
263 | - $returnIfFalse = (is_null($returnIfFalse)) ? FALSE : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse); |
|
261 | + $condition = (is_null($condition)) ? TRUE : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition); |
|
262 | + $returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue); |
|
263 | + $returnIfFalse = (is_null($returnIfFalse)) ? FALSE : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse); |
|
264 | 264 | |
265 | 265 | return ($condition) ? $returnIfTrue : $returnIfFalse; |
266 | 266 | } // function STATEMENT_IF() |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | * @return mixed The value of errorpart or testValue determined by error condition |
280 | 280 | */ |
281 | 281 | public static function IFERROR($testValue = '', $errorpart = '') { |
282 | - $testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue); |
|
283 | - $errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart); |
|
282 | + $testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue); |
|
283 | + $errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart); |
|
284 | 284 | |
285 | 285 | return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue); |
286 | 286 | } // function IFERROR() |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param row Row number to use in the cell reference |
58 | 58 | * @param column Column number to use in the cell reference |
59 | - * @param relativity Flag indicating the type of reference to return |
|
59 | + * @param relativity integer indicating the type of reference to return |
|
60 | 60 | * 1 or omitted Absolute |
61 | 61 | * 2 Absolute row; relative column |
62 | 62 | * 3 Relative row; absolute column |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @param cellAddress The reference from which you want to base the offset. Reference must refer to a cell or |
347 | 347 | * range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value. |
348 | - * @param rows The number of rows, up or down, that you want the upper-left cell to refer to. |
|
348 | + * @param rows integer number of rows, up or down, that you want the upper-left cell to refer to. |
|
349 | 349 | * Using 5 as the rows argument specifies that the upper-left cell in the reference is |
350 | 350 | * five rows below reference. Rows can be positive (which means below the starting reference) |
351 | 351 | * or negative (which means above the starting reference). |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param lookup_value The value that you want to match in lookup_array |
482 | 482 | * @param lookup_array The range of cells being searched |
483 | - * @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered. |
|
483 | + * @param match_type integer number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered. |
|
484 | 484 | * @return integer The relative position of the found item |
485 | 485 | */ |
486 | 486 | public static function MATCH($lookup_value, $lookup_array, $match_type=1) { |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number. |
683 | 683 | * @param lookup_value The value that you want to match in lookup_array |
684 | 684 | * @param lookup_array The range of cells being searched |
685 | - * @param index_number The column number in table_array from which the matching value must be returned. The first column is 1. |
|
685 | + * @param index_number integer column number in table_array from which the matching value must be returned. The first column is 1. |
|
686 | 686 | * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. |
687 | 687 | * @return mixed The value of the found cell |
688 | 688 | */ |
@@ -678,14 +678,14 @@ |
||
678 | 678 | |
679 | 679 | |
680 | 680 | /** |
681 | - * VLOOKUP |
|
682 | - * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number. |
|
683 | - * @param lookup_value The value that you want to match in lookup_array |
|
684 | - * @param lookup_array The range of cells being searched |
|
685 | - * @param index_number The column number in table_array from which the matching value must be returned. The first column is 1. |
|
686 | - * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. |
|
687 | - * @return mixed The value of the found cell |
|
688 | - */ |
|
681 | + * VLOOKUP |
|
682 | + * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number. |
|
683 | + * @param lookup_value The value that you want to match in lookup_array |
|
684 | + * @param lookup_array The range of cells being searched |
|
685 | + * @param index_number The column number in table_array from which the matching value must be returned. The first column is 1. |
|
686 | + * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. |
|
687 | + * @return mixed The value of the found cell |
|
688 | + */ |
|
689 | 689 | public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) { |
690 | 690 | $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); |
691 | 691 | $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | * @param sheetText Optional Name of worksheet to use |
68 | 68 | * @return string |
69 | 69 | */ |
70 | - public static function CELL_ADDRESS($row, $column, $relativity=1, $referenceStyle=True, $sheetText='') { |
|
71 | - $row = PHPExcel_Calculation_Functions::flattenSingleValue($row); |
|
72 | - $column = PHPExcel_Calculation_Functions::flattenSingleValue($column); |
|
73 | - $relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity); |
|
74 | - $sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText); |
|
70 | + public static function CELL_ADDRESS($row, $column, $relativity = 1, $referenceStyle = True, $sheetText = '') { |
|
71 | + $row = PHPExcel_Calculation_Functions::flattenSingleValue($row); |
|
72 | + $column = PHPExcel_Calculation_Functions::flattenSingleValue($column); |
|
73 | + $relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity); |
|
74 | + $sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText); |
|
75 | 75 | |
76 | 76 | if (($row < 1) || ($column < 1)) { |
77 | 77 | return PHPExcel_Calculation_Functions::VALUE(); |
78 | 78 | } |
79 | 79 | |
80 | 80 | if ($sheetText > '') { |
81 | - if (strpos($sheetText,' ') !== False) { $sheetText = "'".$sheetText."'"; } |
|
82 | - $sheetText .='!'; |
|
81 | + if (strpos($sheetText, ' ') !== False) { $sheetText = "'".$sheetText."'"; } |
|
82 | + $sheetText .= '!'; |
|
83 | 83 | } |
84 | - if ((!is_bool($referenceStyle)) || $referenceStyle) { |
|
84 | + if (( ! is_bool($referenceStyle)) || $referenceStyle) { |
|
85 | 85 | $rowRelative = $columnRelative = '$'; |
86 | - $column = PHPExcel_Cell::stringFromColumnIndex($column-1); |
|
86 | + $column = PHPExcel_Cell::stringFromColumnIndex($column - 1); |
|
87 | 87 | if (($relativity == 2) || ($relativity == 4)) { $columnRelative = ''; } |
88 | 88 | if (($relativity == 3) || ($relativity == 4)) { $rowRelative = ''; } |
89 | 89 | return $sheetText.$columnRelative.$column.$rowRelative.$row; |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | * @param cellAddress A reference to a range of cells for which you want the column numbers |
110 | 110 | * @return integer or array of integer |
111 | 111 | */ |
112 | - public static function COLUMN($cellAddress=Null) { |
|
112 | + public static function COLUMN($cellAddress = Null) { |
|
113 | 113 | if (is_null($cellAddress) || trim($cellAddress) === '') { return 0; } |
114 | 114 | |
115 | 115 | if (is_array($cellAddress)) { |
116 | - foreach($cellAddress as $columnKey => $value) { |
|
117 | - $columnKey = preg_replace('/[^a-z]/i','',$columnKey); |
|
116 | + foreach ($cellAddress as $columnKey => $value) { |
|
117 | + $columnKey = preg_replace('/[^a-z]/i', '', $columnKey); |
|
118 | 118 | return (integer) PHPExcel_Cell::columnIndexFromString($columnKey); |
119 | 119 | } |
120 | 120 | } else { |
121 | - if (strpos($cellAddress,'!') !== false) { |
|
122 | - list($sheet,$cellAddress) = explode('!',$cellAddress); |
|
121 | + if (strpos($cellAddress, '!') !== false) { |
|
122 | + list($sheet, $cellAddress) = explode('!', $cellAddress); |
|
123 | 123 | } |
124 | - if (strpos($cellAddress,':') !== false) { |
|
125 | - list($startAddress,$endAddress) = explode(':',$cellAddress); |
|
126 | - $startAddress = preg_replace('/[^a-z]/i','',$startAddress); |
|
127 | - $endAddress = preg_replace('/[^a-z]/i','',$endAddress); |
|
124 | + if (strpos($cellAddress, ':') !== false) { |
|
125 | + list($startAddress, $endAddress) = explode(':', $cellAddress); |
|
126 | + $startAddress = preg_replace('/[^a-z]/i', '', $startAddress); |
|
127 | + $endAddress = preg_replace('/[^a-z]/i', '', $endAddress); |
|
128 | 128 | $returnValue = array(); |
129 | 129 | do { |
130 | 130 | $returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress); |
131 | 131 | } while ($startAddress++ != $endAddress); |
132 | 132 | return $returnValue; |
133 | 133 | } else { |
134 | - $cellAddress = preg_replace('/[^a-z]/i','',$cellAddress); |
|
134 | + $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress); |
|
135 | 135 | return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress); |
136 | 136 | } |
137 | 137 | } |
@@ -149,17 +149,17 @@ discard block |
||
149 | 149 | * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns |
150 | 150 | * @return integer The number of columns in cellAddress |
151 | 151 | */ |
152 | - public static function COLUMNS($cellAddress=Null) { |
|
152 | + public static function COLUMNS($cellAddress = Null) { |
|
153 | 153 | if (is_null($cellAddress) || $cellAddress === '') { |
154 | 154 | return 1; |
155 | - } elseif (!is_array($cellAddress)) { |
|
155 | + } elseif ( ! is_array($cellAddress)) { |
|
156 | 156 | return PHPExcel_Calculation_Functions::VALUE(); |
157 | 157 | } |
158 | 158 | |
159 | 159 | $x = array_keys($cellAddress); |
160 | 160 | $x = array_shift($x); |
161 | 161 | $isMatrix = (is_numeric($x)); |
162 | - list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); |
|
162 | + list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); |
|
163 | 163 | |
164 | 164 | if ($isMatrix) { |
165 | 165 | return $rows; |
@@ -183,31 +183,31 @@ discard block |
||
183 | 183 | * @param cellAddress A reference to a range of cells for which you want the row numbers |
184 | 184 | * @return integer or array of integer |
185 | 185 | */ |
186 | - public static function ROW($cellAddress=Null) { |
|
186 | + public static function ROW($cellAddress = Null) { |
|
187 | 187 | if (is_null($cellAddress) || trim($cellAddress) === '') { return 0; } |
188 | 188 | |
189 | 189 | if (is_array($cellAddress)) { |
190 | - foreach($cellAddress as $columnKey => $rowValue) { |
|
191 | - foreach($rowValue as $rowKey => $cellValue) { |
|
192 | - return (integer) preg_replace('/[^0-9]/i','',$rowKey); |
|
190 | + foreach ($cellAddress as $columnKey => $rowValue) { |
|
191 | + foreach ($rowValue as $rowKey => $cellValue) { |
|
192 | + return (integer) preg_replace('/[^0-9]/i', '', $rowKey); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | } else { |
196 | - if (strpos($cellAddress,'!') !== false) { |
|
197 | - list($sheet,$cellAddress) = explode('!',$cellAddress); |
|
196 | + if (strpos($cellAddress, '!') !== false) { |
|
197 | + list($sheet, $cellAddress) = explode('!', $cellAddress); |
|
198 | 198 | } |
199 | - if (strpos($cellAddress,':') !== false) { |
|
200 | - list($startAddress,$endAddress) = explode(':',$cellAddress); |
|
201 | - $startAddress = preg_replace('/[^0-9]/','',$startAddress); |
|
202 | - $endAddress = preg_replace('/[^0-9]/','',$endAddress); |
|
199 | + if (strpos($cellAddress, ':') !== false) { |
|
200 | + list($startAddress, $endAddress) = explode(':', $cellAddress); |
|
201 | + $startAddress = preg_replace('/[^0-9]/', '', $startAddress); |
|
202 | + $endAddress = preg_replace('/[^0-9]/', '', $endAddress); |
|
203 | 203 | $returnValue = array(); |
204 | 204 | do { |
205 | 205 | $returnValue[][] = (integer) $startAddress; |
206 | 206 | } while ($startAddress++ != $endAddress); |
207 | 207 | return $returnValue; |
208 | 208 | } else { |
209 | - list($cellAddress) = explode(':',$cellAddress); |
|
210 | - return (integer) preg_replace('/[^0-9]/','',$cellAddress); |
|
209 | + list($cellAddress) = explode(':', $cellAddress); |
|
210 | + return (integer) preg_replace('/[^0-9]/', '', $cellAddress); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | } // function ROW() |
@@ -224,16 +224,16 @@ discard block |
||
224 | 224 | * @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows |
225 | 225 | * @return integer The number of rows in cellAddress |
226 | 226 | */ |
227 | - public static function ROWS($cellAddress=Null) { |
|
227 | + public static function ROWS($cellAddress = Null) { |
|
228 | 228 | if (is_null($cellAddress) || $cellAddress === '') { |
229 | 229 | return 1; |
230 | - } elseif (!is_array($cellAddress)) { |
|
230 | + } elseif ( ! is_array($cellAddress)) { |
|
231 | 231 | return PHPExcel_Calculation_Functions::VALUE(); |
232 | 232 | } |
233 | 233 | |
234 | 234 | $i = array_keys($cellAddress); |
235 | 235 | $isMatrix = (is_numeric(array_shift($i))); |
236 | - list($columns,$rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); |
|
236 | + list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress); |
|
237 | 237 | |
238 | 238 | if ($isMatrix) { |
239 | 239 | return $columns; |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | $args = func_get_args(); |
260 | 260 | $pCell = array_pop($args); |
261 | 261 | |
262 | - $linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL); |
|
263 | - $displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName); |
|
262 | + $linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL); |
|
263 | + $displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName); |
|
264 | 264 | |
265 | - if ((!is_object($pCell)) || (trim($linkURL) == '')) { |
|
265 | + if (( ! is_object($pCell)) || (trim($linkURL) == '')) { |
|
266 | 266 | return PHPExcel_Calculation_Functions::REF(); |
267 | 267 | } |
268 | 268 | |
@@ -293,27 +293,27 @@ discard block |
||
293 | 293 | * @todo Support for the optional a1 parameter introduced in Excel 2010 |
294 | 294 | * |
295 | 295 | */ |
296 | - public static function INDIRECT($cellAddress=Null, PHPExcel_Cell $pCell = null) { |
|
297 | - $cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress); |
|
296 | + public static function INDIRECT($cellAddress = Null, PHPExcel_Cell $pCell = null) { |
|
297 | + $cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress); |
|
298 | 298 | if (is_null($cellAddress) || $cellAddress === '') { |
299 | 299 | return PHPExcel_Calculation_Functions::REF(); |
300 | 300 | } |
301 | 301 | |
302 | 302 | $cellAddress1 = $cellAddress; |
303 | 303 | $cellAddress2 = NULL; |
304 | - if (strpos($cellAddress,':') !== false) { |
|
305 | - list($cellAddress1,$cellAddress2) = explode(':',$cellAddress); |
|
304 | + if (strpos($cellAddress, ':') !== false) { |
|
305 | + list($cellAddress1, $cellAddress2) = explode(':', $cellAddress); |
|
306 | 306 | } |
307 | 307 | |
308 | - if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || |
|
309 | - ((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { |
|
308 | + if (( ! preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || |
|
309 | + (( ! is_null($cellAddress2)) && ( ! preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { |
|
310 | 310 | |
311 | - if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { |
|
311 | + if ( ! preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { |
|
312 | 312 | return PHPExcel_Calculation_Functions::REF(); |
313 | 313 | } |
314 | 314 | |
315 | - if (strpos($cellAddress,'!') !== false) { |
|
316 | - list($sheetName,$cellAddress) = explode('!',$cellAddress); |
|
315 | + if (strpos($cellAddress, '!') !== false) { |
|
316 | + list($sheetName, $cellAddress) = explode('!', $cellAddress); |
|
317 | 317 | $pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName); |
318 | 318 | } else { |
319 | 319 | $pSheet = $pCell->getParent(); |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, False); |
323 | 323 | } |
324 | 324 | |
325 | - if (strpos($cellAddress,'!') !== false) { |
|
326 | - list($sheetName,$cellAddress) = explode('!',$cellAddress); |
|
325 | + if (strpos($cellAddress, '!') !== false) { |
|
326 | + list($sheetName, $cellAddress) = explode('!', $cellAddress); |
|
327 | 327 | $pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName); |
328 | 328 | } else { |
329 | 329 | $pSheet = $pCell->getParent(); |
@@ -358,32 +358,32 @@ discard block |
||
358 | 358 | * @param width The width, in number of columns, that you want the returned reference to be. Width must be a positive number. |
359 | 359 | * @return string A reference to a cell or range of cells |
360 | 360 | */ |
361 | - public static function OFFSET($cellAddress=Null,$rows=0,$columns=0,$height=null,$width=null) { |
|
362 | - $rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows); |
|
361 | + public static function OFFSET($cellAddress = Null, $rows = 0, $columns = 0, $height = null, $width = null) { |
|
362 | + $rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows); |
|
363 | 363 | $columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns); |
364 | 364 | $height = PHPExcel_Calculation_Functions::flattenSingleValue($height); |
365 | - $width = PHPExcel_Calculation_Functions::flattenSingleValue($width); |
|
365 | + $width = PHPExcel_Calculation_Functions::flattenSingleValue($width); |
|
366 | 366 | if ($cellAddress == Null) { |
367 | 367 | return 0; |
368 | 368 | } |
369 | 369 | |
370 | 370 | $args = func_get_args(); |
371 | 371 | $pCell = array_pop($args); |
372 | - if (!is_object($pCell)) { |
|
372 | + if ( ! is_object($pCell)) { |
|
373 | 373 | return PHPExcel_Calculation_Functions::REF(); |
374 | 374 | } |
375 | 375 | |
376 | 376 | $sheetName = null; |
377 | - if (strpos($cellAddress,"!")) { |
|
378 | - list($sheetName,$cellAddress) = explode("!",$cellAddress); |
|
377 | + if (strpos($cellAddress, "!")) { |
|
378 | + list($sheetName, $cellAddress) = explode("!", $cellAddress); |
|
379 | 379 | } |
380 | - if (strpos($cellAddress,":")) { |
|
381 | - list($startCell,$endCell) = explode(":",$cellAddress); |
|
380 | + if (strpos($cellAddress, ":")) { |
|
381 | + list($startCell, $endCell) = explode(":", $cellAddress); |
|
382 | 382 | } else { |
383 | 383 | $startCell = $endCell = $cellAddress; |
384 | 384 | } |
385 | - list($startCellColumn,$startCellRow) = PHPExcel_Cell::coordinateFromString($startCell); |
|
386 | - list($endCellColumn,$endCellRow) = PHPExcel_Cell::coordinateFromString($endCell); |
|
385 | + list($startCellColumn, $startCellRow) = PHPExcel_Cell::coordinateFromString($startCell); |
|
386 | + list($endCellColumn, $endCellRow) = PHPExcel_Cell::coordinateFromString($endCell); |
|
387 | 387 | |
388 | 388 | $startCellRow += $rows; |
389 | 389 | $startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1; |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | return PHPExcel_Calculation_Functions::REF(); |
394 | 394 | } |
395 | 395 | $endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1; |
396 | - if (($width != null) && (!is_object($width))) { |
|
396 | + if (($width != null) && ( ! is_object($width))) { |
|
397 | 397 | $endCellColumn = $startCellColumn + $width - 1; |
398 | 398 | } else { |
399 | 399 | $endCellColumn += $columns; |
400 | 400 | } |
401 | 401 | $startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn); |
402 | 402 | |
403 | - if (($height != null) && (!is_object($height))) { |
|
403 | + if (($height != null) && ( ! is_object($height))) { |
|
404 | 404 | $endCellRow = $startCellRow + $height - 1; |
405 | 405 | } else { |
406 | 406 | $endCellRow += $rows; |
@@ -449,10 +449,10 @@ discard block |
||
449 | 449 | $chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs)); |
450 | 450 | $entryCount = count($chooseArgs) - 1; |
451 | 451 | |
452 | - if(is_array($chosenEntry)) { |
|
452 | + if (is_array($chosenEntry)) { |
|
453 | 453 | $chosenEntry = array_shift($chosenEntry); |
454 | 454 | } |
455 | - if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) { |
|
455 | + if ((is_numeric($chosenEntry)) && ( ! is_bool($chosenEntry))) { |
|
456 | 456 | --$chosenEntry; |
457 | 457 | } else { |
458 | 458 | return PHPExcel_Calculation_Functions::VALUE(); |
@@ -483,15 +483,15 @@ discard block |
||
483 | 483 | * @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered. |
484 | 484 | * @return integer The relative position of the found item |
485 | 485 | */ |
486 | - public static function MATCH($lookup_value, $lookup_array, $match_type=1) { |
|
486 | + public static function MATCH($lookup_value, $lookup_array, $match_type = 1) { |
|
487 | 487 | $lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array); |
488 | 488 | $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); |
489 | - $match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type); |
|
489 | + $match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type); |
|
490 | 490 | // MATCH is not case sensitive |
491 | 491 | $lookup_value = strtolower($lookup_value); |
492 | 492 | |
493 | 493 | // lookup_value type has to be number, text, or logical values |
494 | - if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) { |
|
494 | + if (( ! is_numeric($lookup_value)) && ( ! is_string($lookup_value)) && ( ! is_bool($lookup_value))) { |
|
495 | 495 | return PHPExcel_Calculation_Functions::NA(); |
496 | 496 | } |
497 | 497 | |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | } |
508 | 508 | |
509 | 509 | // lookup_array should contain only number, text, or logical values, or empty (null) cells |
510 | - foreach($lookup_array as $i => $lookupArrayValue) { |
|
510 | + foreach ($lookup_array as $i => $lookupArrayValue) { |
|
511 | 511 | // check the type of the value |
512 | - if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) && |
|
513 | - (!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) { |
|
512 | + if (( ! is_numeric($lookupArrayValue)) && ( ! is_string($lookupArrayValue)) && |
|
513 | + ( ! is_bool($lookupArrayValue)) && ( ! is_null($lookupArrayValue))) { |
|
514 | 514 | return PHPExcel_Calculation_Functions::NA(); |
515 | 515 | } |
516 | 516 | // convert strings to lowercase for case-insensitive testing |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $lookup_array[$i] = strtolower($lookupArrayValue); |
519 | 519 | } |
520 | 520 | if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) { |
521 | - $lookup_array = array_slice($lookup_array,0,$i-1); |
|
521 | + $lookup_array = array_slice($lookup_array, 0, $i - 1); |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | if ($match_type == 1) { |
527 | 527 | asort($lookup_array); |
528 | 528 | $keySet = array_keys($lookup_array); |
529 | - } elseif($match_type == -1) { |
|
529 | + } elseif ($match_type == -1) { |
|
530 | 530 | arsort($lookup_array); |
531 | 531 | $keySet = array_keys($lookup_array); |
532 | 532 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | // loop on the cells |
538 | 538 | // var_dump($lookup_array); |
539 | 539 | // echo '<br />'; |
540 | - foreach($lookup_array as $i => $lookupArrayValue) { |
|
540 | + foreach ($lookup_array as $i => $lookupArrayValue) { |
|
541 | 541 | if (($match_type == 0) && ($lookupArrayValue == $lookup_value)) { |
542 | 542 | // exact match |
543 | 543 | return ++$i; |
@@ -548,15 +548,15 @@ discard block |
||
548 | 548 | // echo 'Keyset = '; |
549 | 549 | // var_dump($keySet); |
550 | 550 | // echo '<br />'; |
551 | - $i = array_search($i,$keySet); |
|
551 | + $i = array_search($i, $keySet); |
|
552 | 552 | // echo '$i='.$i.'<br />'; |
553 | 553 | // if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value |
554 | - if ($i < 1){ |
|
554 | + if ($i < 1) { |
|
555 | 555 | // 1st cell was allready smaller than the lookup_value |
556 | 556 | break; |
557 | 557 | } else { |
558 | 558 | // the previous cell was the match |
559 | - return $keySet[$i-1]+1; |
|
559 | + return $keySet[$i - 1] + 1; |
|
560 | 560 | } |
561 | 561 | } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) { |
562 | 562 | // echo '$i = '.$i.' => '; |
@@ -565,15 +565,15 @@ discard block |
||
565 | 565 | // echo 'Keyset = '; |
566 | 566 | // var_dump($keySet); |
567 | 567 | // echo '<br />'; |
568 | - $i = array_search($i,$keySet); |
|
568 | + $i = array_search($i, $keySet); |
|
569 | 569 | // echo '$i='.$i.'<br />'; |
570 | 570 | // if match_type is 1 <=> find the largest value that is less than or equal to lookup_value |
571 | - if ($i < 1){ |
|
571 | + if ($i < 1) { |
|
572 | 572 | // 1st cell was allready bigger than the lookup_value |
573 | 573 | break; |
574 | 574 | } else { |
575 | 575 | // the previous cell was the match |
576 | - return $keySet[$i-1]+1; |
|
576 | + return $keySet[$i - 1] + 1; |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 | } |
@@ -596,13 +596,13 @@ discard block |
||
596 | 596 | * @param column_num The column in array from which to return a value. If column_num is omitted, row_num is required. |
597 | 597 | * @return mixed the value of a specified cell or array of cells |
598 | 598 | */ |
599 | - public static function INDEX($arrayValues,$rowNum = 0,$columnNum = 0) { |
|
599 | + public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0) { |
|
600 | 600 | |
601 | 601 | if (($rowNum < 0) || ($columnNum < 0)) { |
602 | 602 | return PHPExcel_Calculation_Functions::VALUE(); |
603 | 603 | } |
604 | 604 | |
605 | - if (!is_array($arrayValues)) { |
|
605 | + if ( ! is_array($arrayValues)) { |
|
606 | 606 | return PHPExcel_Calculation_Functions::REF(); |
607 | 607 | } |
608 | 608 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | } |
618 | 618 | $rowNum = $rowKeys[--$rowNum]; |
619 | 619 | $returnArray = array(); |
620 | - foreach($arrayValues as $arrayColumn) { |
|
620 | + foreach ($arrayValues as $arrayColumn) { |
|
621 | 621 | if (is_array($arrayColumn)) { |
622 | 622 | if (isset($arrayColumn[$rowNum])) { |
623 | 623 | $returnArray[] = $arrayColumn[$rowNum]; |
@@ -652,12 +652,12 @@ discard block |
||
652 | 652 | */ |
653 | 653 | public static function TRANSPOSE($matrixData) { |
654 | 654 | $returnMatrix = array(); |
655 | - if (!is_array($matrixData)) { $matrixData = array(array($matrixData)); } |
|
655 | + if ( ! is_array($matrixData)) { $matrixData = array(array($matrixData)); } |
|
656 | 656 | |
657 | 657 | $column = 0; |
658 | - foreach($matrixData as $matrixRow) { |
|
658 | + foreach ($matrixData as $matrixRow) { |
|
659 | 659 | $row = 0; |
660 | - foreach($matrixRow as $matrixCell) { |
|
660 | + foreach ($matrixRow as $matrixCell) { |
|
661 | 661 | $returnMatrix[$row][$column] = $matrixCell; |
662 | 662 | ++$row; |
663 | 663 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | } // function TRANSPOSE() |
668 | 668 | |
669 | 669 | |
670 | - private static function _vlookupSort($a,$b) { |
|
670 | + private static function _vlookupSort($a, $b) { |
|
671 | 671 | $f = array_keys($a); |
672 | 672 | $firstColumn = array_shift($f); |
673 | 673 | if (strtolower($a[$firstColumn]) == strtolower($b[$firstColumn])) { |
@@ -686,10 +686,10 @@ discard block |
||
686 | 686 | * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. |
687 | 687 | * @return mixed The value of the found cell |
688 | 688 | */ |
689 | - public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match=true) { |
|
689 | + public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true) { |
|
690 | 690 | $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); |
691 | 691 | $index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number); |
692 | - $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match); |
|
692 | + $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match); |
|
693 | 693 | |
694 | 694 | // index_number must be greater than or equal to 1 |
695 | 695 | if ($index_number < 1) { |
@@ -697,12 +697,12 @@ discard block |
||
697 | 697 | } |
698 | 698 | |
699 | 699 | // index_number must be less than or equal to the number of columns in lookup_array |
700 | - if ((!is_array($lookup_array)) || (empty($lookup_array))) { |
|
700 | + if (( ! is_array($lookup_array)) || (empty($lookup_array))) { |
|
701 | 701 | return PHPExcel_Calculation_Functions::REF(); |
702 | 702 | } else { |
703 | 703 | $f = array_keys($lookup_array); |
704 | 704 | $firstRow = array_pop($f); |
705 | - if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { |
|
705 | + if (( ! is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { |
|
706 | 706 | return PHPExcel_Calculation_Functions::REF(); |
707 | 707 | } else { |
708 | 708 | $columnKeys = array_keys($lookup_array[$firstRow]); |
@@ -711,12 +711,12 @@ discard block |
||
711 | 711 | } |
712 | 712 | } |
713 | 713 | |
714 | - if (!$not_exact_match) { |
|
715 | - uasort($lookup_array,array('self','_vlookupSort')); |
|
714 | + if ( ! $not_exact_match) { |
|
715 | + uasort($lookup_array, array('self', '_vlookupSort')); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | $rowNumber = $rowValue = False; |
719 | - foreach($lookup_array as $rowKey => $rowData) { |
|
719 | + foreach ($lookup_array as $rowKey => $rowData) { |
|
720 | 720 | if (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)) { |
721 | 721 | break; |
722 | 722 | } |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } |
726 | 726 | |
727 | 727 | if ($rowNumber !== false) { |
728 | - if ((!$not_exact_match) && ($rowValue != $lookup_value)) { |
|
728 | + if (( ! $not_exact_match) && ($rowValue != $lookup_value)) { |
|
729 | 729 | // if an exact match is required, we have what we need to return an appropriate response |
730 | 730 | return PHPExcel_Calculation_Functions::NA(); |
731 | 731 | } else { |
@@ -746,10 +746,10 @@ discard block |
||
746 | 746 | * @param result_vector The column from which the matching value must be returned |
747 | 747 | * @return mixed The value of the found cell |
748 | 748 | */ |
749 | - public static function LOOKUP($lookup_value, $lookup_vector, $result_vector=null) { |
|
750 | - $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); |
|
749 | + public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null) { |
|
750 | + $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value); |
|
751 | 751 | |
752 | - if (!is_array($lookup_vector)) { |
|
752 | + if ( ! is_array($lookup_vector)) { |
|
753 | 753 | return PHPExcel_Calculation_Functions::NA(); |
754 | 754 | } |
755 | 755 | $lookupRows = count($lookup_vector); |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | $lookup_vector = array_shift($lookup_vector); |
783 | 783 | } |
784 | 784 | if ($lookupColumns != 2) { |
785 | - foreach($lookup_vector as &$value) { |
|
785 | + foreach ($lookup_vector as &$value) { |
|
786 | 786 | if (is_array($value)) { |
787 | 787 | $k = array_keys($value); |
788 | 788 | $key1 = $key2 = array_shift($k); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | unset($value); |
803 | 803 | } |
804 | 804 | |
805 | - return self::VLOOKUP($lookup_value,$lookup_vector,2); |
|
805 | + return self::VLOOKUP($lookup_value, $lookup_vector, 2); |
|
806 | 806 | } // function LOOKUP() |
807 | 807 | |
808 | 808 | } // class PHPExcel_Calculation_LookupRef |
@@ -70,6 +70,10 @@ discard block |
||
70 | 70 | } // function _factors() |
71 | 71 | |
72 | 72 | |
73 | + /** |
|
74 | + * @param integer $num |
|
75 | + * @param integer $n |
|
76 | + */ |
|
73 | 77 | private static function _romanCut($num, $n) { |
74 | 78 | return ($num - ($num % $n ) ) / $n; |
75 | 79 | } // function _romanCut() |
@@ -423,8 +427,7 @@ discard block |
||
423 | 427 | * |
424 | 428 | * @access public |
425 | 429 | * @category Mathematical and Trigonometric Functions |
426 | - * @param float $value The positive real number for which you want the logarithm |
|
427 | - * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. |
|
430 | + * @param integer $base The base of the logarithm. If base is omitted, it is assumed to be 10. |
|
428 | 431 | * @return float |
429 | 432 | */ |
430 | 433 | public static function LOG_BASE($number = NULL, $base=10) { |
@@ -681,8 +684,8 @@ discard block |
||
681 | 684 | * |
682 | 685 | * Computes x raised to the power y. |
683 | 686 | * |
684 | - * @param float $x |
|
685 | - * @param float $y |
|
687 | + * @param integer $x |
|
688 | + * @param integer $y |
|
686 | 689 | * @return float |
687 | 690 | */ |
688 | 691 | public static function POWER($x = 0, $y = 2) { |
@@ -712,7 +715,6 @@ discard block |
||
712 | 715 | * |
713 | 716 | * @access public |
714 | 717 | * @category Mathematical and Trigonometric Functions |
715 | - * @param mixed $arg,... Data values |
|
716 | 718 | * @return float |
717 | 719 | */ |
718 | 720 | public static function PRODUCT() { |
@@ -750,8 +752,7 @@ discard block |
||
750 | 752 | * |
751 | 753 | * @access public |
752 | 754 | * @category Mathematical and Trigonometric Functions |
753 | - * @param mixed $arg,... Data values |
|
754 | - * @return float |
|
755 | + * @return integer |
|
755 | 756 | */ |
756 | 757 | public static function QUOTIENT() { |
757 | 758 | // Return value |
@@ -881,9 +882,6 @@ discard block |
||
881 | 882 | * |
882 | 883 | * Returns the sum of a power series |
883 | 884 | * |
884 | - * @param float $x Input value to the power series |
|
885 | - * @param float $n Initial power to which you want to raise $x |
|
886 | - * @param float $m Step by which to increase $n for each term in the series |
|
887 | 885 | * @param array of mixed Data Series |
888 | 886 | * @return float |
889 | 887 | */ |
@@ -1028,7 +1026,6 @@ discard block |
||
1028 | 1026 | * |
1029 | 1027 | * @access public |
1030 | 1028 | * @category Mathematical and Trigonometric Functions |
1031 | - * @param mixed $arg,... Data values |
|
1032 | 1029 | * @return float |
1033 | 1030 | */ |
1034 | 1031 | public static function SUM() { |
@@ -1058,9 +1055,8 @@ discard block |
||
1058 | 1055 | * |
1059 | 1056 | * @access public |
1060 | 1057 | * @category Mathematical and Trigonometric Functions |
1061 | - * @param mixed $arg,... Data values |
|
1062 | 1058 | * @param string $condition The criteria that defines which cells will be summed. |
1063 | - * @return float |
|
1059 | + * @return integer |
|
1064 | 1060 | */ |
1065 | 1061 | public static function SUMIF($aArgs,$condition,$sumArgs = array()) { |
1066 | 1062 | // Return value |
@@ -1095,7 +1091,6 @@ discard block |
||
1095 | 1091 | * |
1096 | 1092 | * @access public |
1097 | 1093 | * @category Mathematical and Trigonometric Functions |
1098 | - * @param mixed $arg,... Data values |
|
1099 | 1094 | * @return float |
1100 | 1095 | */ |
1101 | 1096 | public static function SUMPRODUCT() { |
@@ -1139,7 +1134,6 @@ discard block |
||
1139 | 1134 | * |
1140 | 1135 | * @access public |
1141 | 1136 | * @category Mathematical and Trigonometric Functions |
1142 | - * @param mixed $arg,... Data values |
|
1143 | 1137 | * @return float |
1144 | 1138 | */ |
1145 | 1139 | public static function SUMSQ() { |
@@ -1162,7 +1156,6 @@ discard block |
||
1162 | 1156 | /** |
1163 | 1157 | * SUMX2MY2 |
1164 | 1158 | * |
1165 | - * @param mixed $value Value to check |
|
1166 | 1159 | * @return float |
1167 | 1160 | */ |
1168 | 1161 | public static function SUMX2MY2($matrixData1,$matrixData2) { |
@@ -1191,7 +1184,6 @@ discard block |
||
1191 | 1184 | /** |
1192 | 1185 | * SUMX2PY2 |
1193 | 1186 | * |
1194 | - * @param mixed $value Value to check |
|
1195 | 1187 | * @return float |
1196 | 1188 | */ |
1197 | 1189 | public static function SUMX2PY2($matrixData1,$matrixData2) { |
@@ -1220,7 +1212,6 @@ discard block |
||
1220 | 1212 | /** |
1221 | 1213 | * SUMXMY2 |
1222 | 1214 | * |
1223 | - * @param mixed $value Value to check |
|
1224 | 1215 | * @return float |
1225 | 1216 | */ |
1226 | 1217 | public static function SUMXMY2($matrixData1,$matrixData2) { |
@@ -1251,7 +1242,7 @@ discard block |
||
1251 | 1242 | * |
1252 | 1243 | * Truncates value to the number of fractional digits by number_digits. |
1253 | 1244 | * |
1254 | - * @param float $value |
|
1245 | + * @param integer $value |
|
1255 | 1246 | * @param int $digits |
1256 | 1247 | * @return float Truncated value |
1257 | 1248 | */ |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param p require p>0 |
146 | 146 | * @param q require q>0 |
147 | - * @return 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow |
|
147 | + * @return double if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow |
|
148 | 148 | * @author Jaco van Kooten |
149 | 149 | */ |
150 | 150 | private static function _logBeta($p, $q) { |
@@ -165,6 +165,8 @@ discard block |
||
165 | 165 | * Evaluates of continued fraction part of incomplete beta function. |
166 | 166 | * Based on an idea from Numerical Recipes (W.H. Press et al, 1992). |
167 | 167 | * @author Jaco van Kooten |
168 | + * @param double $p |
|
169 | + * @param double $q |
|
168 | 170 | */ |
169 | 171 | private static function _betaFraction($x, $p, $q) { |
170 | 172 | $c = 1.0; |
@@ -694,7 +696,6 @@ discard block |
||
694 | 696 | * |
695 | 697 | * @access public |
696 | 698 | * @category Statistical Functions |
697 | - * @param mixed $arg,... Data values |
|
698 | 699 | * @return float |
699 | 700 | */ |
700 | 701 | public static function AVEDEV() { |
@@ -742,7 +743,6 @@ discard block |
||
742 | 743 | * |
743 | 744 | * @access public |
744 | 745 | * @category Statistical Functions |
745 | - * @param mixed $arg,... Data values |
|
746 | 746 | * @return float |
747 | 747 | */ |
748 | 748 | public static function AVERAGE() { |
@@ -784,7 +784,6 @@ discard block |
||
784 | 784 | * |
785 | 785 | * @access public |
786 | 786 | * @category Statistical Functions |
787 | - * @param mixed $arg,... Data values |
|
788 | 787 | * @return float |
789 | 788 | */ |
790 | 789 | public static function AVERAGEA() { |
@@ -832,7 +831,6 @@ discard block |
||
832 | 831 | * |
833 | 832 | * @access public |
834 | 833 | * @category Mathematical and Trigonometric Functions |
835 | - * @param mixed $arg,... Data values |
|
836 | 834 | * @param string $condition The criteria that defines which cells will be checked. |
837 | 835 | * @return float |
838 | 836 | */ |
@@ -876,7 +874,6 @@ discard block |
||
876 | 874 | * @param float $value Value at which you want to evaluate the distribution |
877 | 875 | * @param float $alpha Parameter to the distribution |
878 | 876 | * @param float $beta Parameter to the distribution |
879 | - * @param boolean $cumulative |
|
880 | 877 | * @return float |
881 | 878 | * |
882 | 879 | */ |
@@ -912,7 +909,6 @@ discard block |
||
912 | 909 | * @param float $probability Probability at which you want to evaluate the distribution |
913 | 910 | * @param float $alpha Parameter to the distribution |
914 | 911 | * @param float $beta Parameter to the distribution |
915 | - * @param boolean $cumulative |
|
916 | 912 | * @return float |
917 | 913 | * |
918 | 914 | */ |
@@ -1156,7 +1152,6 @@ discard block |
||
1156 | 1152 | * |
1157 | 1153 | * @access public |
1158 | 1154 | * @category Statistical Functions |
1159 | - * @param mixed $arg,... Data values |
|
1160 | 1155 | * @return int |
1161 | 1156 | */ |
1162 | 1157 | public static function COUNT() { |
@@ -1191,7 +1186,6 @@ discard block |
||
1191 | 1186 | * |
1192 | 1187 | * @access public |
1193 | 1188 | * @category Statistical Functions |
1194 | - * @param mixed $arg,... Data values |
|
1195 | 1189 | * @return int |
1196 | 1190 | */ |
1197 | 1191 | public static function COUNTA() { |
@@ -1222,7 +1216,6 @@ discard block |
||
1222 | 1216 | * |
1223 | 1217 | * @access public |
1224 | 1218 | * @category Statistical Functions |
1225 | - * @param mixed $arg,... Data values |
|
1226 | 1219 | * @return int |
1227 | 1220 | */ |
1228 | 1221 | public static function COUNTBLANK() { |
@@ -1253,7 +1246,6 @@ discard block |
||
1253 | 1246 | * |
1254 | 1247 | * @access public |
1255 | 1248 | * @category Statistical Functions |
1256 | - * @param mixed $arg,... Data values |
|
1257 | 1249 | * @param string $condition The criteria that defines which cells will be counted. |
1258 | 1250 | * @return int |
1259 | 1251 | */ |
@@ -1425,7 +1417,6 @@ discard block |
||
1425 | 1417 | * |
1426 | 1418 | * @access public |
1427 | 1419 | * @category Statistical Functions |
1428 | - * @param mixed $arg,... Data values |
|
1429 | 1420 | * @return float |
1430 | 1421 | */ |
1431 | 1422 | public static function DEVSQ() { |
@@ -1700,7 +1691,6 @@ discard block |
||
1700 | 1691 | * |
1701 | 1692 | * @access public |
1702 | 1693 | * @category Statistical Functions |
1703 | - * @param mixed $arg,... Data values |
|
1704 | 1694 | * @return float |
1705 | 1695 | */ |
1706 | 1696 | public static function GEOMEAN() { |
@@ -1759,7 +1749,6 @@ discard block |
||
1759 | 1749 | * |
1760 | 1750 | * @access public |
1761 | 1751 | * @category Statistical Functions |
1762 | - * @param mixed $arg,... Data values |
|
1763 | 1752 | * @return float |
1764 | 1753 | */ |
1765 | 1754 | public static function HARMEAN() { |
@@ -1911,8 +1900,6 @@ discard block |
||
1911 | 1900 | * |
1912 | 1901 | * @access public |
1913 | 1902 | * @category Statistical Functions |
1914 | - * @param mixed $arg,... Data values |
|
1915 | - * @param int $entry Position (ordered from the largest) in the array or range of data to return |
|
1916 | 1903 | * @return float |
1917 | 1904 | * |
1918 | 1905 | */ |
@@ -2059,7 +2046,6 @@ discard block |
||
2059 | 2046 | * |
2060 | 2047 | * Returns the inverse of the normal cumulative distribution |
2061 | 2048 | * |
2062 | - * @param float $value |
|
2063 | 2049 | * @return float |
2064 | 2050 | * |
2065 | 2051 | * @todo Try implementing P J Acklam's refinement algorithm for greater |
@@ -2116,7 +2102,6 @@ discard block |
||
2116 | 2102 | * |
2117 | 2103 | * @access public |
2118 | 2104 | * @category Statistical Functions |
2119 | - * @param mixed $arg,... Data values |
|
2120 | 2105 | * @return float |
2121 | 2106 | */ |
2122 | 2107 | public static function MAX() { |
@@ -2152,7 +2137,6 @@ discard block |
||
2152 | 2137 | * |
2153 | 2138 | * @access public |
2154 | 2139 | * @category Statistical Functions |
2155 | - * @param mixed $arg,... Data values |
|
2156 | 2140 | * @return float |
2157 | 2141 | */ |
2158 | 2142 | public static function MAXA() { |
@@ -2193,7 +2177,6 @@ discard block |
||
2193 | 2177 | * |
2194 | 2178 | * @access public |
2195 | 2179 | * @category Mathematical and Trigonometric Functions |
2196 | - * @param mixed $arg,... Data values |
|
2197 | 2180 | * @param string $condition The criteria that defines which cells will be checked. |
2198 | 2181 | * @return float |
2199 | 2182 | */ |
@@ -2233,7 +2216,6 @@ discard block |
||
2233 | 2216 | * |
2234 | 2217 | * @access public |
2235 | 2218 | * @category Statistical Functions |
2236 | - * @param mixed $arg,... Data values |
|
2237 | 2219 | * @return float |
2238 | 2220 | */ |
2239 | 2221 | public static function MEDIAN() { |
@@ -2278,7 +2260,6 @@ discard block |
||
2278 | 2260 | * |
2279 | 2261 | * @access public |
2280 | 2262 | * @category Statistical Functions |
2281 | - * @param mixed $arg,... Data values |
|
2282 | 2263 | * @return float |
2283 | 2264 | */ |
2284 | 2265 | public static function MIN() { |
@@ -2314,7 +2295,6 @@ discard block |
||
2314 | 2295 | * |
2315 | 2296 | * @access public |
2316 | 2297 | * @category Statistical Functions |
2317 | - * @param mixed $arg,... Data values |
|
2318 | 2298 | * @return float |
2319 | 2299 | */ |
2320 | 2300 | public static function MINA() { |
@@ -2355,7 +2335,6 @@ discard block |
||
2355 | 2335 | * |
2356 | 2336 | * @access public |
2357 | 2337 | * @category Mathematical and Trigonometric Functions |
2358 | - * @param mixed $arg,... Data values |
|
2359 | 2338 | * @param string $condition The criteria that defines which cells will be checked. |
2360 | 2339 | * @return float |
2361 | 2340 | */ |
@@ -2429,7 +2408,6 @@ discard block |
||
2429 | 2408 | * |
2430 | 2409 | * @access public |
2431 | 2410 | * @category Statistical Functions |
2432 | - * @param mixed $arg,... Data values |
|
2433 | 2411 | * @return float |
2434 | 2412 | */ |
2435 | 2413 | public static function MODE() { |
@@ -2534,9 +2512,9 @@ discard block |
||
2534 | 2512 | * |
2535 | 2513 | * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. |
2536 | 2514 | * |
2537 | - * @param float $value |
|
2538 | 2515 | * @param float $mean Mean Value |
2539 | 2516 | * @param float $stdDev Standard Deviation |
2517 | + * @param double $probability |
|
2540 | 2518 | * @return float |
2541 | 2519 | * |
2542 | 2520 | */ |
@@ -2598,8 +2576,6 @@ discard block |
||
2598 | 2576 | * |
2599 | 2577 | * @access public |
2600 | 2578 | * @category Statistical Functions |
2601 | - * @param mixed $arg,... Data values |
|
2602 | - * @param float $entry Percentile value in the range 0..1, inclusive. |
|
2603 | 2579 | * @return float |
2604 | 2580 | */ |
2605 | 2581 | public static function PERCENTILE() { |
@@ -2759,8 +2735,6 @@ discard block |
||
2759 | 2735 | * |
2760 | 2736 | * @access public |
2761 | 2737 | * @category Statistical Functions |
2762 | - * @param mixed $arg,... Data values |
|
2763 | - * @param int $entry Quartile value in the range 1..3, inclusive. |
|
2764 | 2738 | * @return float |
2765 | 2739 | */ |
2766 | 2740 | public static function QUARTILE() { |
@@ -2918,8 +2892,6 @@ discard block |
||
2918 | 2892 | * |
2919 | 2893 | * @access public |
2920 | 2894 | * @category Statistical Functions |
2921 | - * @param mixed $arg,... Data values |
|
2922 | - * @param int $entry Position (ordered from the smallest) in the array or range of data to return |
|
2923 | 2895 | * @return float |
2924 | 2896 | */ |
2925 | 2897 | public static function SMALL() { |
@@ -2984,7 +2956,6 @@ discard block |
||
2984 | 2956 | * |
2985 | 2957 | * @access public |
2986 | 2958 | * @category Statistical Functions |
2987 | - * @param mixed $arg,... Data values |
|
2988 | 2959 | * @return float |
2989 | 2960 | */ |
2990 | 2961 | public static function STDEV() { |
@@ -3031,7 +3002,6 @@ discard block |
||
3031 | 3002 | * |
3032 | 3003 | * @access public |
3033 | 3004 | * @category Statistical Functions |
3034 | - * @param mixed $arg,... Data values |
|
3035 | 3005 | * @return float |
3036 | 3006 | */ |
3037 | 3007 | public static function STDEVA() { |
@@ -3083,7 +3053,6 @@ discard block |
||
3083 | 3053 | * |
3084 | 3054 | * @access public |
3085 | 3055 | * @category Statistical Functions |
3086 | - * @param mixed $arg,... Data values |
|
3087 | 3056 | * @return float |
3088 | 3057 | */ |
3089 | 3058 | public static function STDEVP() { |
@@ -3130,7 +3099,6 @@ discard block |
||
3130 | 3099 | * |
3131 | 3100 | * @access public |
3132 | 3101 | * @category Statistical Functions |
3133 | - * @param mixed $arg,... Data values |
|
3134 | 3102 | * @return float |
3135 | 3103 | */ |
3136 | 3104 | public static function STDEVPA() { |
@@ -3358,8 +3326,6 @@ discard block |
||
3358 | 3326 | * |
3359 | 3327 | * @access public |
3360 | 3328 | * @category Statistical Functions |
3361 | - * @param mixed $arg,... Data values |
|
3362 | - * @param float $discard Percentage to discard |
|
3363 | 3329 | * @return float |
3364 | 3330 | */ |
3365 | 3331 | public static function TRIMMEAN() { |
@@ -3401,7 +3367,6 @@ discard block |
||
3401 | 3367 | * |
3402 | 3368 | * @access public |
3403 | 3369 | * @category Statistical Functions |
3404 | - * @param mixed $arg,... Data values |
|
3405 | 3370 | * @return float |
3406 | 3371 | */ |
3407 | 3372 | public static function VARFunc() { |
@@ -3443,7 +3408,6 @@ discard block |
||
3443 | 3408 | * |
3444 | 3409 | * @access public |
3445 | 3410 | * @category Statistical Functions |
3446 | - * @param mixed $arg,... Data values |
|
3447 | 3411 | * @return float |
3448 | 3412 | */ |
3449 | 3413 | public static function VARA() { |
@@ -3496,7 +3460,6 @@ discard block |
||
3496 | 3460 | * |
3497 | 3461 | * @access public |
3498 | 3462 | * @category Statistical Functions |
3499 | - * @param mixed $arg,... Data values |
|
3500 | 3463 | * @return float |
3501 | 3464 | */ |
3502 | 3465 | public static function VARP() { |
@@ -3538,7 +3501,6 @@ discard block |
||
3538 | 3501 | * |
3539 | 3502 | * @access public |
3540 | 3503 | * @category Statistical Functions |
3541 | - * @param mixed $arg,... Data values |
|
3542 | 3504 | * @return float |
3543 | 3505 | */ |
3544 | 3506 | public static function VARPA() { |
@@ -3621,10 +3583,6 @@ discard block |
||
3621 | 3583 | * Returns the Weibull distribution. Use this distribution in reliability |
3622 | 3584 | * analysis, such as calculating a device's mean time to failure. |
3623 | 3585 | * |
3624 | - * @param float $value |
|
3625 | - * @param float $alpha Alpha Parameter |
|
3626 | - * @param float $beta Beta Parameter |
|
3627 | - * @param boolean $cumulative |
|
3628 | 3586 | * @return float |
3629 | 3587 | * |
3630 | 3588 | */ |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | -require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/trendClass.php'; |
|
39 | +require_once PHPEXCEL_ROOT.'PHPExcel/Shared/trend/trendClass.php'; |
|
40 | 40 | |
41 | 41 | |
42 | 42 | /** LOG_GAMMA_X_MAX_VALUE */ |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | class PHPExcel_Calculation_Statistical { |
63 | 63 | |
64 | 64 | |
65 | - private static function _checkTrendArrays(&$array1,&$array2) { |
|
66 | - if (!is_array($array1)) { $array1 = array($array1); } |
|
67 | - if (!is_array($array2)) { $array2 = array($array2); } |
|
65 | + private static function _checkTrendArrays(&$array1, &$array2) { |
|
66 | + if ( ! is_array($array1)) { $array1 = array($array1); } |
|
67 | + if ( ! is_array($array2)) { $array2 = array($array2); } |
|
68 | 68 | |
69 | 69 | $array1 = PHPExcel_Calculation_Functions::flattenArray($array1); |
70 | 70 | $array2 = PHPExcel_Calculation_Functions::flattenArray($array2); |
71 | - foreach($array1 as $key => $value) { |
|
71 | + foreach ($array1 as $key => $value) { |
|
72 | 72 | if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { |
73 | 73 | unset($array1[$key]); |
74 | 74 | unset($array2[$key]); |
75 | 75 | } |
76 | 76 | } |
77 | - foreach($array2 as $key => $value) { |
|
77 | + foreach ($array2 as $key => $value) { |
|
78 | 78 | if ((is_bool($value)) || (is_string($value)) || (is_null($value))) { |
79 | 79 | unset($array1[$key]); |
80 | 80 | unset($array2[$key]); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // Function cache for _logBeta function |
138 | 138 | private static $_logBetaCache_p = 0.0; |
139 | 139 | private static $_logBetaCache_q = 0.0; |
140 | - private static $_logBetaCache_result = 0.0; |
|
140 | + private static $_logBetaCache_result = 0.0; |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * The natural logarithm of the beta function. |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | } |
178 | 178 | $h = 1.0 / $h; |
179 | 179 | $frac = $h; |
180 | - $m = 1; |
|
180 | + $m = 1; |
|
181 | 181 | $delta = 0.0; |
182 | - while ($m <= MAX_ITERATIONS && abs($delta-1.0) > PRECISION ) { |
|
182 | + while ($m <= MAX_ITERATIONS && abs($delta - 1.0) > PRECISION) { |
|
183 | 183 | $m2 = 2 * $m; |
184 | 184 | // even index for d |
185 | - $d = $m * ($q - $m) * $x / ( ($p_minus + $m2) * ($p + $m2)); |
|
185 | + $d = $m * ($q - $m) * $x / (($p_minus + $m2) * ($p + $m2)); |
|
186 | 186 | $h = 1.0 + $d * $h; |
187 | 187 | if (abs($h) < XMININ) { |
188 | 188 | $h = XMININ; |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | */ |
257 | 257 | |
258 | 258 | // Function cache for logGamma |
259 | - private static $_logGammaCache_result = 0.0; |
|
260 | - private static $_logGammaCache_x = 0.0; |
|
259 | + private static $_logGammaCache_result = 0.0; |
|
260 | + private static $_logGammaCache_x = 0.0; |
|
261 | 261 | |
262 | 262 | private static function _logGamma($x) { |
263 | 263 | // Log Gamma related constants |
@@ -265,57 +265,57 @@ discard block |
||
265 | 265 | static $lg_d2 = 0.4227843350984671393993777; |
266 | 266 | static $lg_d4 = 1.791759469228055000094023; |
267 | 267 | |
268 | - static $lg_p1 = array( 4.945235359296727046734888, |
|
268 | + static $lg_p1 = array(4.945235359296727046734888, |
|
269 | 269 | 201.8112620856775083915565, |
270 | 270 | 2290.838373831346393026739, |
271 | 271 | 11319.67205903380828685045, |
272 | 272 | 28557.24635671635335736389, |
273 | 273 | 38484.96228443793359990269, |
274 | 274 | 26377.48787624195437963534, |
275 | - 7225.813979700288197698961 ); |
|
276 | - static $lg_p2 = array( 4.974607845568932035012064, |
|
275 | + 7225.813979700288197698961); |
|
276 | + static $lg_p2 = array(4.974607845568932035012064, |
|
277 | 277 | 542.4138599891070494101986, |
278 | 278 | 15506.93864978364947665077, |
279 | 279 | 184793.2904445632425417223, |
280 | 280 | 1088204.76946882876749847, |
281 | 281 | 3338152.967987029735917223, |
282 | 282 | 5106661.678927352456275255, |
283 | - 3074109.054850539556250927 ); |
|
284 | - static $lg_p4 = array( 14745.02166059939948905062, |
|
283 | + 3074109.054850539556250927); |
|
284 | + static $lg_p4 = array(14745.02166059939948905062, |
|
285 | 285 | 2426813.369486704502836312, |
286 | 286 | 121475557.4045093227939592, |
287 | 287 | 2663432449.630976949898078, |
288 | 288 | 29403789566.34553899906876, |
289 | 289 | 170266573776.5398868392998, |
290 | 290 | 492612579337.743088758812, |
291 | - 560625185622.3951465078242 ); |
|
291 | + 560625185622.3951465078242); |
|
292 | 292 | |
293 | - static $lg_q1 = array( 67.48212550303777196073036, |
|
293 | + static $lg_q1 = array(67.48212550303777196073036, |
|
294 | 294 | 1113.332393857199323513008, |
295 | 295 | 7738.757056935398733233834, |
296 | 296 | 27639.87074403340708898585, |
297 | 297 | 54993.10206226157329794414, |
298 | 298 | 61611.22180066002127833352, |
299 | 299 | 36351.27591501940507276287, |
300 | - 8785.536302431013170870835 ); |
|
301 | - static $lg_q2 = array( 183.0328399370592604055942, |
|
300 | + 8785.536302431013170870835); |
|
301 | + static $lg_q2 = array(183.0328399370592604055942, |
|
302 | 302 | 7765.049321445005871323047, |
303 | 303 | 133190.3827966074194402448, |
304 | 304 | 1136705.821321969608938755, |
305 | 305 | 5267964.117437946917577538, |
306 | 306 | 13467014.54311101692290052, |
307 | 307 | 17827365.30353274213975932, |
308 | - 9533095.591844353613395747 ); |
|
309 | - static $lg_q4 = array( 2690.530175870899333379843, |
|
308 | + 9533095.591844353613395747); |
|
309 | + static $lg_q4 = array(2690.530175870899333379843, |
|
310 | 310 | 639388.5654300092398984238, |
311 | 311 | 41355999.30241388052042842, |
312 | 312 | 1120872109.61614794137657, |
313 | 313 | 14886137286.78813811542398, |
314 | 314 | 101680358627.2438228077304, |
315 | 315 | 341747634550.7377132798597, |
316 | - 446315818741.9713286462081 ); |
|
316 | + 446315818741.9713286462081); |
|
317 | 317 | |
318 | - static $lg_c = array( -0.001910444077728, |
|
318 | + static $lg_c = array( -0.001910444077728, |
|
319 | 319 | 8.4171387781295e-4, |
320 | 320 | -5.952379913043012e-4, |
321 | 321 | 7.93650793500350248e-4, |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | // Rough estimate of the fourth root of logGamma_xBig |
327 | 327 | static $lg_frtbig = 2.25e76; |
328 | - static $pnt68 = 0.6796875; |
|
328 | + static $pnt68 = 0.6796875; |
|
329 | 329 | |
330 | 330 | |
331 | 331 | if ($x == self::$_logGammaCache_x) { |
@@ -422,17 +422,17 @@ discard block |
||
422 | 422 | // |
423 | 423 | // Private implementation of the incomplete Gamma function |
424 | 424 | // |
425 | - private static function _incompleteGamma($a,$x) { |
|
425 | + private static function _incompleteGamma($a, $x) { |
|
426 | 426 | static $max = 32; |
427 | 427 | $summer = 0; |
428 | - for ($n=0; $n<=$max; ++$n) { |
|
428 | + for ($n = 0; $n <= $max; ++$n) { |
|
429 | 429 | $divisor = $a; |
430 | - for ($i=1; $i<=$n; ++$i) { |
|
430 | + for ($i = 1; $i <= $n; ++$i) { |
|
431 | 431 | $divisor *= ($a + $i); |
432 | 432 | } |
433 | - $summer += (pow($x,$n) / $divisor); |
|
433 | + $summer += (pow($x, $n) / $divisor); |
|
434 | 434 | } |
435 | - return pow($x,$a) * exp(0-$x) * $summer; |
|
435 | + return pow($x, $a) * exp(0 - $x) * $summer; |
|
436 | 436 | } // function _incompleteGamma() |
437 | 437 | |
438 | 438 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | if ($data == 0.0) return 0; |
444 | 444 | |
445 | 445 | static $p0 = 1.000000000190015; |
446 | - static $p = array ( 1 => 76.18009172947146, |
|
446 | + static $p = array(1 => 76.18009172947146, |
|
447 | 447 | 2 => -86.50532032941677, |
448 | 448 | 3 => 24.01409824083091, |
449 | 449 | 4 => -1.231739572450155, |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $tmp -= ($x + 0.5) * log($tmp); |
457 | 457 | |
458 | 458 | $summer = $p0; |
459 | - for ($j=1;$j<=6;++$j) { |
|
459 | + for ($j = 1; $j <= 6; ++$j) { |
|
460 | 460 | $summer += ($p[$j] / ++$y); |
461 | 461 | } |
462 | 462 | return exp(0 - $tmp + log(SQRT2PI * $summer / $x)); |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | // Input paramater is $p - probability - where 0 < p < 1. |
486 | 486 | |
487 | 487 | // Coefficients in rational approximations |
488 | - static $a = array( 1 => -3.969683028665376e+01, |
|
488 | + static $a = array(1 => -3.969683028665376e+01, |
|
489 | 489 | 2 => 2.209460984245205e+02, |
490 | 490 | 3 => -2.759285104469687e+02, |
491 | 491 | 4 => 1.383577518672690e+02, |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | 6 => 2.506628277459239e+00 |
494 | 494 | ); |
495 | 495 | |
496 | - static $b = array( 1 => -5.447609879822406e+01, |
|
496 | + static $b = array(1 => -5.447609879822406e+01, |
|
497 | 497 | 2 => 1.615858368580409e+02, |
498 | 498 | 3 => -1.556989798598866e+02, |
499 | 499 | 4 => 6.680131188771972e+01, |
500 | 500 | 5 => -1.328068155288572e+01 |
501 | 501 | ); |
502 | 502 | |
503 | - static $c = array( 1 => -7.784894002430293e-03, |
|
503 | + static $c = array(1 => -7.784894002430293e-03, |
|
504 | 504 | 2 => -3.223964580411365e-01, |
505 | 505 | 3 => -2.400758277161838e+00, |
506 | 506 | 4 => -2.549732539343734e+00, |
@@ -508,15 +508,15 @@ discard block |
||
508 | 508 | 6 => 2.938163982698783e+00 |
509 | 509 | ); |
510 | 510 | |
511 | - static $d = array( 1 => 7.784695709041462e-03, |
|
511 | + static $d = array(1 => 7.784695709041462e-03, |
|
512 | 512 | 2 => 3.224671290700398e-01, |
513 | 513 | 3 => 2.445134137142996e+00, |
514 | 514 | 4 => 3.754408661907416e+00 |
515 | 515 | ); |
516 | 516 | |
517 | 517 | // Define lower and upper region break-points. |
518 | - $p_low = 0.02425; //Use lower region approx. below this |
|
519 | - $p_high = 1 - $p_low; //Use upper region approx. above this |
|
518 | + $p_low = 0.02425; //Use lower region approx. below this |
|
519 | + $p_high = 1 - $p_low; //Use upper region approx. above this |
|
520 | 520 | |
521 | 521 | if (0 < $p && $p < $p_low) { |
522 | 522 | // Rational approximation for lower region. |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } else { |
663 | 663 | $R = 1 - $p; |
664 | 664 | } |
665 | - $R = pow(-log($R),2); |
|
665 | + $R = pow(-log($R), 2); |
|
666 | 666 | |
667 | 667 | // computation for p not close to 0, 0.5 or 1. |
668 | 668 | If ($R <= $split2) { |
@@ -708,11 +708,11 @@ discard block |
||
708 | 708 | $aCount = 0; |
709 | 709 | foreach ($aArgs as $k => $arg) { |
710 | 710 | if ((is_bool($arg)) && |
711 | - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
711 | + (( ! PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
712 | 712 | $arg = (integer) $arg; |
713 | 713 | } |
714 | 714 | // Is it a numeric value? |
715 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
715 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
716 | 716 | if (is_null($returnValue)) { |
717 | 717 | $returnValue = abs($arg - $aMean); |
718 | 718 | } else { |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | // Loop through arguments |
752 | 752 | foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { |
753 | 753 | if ((is_bool($arg)) && |
754 | - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
754 | + (( ! PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
755 | 755 | $arg = (integer) $arg; |
756 | 756 | } |
757 | 757 | // Is it a numeric value? |
758 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
758 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
759 | 759 | if (is_null($returnValue)) { |
760 | 760 | $returnValue = $arg; |
761 | 761 | } else { |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | // Loop through arguments |
796 | 796 | foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) { |
797 | 797 | if ((is_bool($arg)) && |
798 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
798 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
799 | 799 | } else { |
800 | 800 | if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { |
801 | 801 | if (is_bool($arg)) { |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | * @param string $condition The criteria that defines which cells will be checked. |
837 | 837 | * @return float |
838 | 838 | */ |
839 | - public static function AVERAGEIF($aArgs,$condition,$averageArgs = array()) { |
|
839 | + public static function AVERAGEIF($aArgs, $condition, $averageArgs = array()) { |
|
840 | 840 | // Return value |
841 | 841 | $returnValue = 0; |
842 | 842 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | // Loop through arguments |
850 | 850 | $aCount = 0; |
851 | 851 | foreach ($aArgs as $key => $arg) { |
852 | - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
852 | + if ( ! is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
853 | 853 | $testCondition = '='.$arg.$condition; |
854 | 854 | if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
855 | 855 | if ((is_null($returnValue)) || ($arg > $returnValue)) { |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | * @return float |
881 | 881 | * |
882 | 882 | */ |
883 | - public static function BETADIST($value,$alpha,$beta,$rMin=0,$rMax=1) { |
|
883 | + public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) { |
|
884 | 884 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
885 | 885 | $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
886 | 886 | $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | } |
899 | 899 | $value -= $rMin; |
900 | 900 | $value /= ($rMax - $rMin); |
901 | - return self::_incompleteBeta($value,$alpha,$beta); |
|
901 | + return self::_incompleteBeta($value, $alpha, $beta); |
|
902 | 902 | } |
903 | 903 | return PHPExcel_Calculation_Functions::VALUE(); |
904 | 904 | } // function BETADIST() |
@@ -916,9 +916,9 @@ discard block |
||
916 | 916 | * @return float |
917 | 917 | * |
918 | 918 | */ |
919 | - public static function BETAINV($probability,$alpha,$beta,$rMin=0,$rMax=1) { |
|
920 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
921 | - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
919 | + public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1) { |
|
920 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
921 | + $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
922 | 922 | $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); |
923 | 923 | $rMin = PHPExcel_Calculation_Functions::flattenSingleValue($rMin); |
924 | 924 | $rMax = PHPExcel_Calculation_Functions::flattenSingleValue($rMax); |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | if ($i == MAX_ITERATIONS) { |
951 | 951 | return PHPExcel_Calculation_Functions::NA(); |
952 | 952 | } |
953 | - return round($rMin + $guess * ($rMax - $rMin),12); |
|
953 | + return round($rMin + $guess * ($rMax - $rMin), 12); |
|
954 | 954 | } |
955 | 955 | return PHPExcel_Calculation_Functions::VALUE(); |
956 | 956 | } // function BETAINV() |
@@ -975,9 +975,9 @@ discard block |
||
975 | 975 | * |
976 | 976 | */ |
977 | 977 | public static function BINOMDIST($value, $trials, $probability, $cumulative) { |
978 | - $value = floor(PHPExcel_Calculation_Functions::flattenSingleValue($value)); |
|
979 | - $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials)); |
|
980 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
978 | + $value = floor(PHPExcel_Calculation_Functions::flattenSingleValue($value)); |
|
979 | + $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials)); |
|
980 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
981 | 981 | |
982 | 982 | if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) { |
983 | 983 | if (($value < 0) || ($value > $trials)) { |
@@ -990,11 +990,11 @@ discard block |
||
990 | 990 | if ($cumulative) { |
991 | 991 | $summer = 0; |
992 | 992 | for ($i = 0; $i <= $value; ++$i) { |
993 | - $summer += PHPExcel_Calculation_MathTrig::COMBIN($trials,$i) * pow($probability,$i) * pow(1 - $probability,$trials - $i); |
|
993 | + $summer += PHPExcel_Calculation_MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i); |
|
994 | 994 | } |
995 | 995 | return $summer; |
996 | 996 | } else { |
997 | - return PHPExcel_Calculation_MathTrig::COMBIN($trials,$value) * pow($probability,$value) * pow(1 - $probability,$trials - $value) ; |
|
997 | + return PHPExcel_Calculation_MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value); |
|
998 | 998 | } |
999 | 999 | } |
1000 | 1000 | } |
@@ -1012,8 +1012,8 @@ discard block |
||
1012 | 1012 | * @return float |
1013 | 1013 | */ |
1014 | 1014 | public static function CHIDIST($value, $degrees) { |
1015 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1016 | - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
1015 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1016 | + $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
1017 | 1017 | |
1018 | 1018 | if ((is_numeric($value)) && (is_numeric($degrees))) { |
1019 | 1019 | if ($degrees < 1) { |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | } |
1026 | 1026 | return PHPExcel_Calculation_Functions::NaN(); |
1027 | 1027 | } |
1028 | - return 1 - (self::_incompleteGamma($degrees/2,$value/2) / self::_gamma($degrees/2)); |
|
1028 | + return 1 - (self::_incompleteGamma($degrees / 2, $value / 2) / self::_gamma($degrees / 2)); |
|
1029 | 1029 | } |
1030 | 1030 | return PHPExcel_Calculation_Functions::VALUE(); |
1031 | 1031 | } // function CHIDIST() |
@@ -1041,8 +1041,8 @@ discard block |
||
1041 | 1041 | * @return float |
1042 | 1042 | */ |
1043 | 1043 | public static function CHIINV($probability, $degrees) { |
1044 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
1045 | - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
1044 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
1045 | + $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
1046 | 1046 | |
1047 | 1047 | if ((is_numeric($probability)) && (is_numeric($degrees))) { |
1048 | 1048 | |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $xHi = 0; |
1051 | 1051 | |
1052 | 1052 | $x = $xNew = 1; |
1053 | - $dx = 1; |
|
1053 | + $dx = 1; |
|
1054 | 1054 | $i = 0; |
1055 | 1055 | |
1056 | 1056 | while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | if ($i == MAX_ITERATIONS) { |
1082 | 1082 | return PHPExcel_Calculation_Functions::NA(); |
1083 | 1083 | } |
1084 | - return round($x,12); |
|
1084 | + return round($x, 12); |
|
1085 | 1085 | } |
1086 | 1086 | return PHPExcel_Calculation_Functions::VALUE(); |
1087 | 1087 | } // function CHIINV() |
@@ -1098,10 +1098,10 @@ discard block |
||
1098 | 1098 | * @return float |
1099 | 1099 | * |
1100 | 1100 | */ |
1101 | - public static function CONFIDENCE($alpha,$stdDev,$size) { |
|
1102 | - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
1103 | - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
1104 | - $size = floor(PHPExcel_Calculation_Functions::flattenSingleValue($size)); |
|
1101 | + public static function CONFIDENCE($alpha, $stdDev, $size) { |
|
1102 | + $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
1103 | + $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
1104 | + $size = floor(PHPExcel_Calculation_Functions::flattenSingleValue($size)); |
|
1105 | 1105 | |
1106 | 1106 | if ((is_numeric($alpha)) && (is_numeric($stdDev)) && (is_numeric($size))) { |
1107 | 1107 | if (($alpha <= 0) || ($alpha >= 1)) { |
@@ -1125,11 +1125,11 @@ discard block |
||
1125 | 1125 | * @param array of mixed Data Series X |
1126 | 1126 | * @return float |
1127 | 1127 | */ |
1128 | - public static function CORREL($yValues,$xValues=null) { |
|
1129 | - if ((is_null($xValues)) || (!is_array($yValues)) || (!is_array($xValues))) { |
|
1128 | + public static function CORREL($yValues, $xValues = null) { |
|
1129 | + if ((is_null($xValues)) || ( ! is_array($yValues)) || ( ! is_array($xValues))) { |
|
1130 | 1130 | return PHPExcel_Calculation_Functions::VALUE(); |
1131 | 1131 | } |
1132 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1132 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
1133 | 1133 | return PHPExcel_Calculation_Functions::VALUE(); |
1134 | 1134 | } |
1135 | 1135 | $yValueCount = count($yValues); |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | return PHPExcel_Calculation_Functions::DIV0(); |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
1144 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
1145 | 1145 | return $bestFitLinear->getCorrelation(); |
1146 | 1146 | } // function CORREL() |
1147 | 1147 | |
@@ -1167,11 +1167,11 @@ discard block |
||
1167 | 1167 | $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()); |
1168 | 1168 | foreach ($aArgs as $k => $arg) { |
1169 | 1169 | if ((is_bool($arg)) && |
1170 | - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
1170 | + (( ! PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
1171 | 1171 | $arg = (integer) $arg; |
1172 | 1172 | } |
1173 | 1173 | // Is it a numeric value? |
1174 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
1174 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
1175 | 1175 | ++$returnValue; |
1176 | 1176 | } |
1177 | 1177 | } |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | * @param string $condition The criteria that defines which cells will be counted. |
1258 | 1258 | * @return int |
1259 | 1259 | */ |
1260 | - public static function COUNTIF($aArgs,$condition) { |
|
1260 | + public static function COUNTIF($aArgs, $condition) { |
|
1261 | 1261 | // Return value |
1262 | 1262 | $returnValue = 0; |
1263 | 1263 | |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); |
1266 | 1266 | // Loop through arguments |
1267 | 1267 | foreach ($aArgs as $arg) { |
1268 | - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
1268 | + if ( ! is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
1269 | 1269 | $testCondition = '='.$arg.$condition; |
1270 | 1270 | if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
1271 | 1271 | // Is it a value within our criteria |
@@ -1287,8 +1287,8 @@ discard block |
||
1287 | 1287 | * @param array of mixed Data Series X |
1288 | 1288 | * @return float |
1289 | 1289 | */ |
1290 | - public static function COVAR($yValues,$xValues) { |
|
1291 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1290 | + public static function COVAR($yValues, $xValues) { |
|
1291 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
1292 | 1292 | return PHPExcel_Calculation_Functions::VALUE(); |
1293 | 1293 | } |
1294 | 1294 | $yValueCount = count($yValues); |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | return PHPExcel_Calculation_Functions::DIV0(); |
1301 | 1301 | } |
1302 | 1302 | |
1303 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
1303 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
1304 | 1304 | return $bestFitLinear->getCovariance(); |
1305 | 1305 | } // function COVAR() |
1306 | 1306 | |
@@ -1325,9 +1325,9 @@ discard block |
||
1325 | 1325 | * |
1326 | 1326 | */ |
1327 | 1327 | public static function CRITBINOM($trials, $probability, $alpha) { |
1328 | - $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials)); |
|
1329 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
1330 | - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
1328 | + $trials = floor(PHPExcel_Calculation_Functions::flattenSingleValue($trials)); |
|
1329 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
1330 | + $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
1331 | 1331 | |
1332 | 1332 | if ((is_numeric($trials)) && (is_numeric($probability)) && (is_numeric($alpha))) { |
1333 | 1333 | if ($trials < 0) { |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | $t = sqrt(log(1 / ($alpha * $alpha))); |
1344 | 1344 | $trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t)); |
1345 | 1345 | } else { |
1346 | - $t = sqrt(log(1 / pow(1 - $alpha,2))); |
|
1346 | + $t = sqrt(log(1 / pow(1 - $alpha, 2))); |
|
1347 | 1347 | $trialsApprox = $t - (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t); |
1348 | 1348 | } |
1349 | 1349 | $Guess = floor($trials * $probability + $trialsApprox * sqrt($trials * $probability * (1 - $probability))); |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | $PreviousValue = 1; |
1365 | 1365 | $Done = False; |
1366 | 1366 | $k = $m + 1; |
1367 | - while ((!$Done) && ($k <= $trials)) { |
|
1367 | + while (( ! $Done) && ($k <= $trials)) { |
|
1368 | 1368 | $CurrentValue = $PreviousValue * ($trials - $k + 1) * $probability / ($k * (1 - $probability)); |
1369 | 1369 | $TotalUnscaledProbability += $CurrentValue; |
1370 | 1370 | if ($k == $Guess) { $UnscaledPGuess += $CurrentValue; } |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | $PreviousValue = 1; |
1378 | 1378 | $Done = False; |
1379 | 1379 | $k = $m - 1; |
1380 | - while ((!$Done) && ($k >= 0)) { |
|
1380 | + while (( ! $Done) && ($k >= 0)) { |
|
1381 | 1381 | $CurrentValue = $PreviousValue * $k + 1 * (1 - $probability) / (($trials - $k) * $probability); |
1382 | 1382 | $TotalUnscaledProbability += $CurrentValue; |
1383 | 1383 | if ($k == $Guess) { $UnscaledPGuess += $CurrentValue; } |
@@ -1440,14 +1440,14 @@ discard block |
||
1440 | 1440 | foreach ($aArgs as $k => $arg) { |
1441 | 1441 | // Is it a numeric value? |
1442 | 1442 | if ((is_bool($arg)) && |
1443 | - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
1443 | + (( ! PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
1444 | 1444 | $arg = (integer) $arg; |
1445 | 1445 | } |
1446 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
1446 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
1447 | 1447 | if (is_null($returnValue)) { |
1448 | - $returnValue = pow(($arg - $aMean),2); |
|
1448 | + $returnValue = pow(($arg - $aMean), 2); |
|
1449 | 1449 | } else { |
1450 | - $returnValue += pow(($arg - $aMean),2); |
|
1450 | + $returnValue += pow(($arg - $aMean), 2); |
|
1451 | 1451 | } |
1452 | 1452 | ++$aCount; |
1453 | 1453 | } |
@@ -1477,9 +1477,9 @@ discard block |
||
1477 | 1477 | * @return float |
1478 | 1478 | */ |
1479 | 1479 | public static function EXPONDIST($value, $lambda, $cumulative) { |
1480 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1481 | - $lambda = PHPExcel_Calculation_Functions::flattenSingleValue($lambda); |
|
1482 | - $cumulative = PHPExcel_Calculation_Functions::flattenSingleValue($cumulative); |
|
1480 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1481 | + $lambda = PHPExcel_Calculation_Functions::flattenSingleValue($lambda); |
|
1482 | + $cumulative = PHPExcel_Calculation_Functions::flattenSingleValue($cumulative); |
|
1483 | 1483 | |
1484 | 1484 | if ((is_numeric($value)) && (is_numeric($lambda))) { |
1485 | 1485 | if (($value < 0) || ($lambda < 0)) { |
@@ -1487,9 +1487,9 @@ discard block |
||
1487 | 1487 | } |
1488 | 1488 | if ((is_numeric($cumulative)) || (is_bool($cumulative))) { |
1489 | 1489 | if ($cumulative) { |
1490 | - return 1 - exp(0-$value*$lambda); |
|
1490 | + return 1 - exp(0 - $value * $lambda); |
|
1491 | 1491 | } else { |
1492 | - return $lambda * exp(0-$value*$lambda); |
|
1492 | + return $lambda * exp(0 - $value * $lambda); |
|
1493 | 1493 | } |
1494 | 1494 | } |
1495 | 1495 | } |
@@ -1508,13 +1508,13 @@ discard block |
||
1508 | 1508 | * @return float |
1509 | 1509 | */ |
1510 | 1510 | public static function FISHER($value) { |
1511 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1511 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1512 | 1512 | |
1513 | 1513 | if (is_numeric($value)) { |
1514 | 1514 | if (($value <= -1) || ($value >= 1)) { |
1515 | 1515 | return PHPExcel_Calculation_Functions::NaN(); |
1516 | 1516 | } |
1517 | - return 0.5 * log((1+$value)/(1-$value)); |
|
1517 | + return 0.5 * log((1 + $value) / (1 - $value)); |
|
1518 | 1518 | } |
1519 | 1519 | return PHPExcel_Calculation_Functions::VALUE(); |
1520 | 1520 | } // function FISHER() |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | * @return float |
1532 | 1532 | */ |
1533 | 1533 | public static function FISHERINV($value) { |
1534 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1534 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1535 | 1535 | |
1536 | 1536 | if (is_numeric($value)) { |
1537 | 1537 | return (exp(2 * $value) - 1) / (exp(2 * $value) + 1); |
@@ -1550,13 +1550,13 @@ discard block |
||
1550 | 1550 | * @param array of mixed Data Series X |
1551 | 1551 | * @return float |
1552 | 1552 | */ |
1553 | - public static function FORECAST($xValue,$yValues,$xValues) { |
|
1554 | - $xValue = PHPExcel_Calculation_Functions::flattenSingleValue($xValue); |
|
1555 | - if (!is_numeric($xValue)) { |
|
1553 | + public static function FORECAST($xValue, $yValues, $xValues) { |
|
1554 | + $xValue = PHPExcel_Calculation_Functions::flattenSingleValue($xValue); |
|
1555 | + if ( ! is_numeric($xValue)) { |
|
1556 | 1556 | return PHPExcel_Calculation_Functions::VALUE(); |
1557 | 1557 | } |
1558 | 1558 | |
1559 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1559 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
1560 | 1560 | return PHPExcel_Calculation_Functions::VALUE(); |
1561 | 1561 | } |
1562 | 1562 | $yValueCount = count($yValues); |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | return PHPExcel_Calculation_Functions::DIV0(); |
1569 | 1569 | } |
1570 | 1570 | |
1571 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
1571 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
1572 | 1572 | return $bestFitLinear->getValueOfYForX($xValue); |
1573 | 1573 | } // function FORECAST() |
1574 | 1574 | |
@@ -1585,8 +1585,8 @@ discard block |
||
1585 | 1585 | * @return float |
1586 | 1586 | * |
1587 | 1587 | */ |
1588 | - public static function GAMMADIST($value,$a,$b,$cumulative) { |
|
1589 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1588 | + public static function GAMMADIST($value, $a, $b, $cumulative) { |
|
1589 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1590 | 1590 | $a = PHPExcel_Calculation_Functions::flattenSingleValue($a); |
1591 | 1591 | $b = PHPExcel_Calculation_Functions::flattenSingleValue($b); |
1592 | 1592 | |
@@ -1596,9 +1596,9 @@ discard block |
||
1596 | 1596 | } |
1597 | 1597 | if ((is_numeric($cumulative)) || (is_bool($cumulative))) { |
1598 | 1598 | if ($cumulative) { |
1599 | - return self::_incompleteGamma($a,$value / $b) / self::_gamma($a); |
|
1599 | + return self::_incompleteGamma($a, $value / $b) / self::_gamma($a); |
|
1600 | 1600 | } else { |
1601 | - return (1 / (pow($b,$a) * self::_gamma($a))) * pow($value,$a-1) * exp(0-($value / $b)); |
|
1601 | + return (1 / (pow($b, $a) * self::_gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b)); |
|
1602 | 1602 | } |
1603 | 1603 | } |
1604 | 1604 | } |
@@ -1617,10 +1617,10 @@ discard block |
||
1617 | 1617 | * @return float |
1618 | 1618 | * |
1619 | 1619 | */ |
1620 | - public static function GAMMAINV($probability,$alpha,$beta) { |
|
1621 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
1622 | - $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
1623 | - $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); |
|
1620 | + public static function GAMMAINV($probability, $alpha, $beta) { |
|
1621 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
1622 | + $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
|
1623 | + $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); |
|
1624 | 1624 | |
1625 | 1625 | if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta))) { |
1626 | 1626 | if (($alpha <= 0) || ($beta <= 0) || ($probability < 0) || ($probability > 1)) { |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | |
1633 | 1633 | $x = $xNew = 1; |
1634 | 1634 | $error = $pdf = 0; |
1635 | - $dx = 1024; |
|
1635 | + $dx = 1024; |
|
1636 | 1636 | $i = 0; |
1637 | 1637 | |
1638 | 1638 | while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | * @return float |
1677 | 1677 | */ |
1678 | 1678 | public static function GAMMALN($value) { |
1679 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1679 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
1680 | 1680 | |
1681 | 1681 | if (is_numeric($value)) { |
1682 | 1682 | if ($value <= 0) { |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | |
1709 | 1709 | $aMean = PHPExcel_Calculation_MathTrig::PRODUCT($aArgs); |
1710 | 1710 | if (is_numeric($aMean) && ($aMean > 0)) { |
1711 | - $aCount = self::COUNT($aArgs) ; |
|
1711 | + $aCount = self::COUNT($aArgs); |
|
1712 | 1712 | if (self::MIN($aArgs) > 0) { |
1713 | 1713 | return pow($aMean, (1 / $aCount)); |
1714 | 1714 | } |
@@ -1728,19 +1728,19 @@ discard block |
||
1728 | 1728 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
1729 | 1729 | * @return array of float |
1730 | 1730 | */ |
1731 | - public static function GROWTH($yValues,$xValues=array(),$newValues=array(),$const=True) { |
|
1731 | + public static function GROWTH($yValues, $xValues = array(), $newValues = array(), $const = True) { |
|
1732 | 1732 | $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues); |
1733 | 1733 | $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues); |
1734 | 1734 | $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues); |
1735 | - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
1735 | + $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
1736 | 1736 | |
1737 | - $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const); |
|
1737 | + $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const); |
|
1738 | 1738 | if (empty($newValues)) { |
1739 | 1739 | $newValues = $bestFitExponential->getXValues(); |
1740 | 1740 | } |
1741 | 1741 | |
1742 | 1742 | $returnArray = array(); |
1743 | - foreach($newValues as $xValue) { |
|
1743 | + foreach ($newValues as $xValue) { |
|
1744 | 1744 | $returnArray[0][] = $bestFitExponential->getValueOfYForX($xValue); |
1745 | 1745 | } |
1746 | 1746 | |
@@ -1774,7 +1774,7 @@ discard block |
||
1774 | 1774 | $aCount = 0; |
1775 | 1775 | foreach ($aArgs as $arg) { |
1776 | 1776 | // Is it a numeric value? |
1777 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
1777 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
1778 | 1778 | if ($arg <= 0) { |
1779 | 1779 | return PHPExcel_Calculation_Functions::NaN(); |
1780 | 1780 | } |
@@ -1810,10 +1810,10 @@ discard block |
||
1810 | 1810 | * |
1811 | 1811 | */ |
1812 | 1812 | public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) { |
1813 | - $sampleSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleSuccesses)); |
|
1814 | - $sampleNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleNumber)); |
|
1815 | - $populationSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationSuccesses)); |
|
1816 | - $populationNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationNumber)); |
|
1813 | + $sampleSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleSuccesses)); |
|
1814 | + $sampleNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($sampleNumber)); |
|
1815 | + $populationSuccesses = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationSuccesses)); |
|
1816 | + $populationNumber = floor(PHPExcel_Calculation_Functions::flattenSingleValue($populationNumber)); |
|
1817 | 1817 | |
1818 | 1818 | if ((is_numeric($sampleSuccesses)) && (is_numeric($sampleNumber)) && (is_numeric($populationSuccesses)) && (is_numeric($populationNumber))) { |
1819 | 1819 | if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) { |
@@ -1825,9 +1825,9 @@ discard block |
||
1825 | 1825 | if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) { |
1826 | 1826 | return PHPExcel_Calculation_Functions::NaN(); |
1827 | 1827 | } |
1828 | - return PHPExcel_Calculation_MathTrig::COMBIN($populationSuccesses,$sampleSuccesses) * |
|
1829 | - PHPExcel_Calculation_MathTrig::COMBIN($populationNumber - $populationSuccesses,$sampleNumber - $sampleSuccesses) / |
|
1830 | - PHPExcel_Calculation_MathTrig::COMBIN($populationNumber,$sampleNumber); |
|
1828 | + return PHPExcel_Calculation_MathTrig::COMBIN($populationSuccesses, $sampleSuccesses) * |
|
1829 | + PHPExcel_Calculation_MathTrig::COMBIN($populationNumber - $populationSuccesses, $sampleNumber - $sampleSuccesses) / |
|
1830 | + PHPExcel_Calculation_MathTrig::COMBIN($populationNumber, $sampleNumber); |
|
1831 | 1831 | } |
1832 | 1832 | return PHPExcel_Calculation_Functions::VALUE(); |
1833 | 1833 | } // function HYPGEOMDIST() |
@@ -1842,8 +1842,8 @@ discard block |
||
1842 | 1842 | * @param array of mixed Data Series X |
1843 | 1843 | * @return float |
1844 | 1844 | */ |
1845 | - public static function INTERCEPT($yValues,$xValues) { |
|
1846 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1845 | + public static function INTERCEPT($yValues, $xValues) { |
|
1846 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
1847 | 1847 | return PHPExcel_Calculation_Functions::VALUE(); |
1848 | 1848 | } |
1849 | 1849 | $yValueCount = count($yValues); |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | return PHPExcel_Calculation_Functions::DIV0(); |
1856 | 1856 | } |
1857 | 1857 | |
1858 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
1858 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
1859 | 1859 | return $bestFitLinear->getIntersect(); |
1860 | 1860 | } // function INTERCEPT() |
1861 | 1861 | |
@@ -1881,11 +1881,11 @@ discard block |
||
1881 | 1881 | // Loop through arguments |
1882 | 1882 | foreach ($aArgs as $k => $arg) { |
1883 | 1883 | if ((is_bool($arg)) && |
1884 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
1884 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
1885 | 1885 | } else { |
1886 | 1886 | // Is it a numeric value? |
1887 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
1888 | - $summer += pow((($arg - $mean) / $stdDev),4) ; |
|
1887 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
1888 | + $summer += pow((($arg - $mean) / $stdDev), 4); |
|
1889 | 1889 | ++$count; |
1890 | 1890 | } |
1891 | 1891 | } |
@@ -1893,7 +1893,7 @@ discard block |
||
1893 | 1893 | |
1894 | 1894 | // Return |
1895 | 1895 | if ($count > 3) { |
1896 | - return $summer * ($count * ($count+1) / (($count-1) * ($count-2) * ($count-3))) - (3 * pow($count-1,2) / (($count-2) * ($count-3))); |
|
1896 | + return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * pow($count - 1, 2) / (($count - 2) * ($count - 3))); |
|
1897 | 1897 | } |
1898 | 1898 | } |
1899 | 1899 | return PHPExcel_Calculation_Functions::DIV0(); |
@@ -1922,11 +1922,11 @@ discard block |
||
1922 | 1922 | // Calculate |
1923 | 1923 | $entry = floor(array_pop($aArgs)); |
1924 | 1924 | |
1925 | - if ((is_numeric($entry)) && (!is_string($entry))) { |
|
1925 | + if ((is_numeric($entry)) && ( ! is_string($entry))) { |
|
1926 | 1926 | $mArgs = array(); |
1927 | 1927 | foreach ($aArgs as $arg) { |
1928 | 1928 | // Is it a numeric value? |
1929 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
1929 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
1930 | 1930 | $mArgs[] = $arg; |
1931 | 1931 | } |
1932 | 1932 | } |
@@ -1954,12 +1954,12 @@ discard block |
||
1954 | 1954 | * @param boolean A logical value specifying whether to return additional regression statistics. |
1955 | 1955 | * @return array |
1956 | 1956 | */ |
1957 | - public static function LINEST($yValues,$xValues=null,$const=True,$stats=False) { |
|
1958 | - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
1959 | - $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); |
|
1960 | - if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
1957 | + public static function LINEST($yValues, $xValues = null, $const = True, $stats = False) { |
|
1958 | + $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
1959 | + $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); |
|
1960 | + if (is_null($xValues)) $xValues = range(1, count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
1961 | 1961 | |
1962 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
1962 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
1963 | 1963 | return PHPExcel_Calculation_Functions::VALUE(); |
1964 | 1964 | } |
1965 | 1965 | $yValueCount = count($yValues); |
@@ -1972,15 +1972,15 @@ discard block |
||
1972 | 1972 | return 0; |
1973 | 1973 | } |
1974 | 1974 | |
1975 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const); |
|
1975 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const); |
|
1976 | 1976 | if ($stats) { |
1977 | - return array( array( $bestFitLinear->getSlope(), |
|
1977 | + return array(array($bestFitLinear->getSlope(), |
|
1978 | 1978 | $bestFitLinear->getSlopeSE(), |
1979 | 1979 | $bestFitLinear->getGoodnessOfFit(), |
1980 | 1980 | $bestFitLinear->getF(), |
1981 | 1981 | $bestFitLinear->getSSRegression(), |
1982 | 1982 | ), |
1983 | - array( $bestFitLinear->getIntersect(), |
|
1983 | + array($bestFitLinear->getIntersect(), |
|
1984 | 1984 | $bestFitLinear->getIntersectSE(), |
1985 | 1985 | $bestFitLinear->getStdevOfResiduals(), |
1986 | 1986 | $bestFitLinear->getDFResiduals(), |
@@ -1988,7 +1988,7 @@ discard block |
||
1988 | 1988 | ) |
1989 | 1989 | ); |
1990 | 1990 | } else { |
1991 | - return array( $bestFitLinear->getSlope(), |
|
1991 | + return array($bestFitLinear->getSlope(), |
|
1992 | 1992 | $bestFitLinear->getIntersect() |
1993 | 1993 | ); |
1994 | 1994 | } |
@@ -2007,18 +2007,18 @@ discard block |
||
2007 | 2007 | * @param boolean A logical value specifying whether to return additional regression statistics. |
2008 | 2008 | * @return array |
2009 | 2009 | */ |
2010 | - public static function LOGEST($yValues,$xValues=null,$const=True,$stats=False) { |
|
2011 | - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
2012 | - $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); |
|
2013 | - if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
2010 | + public static function LOGEST($yValues, $xValues = null, $const = True, $stats = False) { |
|
2011 | + $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
2012 | + $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); |
|
2013 | + if (is_null($xValues)) $xValues = range(1, count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
2014 | 2014 | |
2015 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
2015 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
2016 | 2016 | return PHPExcel_Calculation_Functions::VALUE(); |
2017 | 2017 | } |
2018 | 2018 | $yValueCount = count($yValues); |
2019 | 2019 | $xValueCount = count($xValues); |
2020 | 2020 | |
2021 | - foreach($yValues as $value) { |
|
2021 | + foreach ($yValues as $value) { |
|
2022 | 2022 | if ($value <= 0.0) { |
2023 | 2023 | return PHPExcel_Calculation_Functions::NaN(); |
2024 | 2024 | } |
@@ -2031,15 +2031,15 @@ discard block |
||
2031 | 2031 | return 1; |
2032 | 2032 | } |
2033 | 2033 | |
2034 | - $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL,$yValues,$xValues,$const); |
|
2034 | + $bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const); |
|
2035 | 2035 | if ($stats) { |
2036 | - return array( array( $bestFitExponential->getSlope(), |
|
2036 | + return array(array($bestFitExponential->getSlope(), |
|
2037 | 2037 | $bestFitExponential->getSlopeSE(), |
2038 | 2038 | $bestFitExponential->getGoodnessOfFit(), |
2039 | 2039 | $bestFitExponential->getF(), |
2040 | 2040 | $bestFitExponential->getSSRegression(), |
2041 | 2041 | ), |
2042 | - array( $bestFitExponential->getIntersect(), |
|
2042 | + array($bestFitExponential->getIntersect(), |
|
2043 | 2043 | $bestFitExponential->getIntersectSE(), |
2044 | 2044 | $bestFitExponential->getStdevOfResiduals(), |
2045 | 2045 | $bestFitExponential->getDFResiduals(), |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | ) |
2048 | 2048 | ); |
2049 | 2049 | } else { |
2050 | - return array( $bestFitExponential->getSlope(), |
|
2050 | + return array($bestFitExponential->getSlope(), |
|
2051 | 2051 | $bestFitExponential->getIntersect() |
2052 | 2052 | ); |
2053 | 2053 | } |
@@ -2067,9 +2067,9 @@ discard block |
||
2067 | 2067 | * (as described at) http://home.online.no/~pjacklam/notes/invnorm/ |
2068 | 2068 | */ |
2069 | 2069 | public static function LOGINV($probability, $mean, $stdDev) { |
2070 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
2071 | - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2072 | - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2070 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
2071 | + $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2072 | + $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2073 | 2073 | |
2074 | 2074 | if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
2075 | 2075 | if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) { |
@@ -2091,9 +2091,9 @@ discard block |
||
2091 | 2091 | * @return float |
2092 | 2092 | */ |
2093 | 2093 | public static function LOGNORMDIST($value, $mean, $stdDev) { |
2094 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2095 | - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2096 | - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2094 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2095 | + $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2096 | + $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2097 | 2097 | |
2098 | 2098 | if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
2099 | 2099 | if (($value <= 0) || ($stdDev <= 0)) { |
@@ -2127,7 +2127,7 @@ discard block |
||
2127 | 2127 | $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); |
2128 | 2128 | foreach ($aArgs as $arg) { |
2129 | 2129 | // Is it a numeric value? |
2130 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2130 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2131 | 2131 | if ((is_null($returnValue)) || ($arg > $returnValue)) { |
2132 | 2132 | $returnValue = $arg; |
2133 | 2133 | } |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | } |
2136 | 2136 | |
2137 | 2137 | // Return |
2138 | - if(is_null($returnValue)) { |
|
2138 | + if (is_null($returnValue)) { |
|
2139 | 2139 | return 0; |
2140 | 2140 | } |
2141 | 2141 | return $returnValue; |
@@ -2176,7 +2176,7 @@ discard block |
||
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | // Return |
2179 | - if(is_null($returnValue)) { |
|
2179 | + if (is_null($returnValue)) { |
|
2180 | 2180 | return 0; |
2181 | 2181 | } |
2182 | 2182 | return $returnValue; |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | * @param string $condition The criteria that defines which cells will be checked. |
2198 | 2198 | * @return float |
2199 | 2199 | */ |
2200 | - public static function MAXIF($aArgs,$condition,$sumArgs = array()) { |
|
2200 | + public static function MAXIF($aArgs, $condition, $sumArgs = array()) { |
|
2201 | 2201 | // Return value |
2202 | 2202 | $returnValue = null; |
2203 | 2203 | |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); |
2210 | 2210 | // Loop through arguments |
2211 | 2211 | foreach ($aArgs as $key => $arg) { |
2212 | - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
2212 | + if ( ! is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
2213 | 2213 | $testCondition = '='.$arg.$condition; |
2214 | 2214 | if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
2215 | 2215 | if ((is_null($returnValue)) || ($arg > $returnValue)) { |
@@ -2245,14 +2245,14 @@ discard block |
||
2245 | 2245 | $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); |
2246 | 2246 | foreach ($aArgs as $arg) { |
2247 | 2247 | // Is it a numeric value? |
2248 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2248 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2249 | 2249 | $mArgs[] = $arg; |
2250 | 2250 | } |
2251 | 2251 | } |
2252 | 2252 | |
2253 | 2253 | $mValueCount = count($mArgs); |
2254 | 2254 | if ($mValueCount > 0) { |
2255 | - sort($mArgs,SORT_NUMERIC); |
|
2255 | + sort($mArgs, SORT_NUMERIC); |
|
2256 | 2256 | $mValueCount = $mValueCount / 2; |
2257 | 2257 | if ($mValueCount == floor($mValueCount)) { |
2258 | 2258 | $returnValue = ($mArgs[$mValueCount--] + $mArgs[$mValueCount]) / 2; |
@@ -2289,7 +2289,7 @@ discard block |
||
2289 | 2289 | $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args()); |
2290 | 2290 | foreach ($aArgs as $arg) { |
2291 | 2291 | // Is it a numeric value? |
2292 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2292 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2293 | 2293 | if ((is_null($returnValue)) || ($arg < $returnValue)) { |
2294 | 2294 | $returnValue = $arg; |
2295 | 2295 | } |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | } |
2298 | 2298 | |
2299 | 2299 | // Return |
2300 | - if(is_null($returnValue)) { |
|
2300 | + if (is_null($returnValue)) { |
|
2301 | 2301 | return 0; |
2302 | 2302 | } |
2303 | 2303 | return $returnValue; |
@@ -2338,7 +2338,7 @@ discard block |
||
2338 | 2338 | } |
2339 | 2339 | |
2340 | 2340 | // Return |
2341 | - if(is_null($returnValue)) { |
|
2341 | + if (is_null($returnValue)) { |
|
2342 | 2342 | return 0; |
2343 | 2343 | } |
2344 | 2344 | return $returnValue; |
@@ -2359,7 +2359,7 @@ discard block |
||
2359 | 2359 | * @param string $condition The criteria that defines which cells will be checked. |
2360 | 2360 | * @return float |
2361 | 2361 | */ |
2362 | - public static function MINIF($aArgs,$condition,$sumArgs = array()) { |
|
2362 | + public static function MINIF($aArgs, $condition, $sumArgs = array()) { |
|
2363 | 2363 | // Return value |
2364 | 2364 | $returnValue = null; |
2365 | 2365 | |
@@ -2371,7 +2371,7 @@ discard block |
||
2371 | 2371 | $condition = PHPExcel_Calculation_Functions::_ifCondition($condition); |
2372 | 2372 | // Loop through arguments |
2373 | 2373 | foreach ($aArgs as $key => $arg) { |
2374 | - if (!is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
2374 | + if ( ! is_numeric($arg)) { $arg = PHPExcel_Calculation::_wrapResult(strtoupper($arg)); } |
|
2375 | 2375 | $testCondition = '='.$arg.$condition; |
2376 | 2376 | if (PHPExcel_Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
2377 | 2377 | if ((is_null($returnValue)) || ($arg < $returnValue)) { |
@@ -2391,22 +2391,22 @@ discard block |
||
2391 | 2391 | // |
2392 | 2392 | private static function _modeCalc($data) { |
2393 | 2393 | $frequencyArray = array(); |
2394 | - foreach($data as $datum) { |
|
2394 | + foreach ($data as $datum) { |
|
2395 | 2395 | $found = False; |
2396 | - foreach($frequencyArray as $key => $value) { |
|
2396 | + foreach ($frequencyArray as $key => $value) { |
|
2397 | 2397 | if ((string) $value['value'] == (string) $datum) { |
2398 | 2398 | ++$frequencyArray[$key]['frequency']; |
2399 | 2399 | $found = True; |
2400 | 2400 | break; |
2401 | 2401 | } |
2402 | 2402 | } |
2403 | - if (!$found) { |
|
2403 | + if ( ! $found) { |
|
2404 | 2404 | $frequencyArray[] = array('value' => $datum, |
2405 | - 'frequency' => 1 ); |
|
2405 | + 'frequency' => 1); |
|
2406 | 2406 | } |
2407 | 2407 | } |
2408 | 2408 | |
2409 | - foreach($frequencyArray as $key => $value) { |
|
2409 | + foreach ($frequencyArray as $key => $value) { |
|
2410 | 2410 | $frequencyList[$key] = $value['frequency']; |
2411 | 2411 | $valueList[$key] = $value['value']; |
2412 | 2412 | } |
@@ -2442,12 +2442,12 @@ discard block |
||
2442 | 2442 | $mArgs = array(); |
2443 | 2443 | foreach ($aArgs as $arg) { |
2444 | 2444 | // Is it a numeric value? |
2445 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2445 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2446 | 2446 | $mArgs[] = $arg; |
2447 | 2447 | } |
2448 | 2448 | } |
2449 | 2449 | |
2450 | - if (!empty($mArgs)) { |
|
2450 | + if ( ! empty($mArgs)) { |
|
2451 | 2451 | return self::_modeCalc($mArgs); |
2452 | 2452 | } |
2453 | 2453 | |
@@ -2472,9 +2472,9 @@ discard block |
||
2472 | 2472 | * |
2473 | 2473 | */ |
2474 | 2474 | public static function NEGBINOMDIST($failures, $successes, $probability) { |
2475 | - $failures = floor(PHPExcel_Calculation_Functions::flattenSingleValue($failures)); |
|
2476 | - $successes = floor(PHPExcel_Calculation_Functions::flattenSingleValue($successes)); |
|
2477 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
2475 | + $failures = floor(PHPExcel_Calculation_Functions::flattenSingleValue($failures)); |
|
2476 | + $successes = floor(PHPExcel_Calculation_Functions::flattenSingleValue($successes)); |
|
2477 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
2478 | 2478 | |
2479 | 2479 | if ((is_numeric($failures)) && (is_numeric($successes)) && (is_numeric($probability))) { |
2480 | 2480 | if (($failures < 0) || ($successes < 1)) { |
@@ -2488,7 +2488,7 @@ discard block |
||
2488 | 2488 | return PHPExcel_Calculation_Functions::NaN(); |
2489 | 2489 | } |
2490 | 2490 | } |
2491 | - return (PHPExcel_Calculation_MathTrig::COMBIN($failures + $successes - 1,$successes - 1)) * (pow($probability,$successes)) * (pow(1 - $probability,$failures)) ; |
|
2491 | + return (PHPExcel_Calculation_MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures)); |
|
2492 | 2492 | } |
2493 | 2493 | return PHPExcel_Calculation_Functions::VALUE(); |
2494 | 2494 | } // function NEGBINOMDIST() |
@@ -2509,9 +2509,9 @@ discard block |
||
2509 | 2509 | * |
2510 | 2510 | */ |
2511 | 2511 | public static function NORMDIST($value, $mean, $stdDev, $cumulative) { |
2512 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2513 | - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2514 | - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2512 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2513 | + $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2514 | + $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2515 | 2515 | |
2516 | 2516 | if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
2517 | 2517 | if ($stdDev < 0) { |
@@ -2521,7 +2521,7 @@ discard block |
||
2521 | 2521 | if ($cumulative) { |
2522 | 2522 | return 0.5 * (1 + PHPExcel_Calculation_Engineering::_erfVal(($value - $mean) / ($stdDev * sqrt(2)))); |
2523 | 2523 | } else { |
2524 | - return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean,2) / (2 * ($stdDev * $stdDev)))); |
|
2524 | + return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); |
|
2525 | 2525 | } |
2526 | 2526 | } |
2527 | 2527 | } |
@@ -2540,10 +2540,10 @@ discard block |
||
2540 | 2540 | * @return float |
2541 | 2541 | * |
2542 | 2542 | */ |
2543 | - public static function NORMINV($probability,$mean,$stdDev) { |
|
2544 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
2545 | - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2546 | - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2543 | + public static function NORMINV($probability, $mean, $stdDev) { |
|
2544 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
2545 | + $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2546 | + $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2547 | 2547 | |
2548 | 2548 | if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
2549 | 2549 | if (($probability < 0) || ($probability > 1)) { |
@@ -2569,7 +2569,7 @@ discard block |
||
2569 | 2569 | * @return float |
2570 | 2570 | */ |
2571 | 2571 | public static function NORMSDIST($value) { |
2572 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2572 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2573 | 2573 | |
2574 | 2574 | return self::NORMDIST($value, 0, 1, True); |
2575 | 2575 | } // function NORMSDIST() |
@@ -2608,14 +2608,14 @@ discard block |
||
2608 | 2608 | // Calculate |
2609 | 2609 | $entry = array_pop($aArgs); |
2610 | 2610 | |
2611 | - if ((is_numeric($entry)) && (!is_string($entry))) { |
|
2611 | + if ((is_numeric($entry)) && ( ! is_string($entry))) { |
|
2612 | 2612 | if (($entry < 0) || ($entry > 1)) { |
2613 | 2613 | return PHPExcel_Calculation_Functions::NaN(); |
2614 | 2614 | } |
2615 | 2615 | $mArgs = array(); |
2616 | 2616 | foreach ($aArgs as $arg) { |
2617 | 2617 | // Is it a numeric value? |
2618 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2618 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2619 | 2619 | $mArgs[] = $arg; |
2620 | 2620 | } |
2621 | 2621 | } |
@@ -2623,14 +2623,14 @@ discard block |
||
2623 | 2623 | if ($mValueCount > 0) { |
2624 | 2624 | sort($mArgs); |
2625 | 2625 | $count = self::COUNT($mArgs); |
2626 | - $index = $entry * ($count-1); |
|
2626 | + $index = $entry * ($count - 1); |
|
2627 | 2627 | $iBase = floor($index); |
2628 | 2628 | if ($index == $iBase) { |
2629 | 2629 | return $mArgs[$index]; |
2630 | 2630 | } else { |
2631 | 2631 | $iNext = $iBase + 1; |
2632 | 2632 | $iProportion = $index - $iBase; |
2633 | - return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion) ; |
|
2633 | + return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion); |
|
2634 | 2634 | } |
2635 | 2635 | } |
2636 | 2636 | } |
@@ -2648,17 +2648,17 @@ discard block |
||
2648 | 2648 | * @param number The number of significant digits for the returned percentage value. |
2649 | 2649 | * @return float |
2650 | 2650 | */ |
2651 | - public static function PERCENTRANK($valueSet,$value,$significance=3) { |
|
2652 | - $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet); |
|
2653 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2654 | - $significance = (is_null($significance)) ? 3 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($significance); |
|
2651 | + public static function PERCENTRANK($valueSet, $value, $significance = 3) { |
|
2652 | + $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet); |
|
2653 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2654 | + $significance = (is_null($significance)) ? 3 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($significance); |
|
2655 | 2655 | |
2656 | - foreach($valueSet as $key => $valueEntry) { |
|
2657 | - if (!is_numeric($valueEntry)) { |
|
2656 | + foreach ($valueSet as $key => $valueEntry) { |
|
2657 | + if ( ! is_numeric($valueEntry)) { |
|
2658 | 2658 | unset($valueSet[$key]); |
2659 | 2659 | } |
2660 | 2660 | } |
2661 | - sort($valueSet,SORT_NUMERIC); |
|
2661 | + sort($valueSet, SORT_NUMERIC); |
|
2662 | 2662 | $valueCount = count($valueSet); |
2663 | 2663 | if ($valueCount == 0) { |
2664 | 2664 | return PHPExcel_Calculation_Functions::NaN(); |
@@ -2669,7 +2669,7 @@ discard block |
||
2669 | 2669 | return PHPExcel_Calculation_Functions::NA(); |
2670 | 2670 | } |
2671 | 2671 | |
2672 | - $pos = array_search($value,$valueSet); |
|
2672 | + $pos = array_search($value, $valueSet); |
|
2673 | 2673 | if ($pos === False) { |
2674 | 2674 | $pos = 0; |
2675 | 2675 | $testValue = $valueSet[0]; |
@@ -2680,7 +2680,7 @@ discard block |
||
2680 | 2680 | $pos += (($value - $valueSet[$pos]) / ($testValue - $valueSet[$pos])); |
2681 | 2681 | } |
2682 | 2682 | |
2683 | - return round($pos / $valueAdjustor,$significance); |
|
2683 | + return round($pos / $valueAdjustor, $significance); |
|
2684 | 2684 | } // function PERCENTRANK() |
2685 | 2685 | |
2686 | 2686 | |
@@ -2697,9 +2697,9 @@ discard block |
||
2697 | 2697 | * @param int $numInSet Number of objects in each permutation |
2698 | 2698 | * @return int Number of permutations |
2699 | 2699 | */ |
2700 | - public static function PERMUT($numObjs,$numInSet) { |
|
2701 | - $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs); |
|
2702 | - $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet); |
|
2700 | + public static function PERMUT($numObjs, $numInSet) { |
|
2701 | + $numObjs = PHPExcel_Calculation_Functions::flattenSingleValue($numObjs); |
|
2702 | + $numInSet = PHPExcel_Calculation_Functions::flattenSingleValue($numInSet); |
|
2703 | 2703 | |
2704 | 2704 | if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { |
2705 | 2705 | $numInSet = floor($numInSet); |
@@ -2726,8 +2726,8 @@ discard block |
||
2726 | 2726 | * |
2727 | 2727 | */ |
2728 | 2728 | public static function POISSON($value, $mean, $cumulative) { |
2729 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2730 | - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2729 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2730 | + $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2731 | 2731 | |
2732 | 2732 | if ((is_numeric($value)) && (is_numeric($mean))) { |
2733 | 2733 | if (($value <= 0) || ($mean <= 0)) { |
@@ -2737,11 +2737,11 @@ discard block |
||
2737 | 2737 | if ($cumulative) { |
2738 | 2738 | $summer = 0; |
2739 | 2739 | for ($i = 0; $i <= floor($value); ++$i) { |
2740 | - $summer += pow($mean,$i) / PHPExcel_Calculation_MathTrig::FACT($i); |
|
2740 | + $summer += pow($mean, $i) / PHPExcel_Calculation_MathTrig::FACT($i); |
|
2741 | 2741 | } |
2742 | - return exp(0-$mean) * $summer; |
|
2742 | + return exp(0 - $mean) * $summer; |
|
2743 | 2743 | } else { |
2744 | - return (exp(0-$mean) * pow($mean,$value)) / PHPExcel_Calculation_MathTrig::FACT($value); |
|
2744 | + return (exp(0 - $mean) * pow($mean, $value)) / PHPExcel_Calculation_MathTrig::FACT($value); |
|
2745 | 2745 | } |
2746 | 2746 | } |
2747 | 2747 | } |
@@ -2769,12 +2769,12 @@ discard block |
||
2769 | 2769 | // Calculate |
2770 | 2770 | $entry = floor(array_pop($aArgs)); |
2771 | 2771 | |
2772 | - if ((is_numeric($entry)) && (!is_string($entry))) { |
|
2772 | + if ((is_numeric($entry)) && ( ! is_string($entry))) { |
|
2773 | 2773 | $entry /= 4; |
2774 | 2774 | if (($entry < 0) || ($entry > 1)) { |
2775 | 2775 | return PHPExcel_Calculation_Functions::NaN(); |
2776 | 2776 | } |
2777 | - return self::PERCENTILE($aArgs,$entry); |
|
2777 | + return self::PERCENTILE($aArgs, $entry); |
|
2778 | 2778 | } |
2779 | 2779 | return PHPExcel_Calculation_Functions::VALUE(); |
2780 | 2780 | } // function QUARTILE() |
@@ -2790,23 +2790,23 @@ discard block |
||
2790 | 2790 | * @param mixed Order to sort the values in the value set |
2791 | 2791 | * @return float |
2792 | 2792 | */ |
2793 | - public static function RANK($value,$valueSet,$order=0) { |
|
2793 | + public static function RANK($value, $valueSet, $order = 0) { |
|
2794 | 2794 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
2795 | 2795 | $valueSet = PHPExcel_Calculation_Functions::flattenArray($valueSet); |
2796 | - $order = (is_null($order)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($order); |
|
2796 | + $order = (is_null($order)) ? 0 : (integer) PHPExcel_Calculation_Functions::flattenSingleValue($order); |
|
2797 | 2797 | |
2798 | - foreach($valueSet as $key => $valueEntry) { |
|
2799 | - if (!is_numeric($valueEntry)) { |
|
2798 | + foreach ($valueSet as $key => $valueEntry) { |
|
2799 | + if ( ! is_numeric($valueEntry)) { |
|
2800 | 2800 | unset($valueSet[$key]); |
2801 | 2801 | } |
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | if ($order == 0) { |
2805 | - rsort($valueSet,SORT_NUMERIC); |
|
2805 | + rsort($valueSet, SORT_NUMERIC); |
|
2806 | 2806 | } else { |
2807 | - sort($valueSet,SORT_NUMERIC); |
|
2807 | + sort($valueSet, SORT_NUMERIC); |
|
2808 | 2808 | } |
2809 | - $pos = array_search($value,$valueSet); |
|
2809 | + $pos = array_search($value, $valueSet); |
|
2810 | 2810 | if ($pos === False) { |
2811 | 2811 | return PHPExcel_Calculation_Functions::NA(); |
2812 | 2812 | } |
@@ -2824,8 +2824,8 @@ discard block |
||
2824 | 2824 | * @param array of mixed Data Series X |
2825 | 2825 | * @return float |
2826 | 2826 | */ |
2827 | - public static function RSQ($yValues,$xValues) { |
|
2828 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
2827 | + public static function RSQ($yValues, $xValues) { |
|
2828 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
2829 | 2829 | return PHPExcel_Calculation_Functions::VALUE(); |
2830 | 2830 | } |
2831 | 2831 | $yValueCount = count($yValues); |
@@ -2837,7 +2837,7 @@ discard block |
||
2837 | 2837 | return PHPExcel_Calculation_Functions::DIV0(); |
2838 | 2838 | } |
2839 | 2839 | |
2840 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
2840 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
2841 | 2841 | return $bestFitLinear->getGoodnessOfFit(); |
2842 | 2842 | } // function RSQ() |
2843 | 2843 | |
@@ -2862,11 +2862,11 @@ discard block |
||
2862 | 2862 | // Loop through arguments |
2863 | 2863 | foreach ($aArgs as $k => $arg) { |
2864 | 2864 | if ((is_bool($arg)) && |
2865 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
2865 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
2866 | 2866 | } else { |
2867 | 2867 | // Is it a numeric value? |
2868 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2869 | - $summer += pow((($arg - $mean) / $stdDev),3) ; |
|
2868 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2869 | + $summer += pow((($arg - $mean) / $stdDev), 3); |
|
2870 | 2870 | ++$count; |
2871 | 2871 | } |
2872 | 2872 | } |
@@ -2874,7 +2874,7 @@ discard block |
||
2874 | 2874 | |
2875 | 2875 | // Return |
2876 | 2876 | if ($count > 2) { |
2877 | - return $summer * ($count / (($count-1) * ($count-2))); |
|
2877 | + return $summer * ($count / (($count - 1) * ($count - 2))); |
|
2878 | 2878 | } |
2879 | 2879 | return PHPExcel_Calculation_Functions::DIV0(); |
2880 | 2880 | } // function SKEW() |
@@ -2889,8 +2889,8 @@ discard block |
||
2889 | 2889 | * @param array of mixed Data Series X |
2890 | 2890 | * @return float |
2891 | 2891 | */ |
2892 | - public static function SLOPE($yValues,$xValues) { |
|
2893 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
2892 | + public static function SLOPE($yValues, $xValues) { |
|
2893 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
2894 | 2894 | return PHPExcel_Calculation_Functions::VALUE(); |
2895 | 2895 | } |
2896 | 2896 | $yValueCount = count($yValues); |
@@ -2902,7 +2902,7 @@ discard block |
||
2902 | 2902 | return PHPExcel_Calculation_Functions::DIV0(); |
2903 | 2903 | } |
2904 | 2904 | |
2905 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
2905 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
2906 | 2906 | return $bestFitLinear->getSlope(); |
2907 | 2907 | } // function SLOPE() |
2908 | 2908 | |
@@ -2928,11 +2928,11 @@ discard block |
||
2928 | 2928 | // Calculate |
2929 | 2929 | $entry = array_pop($aArgs); |
2930 | 2930 | |
2931 | - if ((is_numeric($entry)) && (!is_string($entry))) { |
|
2931 | + if ((is_numeric($entry)) && ( ! is_string($entry))) { |
|
2932 | 2932 | $mArgs = array(); |
2933 | 2933 | foreach ($aArgs as $arg) { |
2934 | 2934 | // Is it a numeric value? |
2935 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
2935 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
2936 | 2936 | $mArgs[] = $arg; |
2937 | 2937 | } |
2938 | 2938 | } |
@@ -2958,16 +2958,16 @@ discard block |
||
2958 | 2958 | * @param float $stdDev Standard Deviation |
2959 | 2959 | * @return float Standardized value |
2960 | 2960 | */ |
2961 | - public static function STANDARDIZE($value,$mean,$stdDev) { |
|
2962 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2963 | - $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2964 | - $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2961 | + public static function STANDARDIZE($value, $mean, $stdDev) { |
|
2962 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
2963 | + $mean = PHPExcel_Calculation_Functions::flattenSingleValue($mean); |
|
2964 | + $stdDev = PHPExcel_Calculation_Functions::flattenSingleValue($stdDev); |
|
2965 | 2965 | |
2966 | 2966 | if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { |
2967 | 2967 | if ($stdDev <= 0) { |
2968 | 2968 | return PHPExcel_Calculation_Functions::NaN(); |
2969 | 2969 | } |
2970 | - return ($value - $mean) / $stdDev ; |
|
2970 | + return ($value - $mean) / $stdDev; |
|
2971 | 2971 | } |
2972 | 2972 | return PHPExcel_Calculation_Functions::VALUE(); |
2973 | 2973 | } // function STANDARDIZE() |
@@ -2994,19 +2994,19 @@ discard block |
||
2994 | 2994 | $returnValue = null; |
2995 | 2995 | |
2996 | 2996 | $aMean = self::AVERAGE($aArgs); |
2997 | - if (!is_null($aMean)) { |
|
2997 | + if ( ! is_null($aMean)) { |
|
2998 | 2998 | $aCount = -1; |
2999 | 2999 | foreach ($aArgs as $k => $arg) { |
3000 | 3000 | if ((is_bool($arg)) && |
3001 | - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
3001 | + (( ! PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
3002 | 3002 | $arg = (integer) $arg; |
3003 | 3003 | } |
3004 | 3004 | // Is it a numeric value? |
3005 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
3005 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
3006 | 3006 | if (is_null($returnValue)) { |
3007 | - $returnValue = pow(($arg - $aMean),2); |
|
3007 | + $returnValue = pow(($arg - $aMean), 2); |
|
3008 | 3008 | } else { |
3009 | - $returnValue += pow(($arg - $aMean),2); |
|
3009 | + $returnValue += pow(($arg - $aMean), 2); |
|
3010 | 3010 | } |
3011 | 3011 | ++$aCount; |
3012 | 3012 | } |
@@ -3041,11 +3041,11 @@ discard block |
||
3041 | 3041 | $returnValue = null; |
3042 | 3042 | |
3043 | 3043 | $aMean = self::AVERAGEA($aArgs); |
3044 | - if (!is_null($aMean)) { |
|
3044 | + if ( ! is_null($aMean)) { |
|
3045 | 3045 | $aCount = -1; |
3046 | 3046 | foreach ($aArgs as $k => $arg) { |
3047 | 3047 | if ((is_bool($arg)) && |
3048 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3048 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3049 | 3049 | } else { |
3050 | 3050 | // Is it a numeric value? |
3051 | 3051 | if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { |
@@ -3055,9 +3055,9 @@ discard block |
||
3055 | 3055 | $arg = 0; |
3056 | 3056 | } |
3057 | 3057 | if (is_null($returnValue)) { |
3058 | - $returnValue = pow(($arg - $aMean),2); |
|
3058 | + $returnValue = pow(($arg - $aMean), 2); |
|
3059 | 3059 | } else { |
3060 | - $returnValue += pow(($arg - $aMean),2); |
|
3060 | + $returnValue += pow(($arg - $aMean), 2); |
|
3061 | 3061 | } |
3062 | 3062 | ++$aCount; |
3063 | 3063 | } |
@@ -3093,19 +3093,19 @@ discard block |
||
3093 | 3093 | $returnValue = null; |
3094 | 3094 | |
3095 | 3095 | $aMean = self::AVERAGE($aArgs); |
3096 | - if (!is_null($aMean)) { |
|
3096 | + if ( ! is_null($aMean)) { |
|
3097 | 3097 | $aCount = 0; |
3098 | 3098 | foreach ($aArgs as $k => $arg) { |
3099 | 3099 | if ((is_bool($arg)) && |
3100 | - ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
3100 | + (( ! PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) { |
|
3101 | 3101 | $arg = (integer) $arg; |
3102 | 3102 | } |
3103 | 3103 | // Is it a numeric value? |
3104 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
3104 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
3105 | 3105 | if (is_null($returnValue)) { |
3106 | - $returnValue = pow(($arg - $aMean),2); |
|
3106 | + $returnValue = pow(($arg - $aMean), 2); |
|
3107 | 3107 | } else { |
3108 | - $returnValue += pow(($arg - $aMean),2); |
|
3108 | + $returnValue += pow(($arg - $aMean), 2); |
|
3109 | 3109 | } |
3110 | 3110 | ++$aCount; |
3111 | 3111 | } |
@@ -3140,11 +3140,11 @@ discard block |
||
3140 | 3140 | $returnValue = null; |
3141 | 3141 | |
3142 | 3142 | $aMean = self::AVERAGEA($aArgs); |
3143 | - if (!is_null($aMean)) { |
|
3143 | + if ( ! is_null($aMean)) { |
|
3144 | 3144 | $aCount = 0; |
3145 | 3145 | foreach ($aArgs as $k => $arg) { |
3146 | 3146 | if ((is_bool($arg)) && |
3147 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3147 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3148 | 3148 | } else { |
3149 | 3149 | // Is it a numeric value? |
3150 | 3150 | if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { |
@@ -3154,9 +3154,9 @@ discard block |
||
3154 | 3154 | $arg = 0; |
3155 | 3155 | } |
3156 | 3156 | if (is_null($returnValue)) { |
3157 | - $returnValue = pow(($arg - $aMean),2); |
|
3157 | + $returnValue = pow(($arg - $aMean), 2); |
|
3158 | 3158 | } else { |
3159 | - $returnValue += pow(($arg - $aMean),2); |
|
3159 | + $returnValue += pow(($arg - $aMean), 2); |
|
3160 | 3160 | } |
3161 | 3161 | ++$aCount; |
3162 | 3162 | } |
@@ -3181,8 +3181,8 @@ discard block |
||
3181 | 3181 | * @param array of mixed Data Series X |
3182 | 3182 | * @return float |
3183 | 3183 | */ |
3184 | - public static function STEYX($yValues,$xValues) { |
|
3185 | - if (!self::_checkTrendArrays($yValues,$xValues)) { |
|
3184 | + public static function STEYX($yValues, $xValues) { |
|
3185 | + if ( ! self::_checkTrendArrays($yValues, $xValues)) { |
|
3186 | 3186 | return PHPExcel_Calculation_Functions::VALUE(); |
3187 | 3187 | } |
3188 | 3188 | $yValueCount = count($yValues); |
@@ -3194,7 +3194,7 @@ discard block |
||
3194 | 3194 | return PHPExcel_Calculation_Functions::DIV0(); |
3195 | 3195 | } |
3196 | 3196 | |
3197 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues); |
|
3197 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues); |
|
3198 | 3198 | return $bestFitLinear->getStdevOfResiduals(); |
3199 | 3199 | } // function STEYX() |
3200 | 3200 | |
@@ -3211,7 +3211,7 @@ discard block |
||
3211 | 3211 | */ |
3212 | 3212 | public static function TDIST($value, $degrees, $tails) { |
3213 | 3213 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
3214 | - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
3214 | + $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
3215 | 3215 | $tails = floor(PHPExcel_Calculation_Functions::flattenSingleValue($tails)); |
3216 | 3216 | |
3217 | 3217 | if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) { |
@@ -3228,7 +3228,7 @@ discard block |
||
3228 | 3228 | // Algorithms", editied by P Griffiths and I D Hill (1985; Ellis |
3229 | 3229 | // Horwood Ltd.; W. Sussex, England). |
3230 | 3230 | $tterm = $degrees; |
3231 | - $ttheta = atan2($value,sqrt($tterm)); |
|
3231 | + $ttheta = atan2($value, sqrt($tterm)); |
|
3232 | 3232 | $tc = cos($ttheta); |
3233 | 3233 | $ts = sin($ttheta); |
3234 | 3234 | $tsum = 0; |
@@ -3270,15 +3270,15 @@ discard block |
||
3270 | 3270 | * @return float |
3271 | 3271 | */ |
3272 | 3272 | public static function TINV($probability, $degrees) { |
3273 | - $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
3274 | - $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
3273 | + $probability = PHPExcel_Calculation_Functions::flattenSingleValue($probability); |
|
3274 | + $degrees = floor(PHPExcel_Calculation_Functions::flattenSingleValue($degrees)); |
|
3275 | 3275 | |
3276 | 3276 | if ((is_numeric($probability)) && (is_numeric($degrees))) { |
3277 | 3277 | $xLo = 100; |
3278 | 3278 | $xHi = 0; |
3279 | 3279 | |
3280 | 3280 | $x = $xNew = 1; |
3281 | - $dx = 1; |
|
3281 | + $dx = 1; |
|
3282 | 3282 | $i = 0; |
3283 | 3283 | |
3284 | 3284 | while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { |
@@ -3309,7 +3309,7 @@ discard block |
||
3309 | 3309 | if ($i == MAX_ITERATIONS) { |
3310 | 3310 | return PHPExcel_Calculation_Functions::NA(); |
3311 | 3311 | } |
3312 | - return round($x,12); |
|
3312 | + return round($x, 12); |
|
3313 | 3313 | } |
3314 | 3314 | return PHPExcel_Calculation_Functions::VALUE(); |
3315 | 3315 | } // function TINV() |
@@ -3326,19 +3326,19 @@ discard block |
||
3326 | 3326 | * @param boolean A logical value specifying whether to force the intersect to equal 0. |
3327 | 3327 | * @return array of float |
3328 | 3328 | */ |
3329 | - public static function TREND($yValues,$xValues=array(),$newValues=array(),$const=True) { |
|
3329 | + public static function TREND($yValues, $xValues = array(), $newValues = array(), $const = True) { |
|
3330 | 3330 | $yValues = PHPExcel_Calculation_Functions::flattenArray($yValues); |
3331 | 3331 | $xValues = PHPExcel_Calculation_Functions::flattenArray($xValues); |
3332 | 3332 | $newValues = PHPExcel_Calculation_Functions::flattenArray($newValues); |
3333 | - $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
3333 | + $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
|
3334 | 3334 | |
3335 | - $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR,$yValues,$xValues,$const); |
|
3335 | + $bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const); |
|
3336 | 3336 | if (empty($newValues)) { |
3337 | 3337 | $newValues = $bestFitLinear->getXValues(); |
3338 | 3338 | } |
3339 | 3339 | |
3340 | 3340 | $returnArray = array(); |
3341 | - foreach($newValues as $xValue) { |
|
3341 | + foreach ($newValues as $xValue) { |
|
3342 | 3342 | $returnArray[0][] = $bestFitLinear->getValueOfYForX($xValue); |
3343 | 3343 | } |
3344 | 3344 | |
@@ -3368,20 +3368,20 @@ discard block |
||
3368 | 3368 | // Calculate |
3369 | 3369 | $percent = array_pop($aArgs); |
3370 | 3370 | |
3371 | - if ((is_numeric($percent)) && (!is_string($percent))) { |
|
3371 | + if ((is_numeric($percent)) && ( ! is_string($percent))) { |
|
3372 | 3372 | if (($percent < 0) || ($percent > 1)) { |
3373 | 3373 | return PHPExcel_Calculation_Functions::NaN(); |
3374 | 3374 | } |
3375 | 3375 | $mArgs = array(); |
3376 | 3376 | foreach ($aArgs as $arg) { |
3377 | 3377 | // Is it a numeric value? |
3378 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
3378 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
3379 | 3379 | $mArgs[] = $arg; |
3380 | 3380 | } |
3381 | 3381 | } |
3382 | 3382 | $discard = floor(self::COUNT($mArgs) * $percent / 2); |
3383 | 3383 | sort($mArgs); |
3384 | - for ($i=0; $i < $discard; ++$i) { |
|
3384 | + for ($i = 0; $i < $discard; ++$i) { |
|
3385 | 3385 | array_pop($mArgs); |
3386 | 3386 | array_shift($mArgs); |
3387 | 3387 | } |
@@ -3416,7 +3416,7 @@ discard block |
||
3416 | 3416 | foreach ($aArgs as $arg) { |
3417 | 3417 | if (is_bool($arg)) { $arg = (integer) $arg; } |
3418 | 3418 | // Is it a numeric value? |
3419 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
3419 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
3420 | 3420 | $summerA += ($arg * $arg); |
3421 | 3421 | $summerB += $arg; |
3422 | 3422 | ++$aCount; |
@@ -3460,7 +3460,7 @@ discard block |
||
3460 | 3460 | (PHPExcel_Calculation_Functions::isValue($k))) { |
3461 | 3461 | return PHPExcel_Calculation_Functions::VALUE(); |
3462 | 3462 | } elseif ((is_string($arg)) && |
3463 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3463 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3464 | 3464 | } else { |
3465 | 3465 | // Is it a numeric value? |
3466 | 3466 | if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { |
@@ -3511,7 +3511,7 @@ discard block |
||
3511 | 3511 | foreach ($aArgs as $arg) { |
3512 | 3512 | if (is_bool($arg)) { $arg = (integer) $arg; } |
3513 | 3513 | // Is it a numeric value? |
3514 | - if ((is_numeric($arg)) && (!is_string($arg))) { |
|
3514 | + if ((is_numeric($arg)) && ( ! is_string($arg))) { |
|
3515 | 3515 | $summerA += ($arg * $arg); |
3516 | 3516 | $summerB += $arg; |
3517 | 3517 | ++$aCount; |
@@ -3555,7 +3555,7 @@ discard block |
||
3555 | 3555 | (PHPExcel_Calculation_Functions::isValue($k))) { |
3556 | 3556 | return PHPExcel_Calculation_Functions::VALUE(); |
3557 | 3557 | } elseif ((is_string($arg)) && |
3558 | - (!PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3558 | + ( ! PHPExcel_Calculation_Functions::isMatrixValue($k))) { |
|
3559 | 3559 | } else { |
3560 | 3560 | // Is it a numeric value? |
3561 | 3561 | if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { |
@@ -3597,7 +3597,7 @@ discard block |
||
3597 | 3597 | public static function WEIBULL($value, $alpha, $beta, $cumulative) { |
3598 | 3598 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
3599 | 3599 | $alpha = PHPExcel_Calculation_Functions::flattenSingleValue($alpha); |
3600 | - $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); |
|
3600 | + $beta = PHPExcel_Calculation_Functions::flattenSingleValue($beta); |
|
3601 | 3601 | |
3602 | 3602 | if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta))) { |
3603 | 3603 | if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) { |
@@ -3605,9 +3605,9 @@ discard block |
||
3605 | 3605 | } |
3606 | 3606 | if ((is_numeric($cumulative)) || (is_bool($cumulative))) { |
3607 | 3607 | if ($cumulative) { |
3608 | - return 1 - exp(0 - pow($value / $beta,$alpha)); |
|
3608 | + return 1 - exp(0 - pow($value / $beta, $alpha)); |
|
3609 | 3609 | } else { |
3610 | - return ($alpha / pow($beta,$alpha)) * pow($value,$alpha - 1) * exp(0 - pow($value / $beta,$alpha)); |
|
3610 | + return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha)); |
|
3611 | 3611 | } |
3612 | 3612 | } |
3613 | 3613 | } |
@@ -3628,9 +3628,9 @@ discard block |
||
3628 | 3628 | * @return float |
3629 | 3629 | * |
3630 | 3630 | */ |
3631 | - public static function ZTEST($dataSet, $m0, $sigma=null) { |
|
3632 | - $dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet); |
|
3633 | - $m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0); |
|
3631 | + public static function ZTEST($dataSet, $m0, $sigma = null) { |
|
3632 | + $dataSet = PHPExcel_Calculation_Functions::flattenArrayIndexed($dataSet); |
|
3633 | + $m0 = PHPExcel_Calculation_Functions::flattenSingleValue($m0); |
|
3634 | 3634 | $sigma = PHPExcel_Calculation_Functions::flattenSingleValue($sigma); |
3635 | 3635 | |
3636 | 3636 | if (is_null($sigma)) { |
@@ -3638,7 +3638,7 @@ discard block |
||
3638 | 3638 | } |
3639 | 3639 | $n = count($dataSet); |
3640 | 3640 | |
3641 | - return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0)/($sigma/SQRT($n))); |
|
3641 | + return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0) / ($sigma / SQRT($n))); |
|
3642 | 3642 | } // function ZTEST() |
3643 | 3643 | |
3644 | 3644 | } // class PHPExcel_Calculation_Statistical |
@@ -396,8 +396,9 @@ discard block |
||
396 | 396 | if ($y <= $lg_frtbig) { |
397 | 397 | $res = $lg_c[6]; |
398 | 398 | $ysq = $y * $y; |
399 | - for ($i = 0; $i < 6; ++$i) |
|
400 | - $res = $res / $ysq + $lg_c[$i]; |
|
399 | + for ($i = 0; $i < 6; ++$i) { |
|
400 | + $res = $res / $ysq + $lg_c[$i]; |
|
401 | + } |
|
401 | 402 | } |
402 | 403 | $res /= $y; |
403 | 404 | $corr = log($y); |
@@ -440,7 +441,9 @@ discard block |
||
440 | 441 | // Private implementation of the Gamma function |
441 | 442 | // |
442 | 443 | private static function _gamma($data) { |
443 | - if ($data == 0.0) return 0; |
|
444 | + if ($data == 0.0) { |
|
445 | + return 0; |
|
446 | + } |
|
444 | 447 | |
445 | 448 | static $p0 = 1.000000000190015; |
446 | 449 | static $p = array ( 1 => 76.18009172947146, |
@@ -1957,7 +1960,9 @@ discard block |
||
1957 | 1960 | public static function LINEST($yValues,$xValues=null,$const=True,$stats=False) { |
1958 | 1961 | $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
1959 | 1962 | $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); |
1960 | - if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
1963 | + if (is_null($xValues)) { |
|
1964 | + $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
1965 | + } |
|
1961 | 1966 | |
1962 | 1967 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
1963 | 1968 | return PHPExcel_Calculation_Functions::VALUE(); |
@@ -2010,7 +2015,9 @@ discard block |
||
2010 | 2015 | public static function LOGEST($yValues,$xValues=null,$const=True,$stats=False) { |
2011 | 2016 | $const = (is_null($const)) ? True : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($const); |
2012 | 2017 | $stats = (is_null($stats)) ? False : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($stats); |
2013 | - if (is_null($xValues)) $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
2018 | + if (is_null($xValues)) { |
|
2019 | + $xValues = range(1,count(PHPExcel_Calculation_Functions::flattenArray($yValues))); |
|
2020 | + } |
|
2014 | 2021 | |
2015 | 2022 | if (!self::_checkTrendArrays($yValues,$xValues)) { |
2016 | 2023 | return PHPExcel_Calculation_Functions::VALUE(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * CHARACTER |
70 | 70 | * |
71 | 71 | * @param string $character Value |
72 | - * @return int |
|
72 | + * @return string |
|
73 | 73 | */ |
74 | 74 | public static function CHARACTER($character) { |
75 | 75 | $character = PHPExcel_Calculation_Functions::flattenSingleValue($character); |
@@ -89,7 +89,6 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * TRIMNONPRINTABLE |
91 | 91 | * |
92 | - * @param mixed $value Value to check |
|
93 | 92 | * @return string |
94 | 93 | */ |
95 | 94 | public static function TRIMNONPRINTABLE($stringValue = '') { |
@@ -113,7 +112,6 @@ discard block |
||
113 | 112 | /** |
114 | 113 | * TRIMSPACES |
115 | 114 | * |
116 | - * @param mixed $value Value to check |
|
117 | 115 | * @return string |
118 | 116 | */ |
119 | 117 | public static function TRIMSPACES($stringValue = '') { |
@@ -133,7 +131,7 @@ discard block |
||
133 | 131 | /** |
134 | 132 | * ASCIICODE |
135 | 133 | * |
136 | - * @param string $character Value |
|
134 | + * @param string $characters Value |
|
137 | 135 | * @return int |
138 | 136 | */ |
139 | 137 | public static function ASCIICODE($characters) { |
@@ -192,7 +190,7 @@ discard block |
||
192 | 190 | * This function converts a number to text using currency format, with the decimals rounded to the specified place. |
193 | 191 | * The format used is $#,##0.00_);($#,##0.00).. |
194 | 192 | * |
195 | - * @param float $value The value to format |
|
193 | + * @param integer $value The value to format |
|
196 | 194 | * @param int $decimals The number of digits to display to the right of the decimal point. |
197 | 195 | * If decimals is negative, number is rounded to the left of the decimal point. |
198 | 196 | * If you omit decimals, it is assumed to be 2 |
@@ -291,7 +289,7 @@ discard block |
||
291 | 289 | * FIXEDFORMAT |
292 | 290 | * |
293 | 291 | * @param mixed $value Value to check |
294 | - * @return boolean |
|
292 | + * @return string |
|
295 | 293 | */ |
296 | 294 | public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) { |
297 | 295 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
@@ -401,8 +399,7 @@ discard block |
||
401 | 399 | * STRINGLENGTH |
402 | 400 | * |
403 | 401 | * @param string $value Value |
404 | - * @param int $chars Number of characters |
|
405 | - * @return string |
|
402 | + * @return integer |
|
406 | 403 | */ |
407 | 404 | public static function STRINGLENGTH($value = '') { |
408 | 405 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
@@ -491,7 +488,6 @@ discard block |
||
491 | 488 | /** |
492 | 489 | * REPLACE |
493 | 490 | * |
494 | - * @param string $value Value |
|
495 | 491 | * @param int $start Start character |
496 | 492 | * @param int $chars Number of characters |
497 | 493 | * @return string |
@@ -559,8 +555,7 @@ discard block |
||
559 | 555 | /** |
560 | 556 | * RETURNSTRING |
561 | 557 | * |
562 | - * @param mixed $value Value to check |
|
563 | - * @return boolean |
|
558 | + * @return string|null |
|
564 | 559 | */ |
565 | 560 | public static function RETURNSTRING($testValue = '') { |
566 | 561 | $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue); |
@@ -576,7 +571,7 @@ discard block |
||
576 | 571 | * TEXTFORMAT |
577 | 572 | * |
578 | 573 | * @param mixed $value Value to check |
579 | - * @return boolean |
|
574 | + * @return string |
|
580 | 575 | */ |
581 | 576 | public static function TEXTFORMAT($value,$format) { |
582 | 577 | $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | private static $_invalidChars = Null; |
49 | 49 | |
50 | 50 | private static function _uniord($c) { |
51 | - if (ord($c{0}) >=0 && ord($c{0}) <= 127) |
|
51 | + if (ord($c{0}) >= 0 && ord($c{0}) <= 127) |
|
52 | 52 | return ord($c{0}); |
53 | 53 | if (ord($c{0}) >= 192 && ord($c{0}) <= 223) |
54 | - return (ord($c{0})-192)*64 + (ord($c{1})-128); |
|
54 | + return (ord($c{0}) - 192) * 64 + (ord($c{1}) - 128); |
|
55 | 55 | if (ord($c{0}) >= 224 && ord($c{0}) <= 239) |
56 | - return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); |
|
56 | + return (ord($c{0}) - 224) * 4096 + (ord($c{1}) - 128) * 64 + (ord($c{2}) - 128); |
|
57 | 57 | if (ord($c{0}) >= 240 && ord($c{0}) <= 247) |
58 | - return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); |
|
58 | + return (ord($c{0}) - 240) * 262144 + (ord($c{1}) - 128) * 4096 + (ord($c{2}) - 128) * 64 + (ord($c{3}) - 128); |
|
59 | 59 | if (ord($c{0}) >= 248 && ord($c{0}) <= 251) |
60 | - return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); |
|
60 | + return (ord($c{0}) - 248) * 16777216 + (ord($c{1}) - 128) * 262144 + (ord($c{2}) - 128) * 4096 + (ord($c{3}) - 128) * 64 + (ord($c{4}) - 128); |
|
61 | 61 | if (ord($c{0}) >= 252 && ord($c{0}) <= 253) |
62 | - return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); |
|
62 | + return (ord($c{0}) - 252) * 1073741824 + (ord($c{1}) - 128) * 16777216 + (ord($c{2}) - 128) * 262144 + (ord($c{3}) - 128) * 4096 + (ord($c{4}) - 128) * 64 + (ord($c{5}) - 128); |
|
63 | 63 | if (ord($c{0}) >= 254 && ord($c{0}) <= 255) //error |
64 | 64 | return PHPExcel_Calculation_Functions::VALUE(); |
65 | 65 | return 0; |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * @return int |
73 | 73 | */ |
74 | 74 | public static function CHARACTER($character) { |
75 | - $character = PHPExcel_Calculation_Functions::flattenSingleValue($character); |
|
75 | + $character = PHPExcel_Calculation_Functions::flattenSingleValue($character); |
|
76 | 76 | |
77 | - if ((!is_numeric($character)) || ($character < 0)) { |
|
77 | + if (( ! is_numeric($character)) || ($character < 0)) { |
|
78 | 78 | return PHPExcel_Calculation_Functions::VALUE(); |
79 | 79 | } |
80 | 80 | |
@@ -93,18 +93,18 @@ discard block |
||
93 | 93 | * @return string |
94 | 94 | */ |
95 | 95 | public static function TRIMNONPRINTABLE($stringValue = '') { |
96 | - $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); |
|
96 | + $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); |
|
97 | 97 | |
98 | 98 | if (is_bool($stringValue)) { |
99 | 99 | return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
100 | 100 | } |
101 | 101 | |
102 | 102 | if (self::$_invalidChars == Null) { |
103 | - self::$_invalidChars = range(chr(0),chr(31)); |
|
103 | + self::$_invalidChars = range(chr(0), chr(31)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if (is_string($stringValue) || is_numeric($stringValue)) { |
107 | - return str_replace(self::$_invalidChars,'',trim($stringValue,"\x00..\x1F")); |
|
107 | + return str_replace(self::$_invalidChars, '', trim($stringValue, "\x00..\x1F")); |
|
108 | 108 | } |
109 | 109 | return NULL; |
110 | 110 | } // function TRIMNONPRINTABLE() |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | * @return string |
118 | 118 | */ |
119 | 119 | public static function TRIMSPACES($stringValue = '') { |
120 | - $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); |
|
120 | + $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); |
|
121 | 121 | |
122 | 122 | if (is_bool($stringValue)) { |
123 | 123 | return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | if (is_string($stringValue) || is_numeric($stringValue)) { |
127 | - return trim(preg_replace('/ +/',' ',trim($stringValue,' '))); |
|
127 | + return trim(preg_replace('/ +/', ' ', trim($stringValue, ' '))); |
|
128 | 128 | } |
129 | 129 | return NULL; |
130 | 130 | } // function TRIMSPACES() |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public static function ASCIICODE($characters) { |
140 | 140 | if (($characters === NULL) || ($characters === '')) |
141 | 141 | return PHPExcel_Calculation_Functions::VALUE(); |
142 | - $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters); |
|
142 | + $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters); |
|
143 | 143 | if (is_bool($characters)) { |
144 | 144 | if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { |
145 | 145 | $characters = (int) $characters; |
@@ -199,24 +199,24 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | */ |
201 | 201 | public static function DOLLAR($value = 0, $decimals = 2) { |
202 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
203 | - $decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals); |
|
202 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
203 | + $decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals); |
|
204 | 204 | |
205 | 205 | // Validate parameters |
206 | - if (!is_numeric($value) || !is_numeric($decimals)) { |
|
206 | + if ( ! is_numeric($value) || ! is_numeric($decimals)) { |
|
207 | 207 | return PHPExcel_Calculation_Functions::NaN(); |
208 | 208 | } |
209 | 209 | $decimals = floor($decimals); |
210 | 210 | |
211 | 211 | if ($decimals > 0) { |
212 | - return money_format('%.'.$decimals.'n',$value); |
|
212 | + return money_format('%.'.$decimals.'n', $value); |
|
213 | 213 | } else { |
214 | - $round = pow(10,abs($decimals)); |
|
215 | - if ($value < 0) { $round = 0-$round; } |
|
216 | - $value = PHPExcel_Calculation_MathTrig::MROUND($value,$round); |
|
214 | + $round = pow(10, abs($decimals)); |
|
215 | + if ($value < 0) { $round = 0 - $round; } |
|
216 | + $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round); |
|
217 | 217 | // The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0, |
218 | 218 | // so we display to 1 dp and chop off that character and the decimal separator using substr |
219 | - return substr(money_format('%.1n',$value),0,-2); |
|
219 | + return substr(money_format('%.1n', $value), 0, -2); |
|
220 | 220 | } |
221 | 221 | } // function DOLLAR() |
222 | 222 | |
@@ -229,19 +229,19 @@ discard block |
||
229 | 229 | * @param int $offset Offset within $haystack |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public static function SEARCHSENSITIVE($needle,$haystack,$offset=1) { |
|
232 | + public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) { |
|
233 | 233 | $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle); |
234 | - $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack); |
|
234 | + $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack); |
|
235 | 235 | $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset); |
236 | 236 | |
237 | - if (!is_bool($needle)) { |
|
237 | + if ( ! is_bool($needle)) { |
|
238 | 238 | if (is_bool($haystack)) { |
239 | 239 | $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
240 | 240 | } |
241 | 241 | |
242 | 242 | if (($offset > 0) && (strlen($haystack) > $offset)) { |
243 | 243 | if (function_exists('mb_strpos')) { |
244 | - $pos = mb_strpos($haystack, $needle, --$offset,'UTF-8'); |
|
244 | + $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8'); |
|
245 | 245 | } else { |
246 | 246 | $pos = strpos($haystack, $needle, --$offset); |
247 | 247 | } |
@@ -262,19 +262,19 @@ discard block |
||
262 | 262 | * @param int $offset Offset within $haystack |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public static function SEARCHINSENSITIVE($needle,$haystack,$offset=1) { |
|
265 | + public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1) { |
|
266 | 266 | $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle); |
267 | - $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack); |
|
267 | + $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack); |
|
268 | 268 | $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset); |
269 | 269 | |
270 | - if (!is_bool($needle)) { |
|
270 | + if ( ! is_bool($needle)) { |
|
271 | 271 | if (is_bool($haystack)) { |
272 | 272 | $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
273 | 273 | } |
274 | 274 | |
275 | 275 | if (($offset > 0) && (strlen($haystack) > $offset)) { |
276 | 276 | if (function_exists('mb_stripos')) { |
277 | - $pos = mb_stripos($haystack, $needle, --$offset,'UTF-8'); |
|
277 | + $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8'); |
|
278 | 278 | } else { |
279 | 279 | $pos = stripos($haystack, $needle, --$offset); |
280 | 280 | } |
@@ -294,20 +294,20 @@ discard block |
||
294 | 294 | * @return boolean |
295 | 295 | */ |
296 | 296 | public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = FALSE) { |
297 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
298 | - $decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals); |
|
299 | - $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas); |
|
297 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
298 | + $decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals); |
|
299 | + $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas); |
|
300 | 300 | |
301 | 301 | // Validate parameters |
302 | - if (!is_numeric($value) || !is_numeric($decimals)) { |
|
302 | + if ( ! is_numeric($value) || ! is_numeric($decimals)) { |
|
303 | 303 | return PHPExcel_Calculation_Functions::NaN(); |
304 | 304 | } |
305 | 305 | $decimals = floor($decimals); |
306 | 306 | |
307 | - $valueResult = round($value,$decimals); |
|
307 | + $valueResult = round($value, $decimals); |
|
308 | 308 | if ($decimals < 0) { $decimals = 0; } |
309 | - if (!$no_commas) { |
|
310 | - $valueResult = number_format($valueResult,$decimals); |
|
309 | + if ( ! $no_commas) { |
|
310 | + $valueResult = number_format($valueResult, $decimals); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | return (string) $valueResult; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @return string |
429 | 429 | */ |
430 | 430 | public static function LOWERCASE($mixedCaseString) { |
431 | - $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); |
|
431 | + $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); |
|
432 | 432 | |
433 | 433 | if (is_bool($mixedCaseString)) { |
434 | 434 | $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @return string |
452 | 452 | */ |
453 | 453 | public static function UPPERCASE($mixedCaseString) { |
454 | - $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); |
|
454 | + $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); |
|
455 | 455 | |
456 | 456 | if (is_bool($mixedCaseString)) { |
457 | 457 | $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @return string |
475 | 475 | */ |
476 | 476 | public static function PROPERCASE($mixedCaseString) { |
477 | - $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); |
|
477 | + $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); |
|
478 | 478 | |
479 | 479 | if (is_bool($mixedCaseString)) { |
480 | 480 | $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars); |
503 | 503 | $newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText); |
504 | 504 | |
505 | - $left = self::LEFT($oldText,$start-1); |
|
506 | - $right = self::RIGHT($oldText,self::STRINGLENGTH($oldText)-($start+$chars)+1); |
|
505 | + $left = self::LEFT($oldText, $start - 1); |
|
506 | + $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText) - ($start + $chars) + 1); |
|
507 | 507 | |
508 | 508 | return $left.$newText.$right; |
509 | 509 | } // function REPLACE() |
@@ -519,24 +519,24 @@ discard block |
||
519 | 519 | * @return string |
520 | 520 | */ |
521 | 521 | public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) { |
522 | - $text = PHPExcel_Calculation_Functions::flattenSingleValue($text); |
|
522 | + $text = PHPExcel_Calculation_Functions::flattenSingleValue($text); |
|
523 | 523 | $fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText); |
524 | - $toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText); |
|
524 | + $toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText); |
|
525 | 525 | $instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance)); |
526 | 526 | |
527 | 527 | if ($instance == 0) { |
528 | - if(function_exists('mb_str_replace')) { |
|
529 | - return mb_str_replace($fromText,$toText,$text); |
|
528 | + if (function_exists('mb_str_replace')) { |
|
529 | + return mb_str_replace($fromText, $toText, $text); |
|
530 | 530 | } else { |
531 | - return str_replace($fromText,$toText,$text); |
|
531 | + return str_replace($fromText, $toText, $text); |
|
532 | 532 | } |
533 | 533 | } else { |
534 | 534 | $pos = -1; |
535 | - while($instance > 0) { |
|
535 | + while ($instance > 0) { |
|
536 | 536 | if (function_exists('mb_strpos')) { |
537 | - $pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8'); |
|
537 | + $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8'); |
|
538 | 538 | } else { |
539 | - $pos = strpos($text, $fromText, $pos+1); |
|
539 | + $pos = strpos($text, $fromText, $pos + 1); |
|
540 | 540 | } |
541 | 541 | if ($pos === false) { |
542 | 542 | break; |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | } |
546 | 546 | if ($pos !== false) { |
547 | 547 | if (function_exists('mb_strlen')) { |
548 | - return self::REPLACE($text,++$pos,mb_strlen($fromText, 'UTF-8'),$toText); |
|
548 | + return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText); |
|
549 | 549 | } else { |
550 | - return self::REPLACE($text,++$pos,strlen($fromText),$toText); |
|
550 | + return self::REPLACE($text, ++$pos, strlen($fromText), $toText); |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @return boolean |
564 | 564 | */ |
565 | 565 | public static function RETURNSTRING($testValue = '') { |
566 | - $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue); |
|
566 | + $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue); |
|
567 | 567 | |
568 | 568 | if (is_string($testValue)) { |
569 | 569 | return $testValue; |
@@ -578,15 +578,15 @@ discard block |
||
578 | 578 | * @param mixed $value Value to check |
579 | 579 | * @return boolean |
580 | 580 | */ |
581 | - public static function TEXTFORMAT($value,$format) { |
|
582 | - $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
581 | + public static function TEXTFORMAT($value, $format) { |
|
582 | + $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); |
|
583 | 583 | $format = PHPExcel_Calculation_Functions::flattenSingleValue($format); |
584 | 584 | |
585 | - if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) { |
|
585 | + if ((is_string($value)) && ( ! is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) { |
|
586 | 586 | $value = PHPExcel_Calculation_DateTime::DATEVALUE($value); |
587 | 587 | } |
588 | 588 | |
589 | - return (string) PHPExcel_Style_NumberFormat::toFormattedString($value,$format); |
|
589 | + return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format); |
|
590 | 590 | } // function TEXTFORMAT() |
591 | 591 | |
592 | 592 | } // class PHPExcel_Calculation_TextData |
@@ -48,20 +48,28 @@ discard block |
||
48 | 48 | private static $_invalidChars = Null; |
49 | 49 | |
50 | 50 | private static function _uniord($c) { |
51 | - if (ord($c{0}) >=0 && ord($c{0}) <= 127) |
|
52 | - return ord($c{0}); |
|
53 | - if (ord($c{0}) >= 192 && ord($c{0}) <= 223) |
|
54 | - return (ord($c{0})-192)*64 + (ord($c{1})-128); |
|
55 | - if (ord($c{0}) >= 224 && ord($c{0}) <= 239) |
|
56 | - return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); |
|
57 | - if (ord($c{0}) >= 240 && ord($c{0}) <= 247) |
|
58 | - return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); |
|
59 | - if (ord($c{0}) >= 248 && ord($c{0}) <= 251) |
|
60 | - return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); |
|
61 | - if (ord($c{0}) >= 252 && ord($c{0}) <= 253) |
|
62 | - return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); |
|
63 | - if (ord($c{0}) >= 254 && ord($c{0}) <= 255) //error |
|
51 | + if (ord($c{0}) >=0 && ord($c{0}) <= 127) { |
|
52 | + return ord($c{0}); |
|
53 | + } |
|
54 | + if (ord($c{0}) >= 192 && ord($c{0}) <= 223) { |
|
55 | + return (ord($c{0})-192)*64 + (ord($c{1})-128); |
|
56 | + } |
|
57 | + if (ord($c{0}) >= 224 && ord($c{0}) <= 239) { |
|
58 | + return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); |
|
59 | + } |
|
60 | + if (ord($c{0}) >= 240 && ord($c{0}) <= 247) { |
|
61 | + return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); |
|
62 | + } |
|
63 | + if (ord($c{0}) >= 248 && ord($c{0}) <= 251) { |
|
64 | + return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); |
|
65 | + } |
|
66 | + if (ord($c{0}) >= 252 && ord($c{0}) <= 253) { |
|
67 | + return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); |
|
68 | + } |
|
69 | + if (ord($c{0}) >= 254 && ord($c{0}) <= 255) { |
|
70 | + //error |
|
64 | 71 | return PHPExcel_Calculation_Functions::VALUE(); |
72 | + } |
|
65 | 73 | return 0; |
66 | 74 | } // function _uniord() |
67 | 75 | |
@@ -137,8 +145,9 @@ discard block |
||
137 | 145 | * @return int |
138 | 146 | */ |
139 | 147 | public static function ASCIICODE($characters) { |
140 | - if (($characters === NULL) || ($characters === '')) |
|
141 | - return PHPExcel_Calculation_Functions::VALUE(); |
|
148 | + if (($characters === NULL) || ($characters === '')) { |
|
149 | + return PHPExcel_Calculation_Functions::VALUE(); |
|
150 | + } |
|
142 | 151 | $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters); |
143 | 152 | if (is_bool($characters)) { |
144 | 153 | if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * Send notification to the cache controller |
104 | 104 | * |
105 | - * @return void |
|
105 | + * @return PHPExcel_Cell |
|
106 | 106 | **/ |
107 | 107 | public function notifyCacheController() { |
108 | 108 | $this->_parent->getCellCacheController()->updateCacheData($this); |
@@ -113,6 +113,9 @@ discard block |
||
113 | 113 | $this->_parent = null; |
114 | 114 | } |
115 | 115 | |
116 | + /** |
|
117 | + * @param PHPExcel_Worksheet|null $parent |
|
118 | + */ |
|
116 | 119 | public function attach($parent) { |
117 | 120 | $this->_parent = $parent; |
118 | 121 | } |
@@ -498,7 +501,7 @@ discard block |
||
498 | 501 | * Coordinate from string |
499 | 502 | * |
500 | 503 | * @param string $pCoordinateString |
501 | - * @return array Array containing column and row (indexes 0 and 1) |
|
504 | + * @return string[] Array containing column and row (indexes 0 and 1) |
|
502 | 505 | * @throws Exception |
503 | 506 | */ |
504 | 507 | public static function coordinateFromString($pCoordinateString = 'A1') |
@@ -652,7 +655,7 @@ discard block |
||
652 | 655 | * Calculate range boundaries |
653 | 656 | * |
654 | 657 | * @param string $pRange Cell range (e.g. A1:A1) |
655 | - * @return array Range boundaries (staring Column, starting Row, Final Column, Final Row) |
|
658 | + * @return integer Range boundaries (staring Column, starting Row, Final Column, Final Row) |
|
656 | 659 | */ |
657 | 660 | public static function getRangeBoundaries($pRange = 'A1:A1') |
658 | 661 | { |
@@ -203,8 +203,8 @@ |
||
203 | 203 | public function getFormattedValue() |
204 | 204 | { |
205 | 205 | return (string) PHPExcel_Style_NumberFormat::toFormattedString( $this->getCalculatedValue(), |
206 | - $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode() |
|
207 | - ); |
|
206 | + $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode() |
|
207 | + ); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
147 | 147 | $this->_dataType = $pDataType; |
148 | 148 | } else { |
149 | - if (!self::getValueBinder()->bindValue($this, $pValue)) { |
|
149 | + if ( ! self::getValueBinder()->bindValue($this, $pValue)) { |
|
150 | 150 | throw new Exception("Value could not be bound to cell."); |
151 | 151 | } |
152 | 152 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function getCoordinate() |
184 | 184 | { |
185 | - return $this->_column . $this->_row; |
|
185 | + return $this->_column.$this->_row; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function getFormattedValue() |
204 | 204 | { |
205 | - return (string) PHPExcel_Style_NumberFormat::toFormattedString( $this->getCalculatedValue(), |
|
205 | + return (string) PHPExcel_Style_NumberFormat::toFormattedString($this->getCalculatedValue(), |
|
206 | 206 | $this->_parent->getParent()->getCellXfByIndex($this->getXfIndex())->getNumberFormat()->getFormatCode() |
207 | 207 | ); |
208 | 208 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function setValue($pValue = null) |
219 | 219 | { |
220 | - if (!self::getValueBinder()->bindValue($this, $pValue)) { |
|
220 | + if ( ! self::getValueBinder()->bindValue($this, $pValue)) { |
|
221 | 221 | throw new Exception("Value could not be bound to cell."); |
222 | 222 | } |
223 | 223 | return $this; |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | break; |
245 | 245 | |
246 | 246 | case PHPExcel_Cell_DataType::TYPE_NUMERIC: |
247 | - $this->_value = (float)$pValue; |
|
247 | + $this->_value = (float) $pValue; |
|
248 | 248 | break; |
249 | 249 | |
250 | 250 | case PHPExcel_Cell_DataType::TYPE_FORMULA: |
251 | - $this->_value = (string)$pValue; |
|
251 | + $this->_value = (string) $pValue; |
|
252 | 252 | break; |
253 | 253 | |
254 | 254 | case PHPExcel_Cell_DataType::TYPE_BOOL: |
255 | - $this->_value = (bool)$pValue; |
|
255 | + $this->_value = (bool) $pValue; |
|
256 | 256 | break; |
257 | 257 | |
258 | 258 | case PHPExcel_Cell_DataType::TYPE_ERROR: |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | break; |
261 | 261 | |
262 | 262 | default: |
263 | - throw new Exception('Invalid datatype: ' . $pDataType); |
|
263 | + throw new Exception('Invalid datatype: '.$pDataType); |
|
264 | 264 | break; |
265 | 265 | } |
266 | 266 | |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return mixed |
277 | 277 | */ |
278 | - public function getCalculatedValue($resetLog=true) |
|
278 | + public function getCalculatedValue($resetLog = true) |
|
279 | 279 | { |
280 | 280 | // echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().'<br />'; |
281 | 281 | if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { |
282 | 282 | try { |
283 | 283 | // echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value<br />'; |
284 | - $result = PHPExcel_Calculation::getInstance()->calculateCellValue($this,$resetLog); |
|
284 | + $result = PHPExcel_Calculation::getInstance()->calculateCellValue($this, $resetLog); |
|
285 | 285 | // echo $this->getCoordinate().' calculation result is '.$result.'<br />'; |
286 | - } catch ( Exception $ex ) { |
|
286 | + } catch (Exception $ex) { |
|
287 | 287 | if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) { |
288 | 288 | // echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().'<br />'; |
289 | 289 | return $this->_calculatedValue; // Fallback for calculations referencing external files. |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function hasDataValidation() |
369 | 369 | { |
370 | - if (!isset($this->_parent)) { |
|
370 | + if ( ! isset($this->_parent)) { |
|
371 | 371 | throw new Exception('Cannot check for data validation when cell is not bound to a worksheet'); |
372 | 372 | } |
373 | 373 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public function getDataValidation() |
383 | 383 | { |
384 | - if (!isset($this->_parent)) { |
|
384 | + if ( ! isset($this->_parent)) { |
|
385 | 385 | throw new Exception('Cannot get data validation for cell that is not bound to a worksheet'); |
386 | 386 | } |
387 | 387 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null) |
399 | 399 | { |
400 | - if (!isset($this->_parent)) { |
|
400 | + if ( ! isset($this->_parent)) { |
|
401 | 401 | throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); |
402 | 402 | } |
403 | 403 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public function hasHyperlink() |
415 | 415 | { |
416 | - if (!isset($this->_parent)) { |
|
416 | + if ( ! isset($this->_parent)) { |
|
417 | 417 | throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); |
418 | 418 | } |
419 | 419 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | */ |
429 | 429 | public function getHyperlink() |
430 | 430 | { |
431 | - if (!isset($this->_parent)) { |
|
431 | + if ( ! isset($this->_parent)) { |
|
432 | 432 | throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); |
433 | 433 | } |
434 | 434 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | */ |
445 | 445 | public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null) |
446 | 446 | { |
447 | - if (!isset($this->_parent)) { |
|
447 | + if ( ! isset($this->_parent)) { |
|
448 | 448 | throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); |
449 | 449 | } |
450 | 450 | |
@@ -482,11 +482,11 @@ discard block |
||
482 | 482 | */ |
483 | 483 | public function isInRange($pRange = 'A1:A1') |
484 | 484 | { |
485 | - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
485 | + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
486 | 486 | |
487 | 487 | // Translate properties |
488 | - $myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn()); |
|
489 | - $myRow = $this->getRow(); |
|
488 | + $myColumn = PHPExcel_Cell::columnIndexFromString($this->getColumn()); |
|
489 | + $myRow = $this->getRow(); |
|
490 | 490 | |
491 | 491 | // Verify if cell is in range |
492 | 492 | return (($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) && |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | public static function coordinateFromString($pCoordinateString = 'A1') |
505 | 505 | { |
506 | 506 | if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) { |
507 | - return array($matches[1],$matches[2]); |
|
508 | - } elseif ((strpos($pCoordinateString,':') !== false) || (strpos($pCoordinateString,',') !== false)) { |
|
507 | + return array($matches[1], $matches[2]); |
|
508 | + } elseif ((strpos($pCoordinateString, ':') !== false) || (strpos($pCoordinateString, ',') !== false)) { |
|
509 | 509 | throw new Exception('Cell coordinate string can not be a range of cells.'); |
510 | 510 | } elseif ($pCoordinateString == '') { |
511 | 511 | throw new Exception('Cell coordinate can not be zero-length string.'); |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | */ |
524 | 524 | public static function absoluteReference($pCoordinateString = 'A1') |
525 | 525 | { |
526 | - if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) { |
|
526 | + if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) { |
|
527 | 527 | // Create absolute coordinate |
528 | 528 | if (ctype_digit($pCoordinateString)) { |
529 | 529 | return '$'.$pCoordinateString; |
@@ -545,20 +545,20 @@ discard block |
||
545 | 545 | */ |
546 | 546 | public static function absoluteCoordinate($pCoordinateString = 'A1') |
547 | 547 | { |
548 | - if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) { |
|
548 | + if (strpos($pCoordinateString, ':') === false && strpos($pCoordinateString, ',') === false) { |
|
549 | 549 | // Create absolute coordinate |
550 | 550 | $worksheet = ''; |
551 | - $cellAddress = explode('!',$pCoordinateString); |
|
551 | + $cellAddress = explode('!', $pCoordinateString); |
|
552 | 552 | if (count($cellAddress) == 2) { |
553 | - list($worksheet,$pCoordinateString) = $cellAddress; |
|
553 | + list($worksheet, $pCoordinateString) = $cellAddress; |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString); |
557 | - if ($column[0] == '$') $column = substr($column,1); |
|
558 | - if ($row[0] == '$') $row = substr($row,1); |
|
557 | + if ($column[0] == '$') $column = substr($column, 1); |
|
558 | + if ($row[0] == '$') $row = substr($row, 1); |
|
559 | 559 | if ($worksheet > '') |
560 | 560 | $worksheet .= '!'; |
561 | - return $worksheet . '$' . $column . '$' . $row; |
|
561 | + return $worksheet.'$'.$column.'$'.$row; |
|
562 | 562 | } else { |
563 | 563 | throw new Exception("Coordinate string should not be a cell range."); |
564 | 564 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | public static function buildRange($pRange) |
591 | 591 | { |
592 | 592 | // Verify range |
593 | - if (!is_array($pRange) || empty($pRange) || !is_array($pRange[0])) { |
|
593 | + if ( ! is_array($pRange) || empty($pRange) || ! is_array($pRange[0])) { |
|
594 | 594 | throw new Exception('Range does not contain any information.'); |
595 | 595 | } |
596 | 596 | |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | |
626 | 626 | // Calculate range outer borders |
627 | 627 | $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA); |
628 | - $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|
628 | + $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB); |
|
629 | 629 | |
630 | 630 | // Translate column into index |
631 | - $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]); |
|
632 | - $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]); |
|
631 | + $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]); |
|
632 | + $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]); |
|
633 | 633 | |
634 | 634 | return array($rangeStart, $rangeEnd); |
635 | 635 | } |
@@ -643,9 +643,9 @@ discard block |
||
643 | 643 | public static function rangeDimension($pRange = 'A1:A1') |
644 | 644 | { |
645 | 645 | // Calculate range outer borders |
646 | - list($rangeStart,$rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
646 | + list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange); |
|
647 | 647 | |
648 | - return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) ); |
|
648 | + return array(($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1)); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | /** |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | list($rangeA, $rangeB) = explode(':', $pRange); |
667 | 667 | } |
668 | 668 | |
669 | - return array( self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)); |
|
669 | + return array(self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | /** |
@@ -699,18 +699,18 @@ discard block |
||
699 | 699 | // We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString |
700 | 700 | // for improved performance |
701 | 701 | if (isset($pString{0})) { |
702 | - if (!isset($pString{1})) { |
|
702 | + if ( ! isset($pString{1})) { |
|
703 | 703 | $_indexCache[$pString] = $_columnLookup[$pString]; |
704 | 704 | return $_indexCache[$pString]; |
705 | - } elseif(!isset($pString{2})) { |
|
705 | + } elseif ( ! isset($pString{2})) { |
|
706 | 706 | $_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}]; |
707 | 707 | return $_indexCache[$pString]; |
708 | - } elseif(!isset($pString{3})) { |
|
708 | + } elseif ( ! isset($pString{3})) { |
|
709 | 709 | $_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}]; |
710 | 710 | return $_indexCache[$pString]; |
711 | 711 | } |
712 | 712 | } |
713 | - throw new Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty") . "."); |
|
713 | + throw new Exception("Column string index can not be ".((isset($pString{0})) ? "longer than 3 characters" : "empty")."."); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | /** |
@@ -726,16 +726,16 @@ discard block |
||
726 | 726 | // though it's additional memory overhead |
727 | 727 | static $_indexCache = array(); |
728 | 728 | |
729 | - if (!isset($_indexCache[$pColumnIndex])) { |
|
729 | + if ( ! isset($_indexCache[$pColumnIndex])) { |
|
730 | 730 | // Determine column string |
731 | 731 | if ($pColumnIndex < 26) { |
732 | 732 | $_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex); |
733 | 733 | } elseif ($pColumnIndex < 702) { |
734 | - $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) . |
|
734 | + $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)). |
|
735 | 735 | chr(65 + $pColumnIndex % 26); |
736 | 736 | } else { |
737 | - $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) . |
|
738 | - chr(65 + ((($pColumnIndex - 26) % 676) / 26)) . |
|
737 | + $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)). |
|
738 | + chr(65 + ((($pColumnIndex - 26) % 676) / 26)). |
|
739 | 739 | chr(65 + $pColumnIndex % 26); |
740 | 740 | } |
741 | 741 | } |
@@ -756,24 +756,24 @@ discard block |
||
756 | 756 | $cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange))); |
757 | 757 | foreach ($cellBlocks as $cellBlock) { |
758 | 758 | // Single cell? |
759 | - if (strpos($cellBlock,':') === false && strpos($cellBlock,',') === false) { |
|
759 | + if (strpos($cellBlock, ':') === false && strpos($cellBlock, ',') === false) { |
|
760 | 760 | $returnValue[] = $cellBlock; |
761 | 761 | continue; |
762 | 762 | } |
763 | 763 | |
764 | 764 | // Range... |
765 | 765 | $ranges = PHPExcel_Cell::splitRange($cellBlock); |
766 | - foreach($ranges as $range) { |
|
766 | + foreach ($ranges as $range) { |
|
767 | 767 | // Single cell? |
768 | - if (!isset($range[1])) { |
|
768 | + if ( ! isset($range[1])) { |
|
769 | 769 | $returnValue[] = $range[0]; |
770 | 770 | continue; |
771 | 771 | } |
772 | 772 | |
773 | 773 | // Range... |
774 | - list($rangeStart, $rangeEnd) = $range; |
|
775 | - list($startCol, $startRow) = sscanf($rangeStart,'%[A-Z]%d'); |
|
776 | - list($endCol, $endRow) = sscanf($rangeEnd,'%[A-Z]%d'); |
|
774 | + list($rangeStart, $rangeEnd) = $range; |
|
775 | + list($startCol, $startRow) = sscanf($rangeStart, '%[A-Z]%d'); |
|
776 | + list($endCol, $endRow) = sscanf($rangeEnd, '%[A-Z]%d'); |
|
777 | 777 | $endCol++; |
778 | 778 | |
779 | 779 | // Current data |
@@ -142,8 +142,9 @@ discard block |
||
142 | 142 | |
143 | 143 | // Set datatype? |
144 | 144 | if ($pDataType !== null) { |
145 | - if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) |
|
146 | - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
145 | + if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) { |
|
146 | + $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
147 | + } |
|
147 | 148 | $this->_dataType = $pDataType; |
148 | 149 | } else { |
149 | 150 | if (!self::getValueBinder()->bindValue($this, $pValue)) { |
@@ -352,8 +353,9 @@ discard block |
||
352 | 353 | */ |
353 | 354 | public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) |
354 | 355 | { |
355 | - if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) |
|
356 | - $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
356 | + if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) { |
|
357 | + $pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
358 | + } |
|
357 | 359 | |
358 | 360 | $this->_dataType = $pDataType; |
359 | 361 | |
@@ -554,10 +556,15 @@ discard block |
||
554 | 556 | } |
555 | 557 | |
556 | 558 | list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString); |
557 | - if ($column[0] == '$') $column = substr($column,1); |
|
558 | - if ($row[0] == '$') $row = substr($row,1); |
|
559 | - if ($worksheet > '') |
|
560 | - $worksheet .= '!'; |
|
559 | + if ($column[0] == '$') { |
|
560 | + $column = substr($column,1); |
|
561 | + } |
|
562 | + if ($row[0] == '$') { |
|
563 | + $row = substr($row,1); |
|
564 | + } |
|
565 | + if ($worksheet > '') { |
|
566 | + $worksheet .= '!'; |
|
567 | + } |
|
561 | 568 | return $worksheet . '$' . $column . '$' . $row; |
562 | 569 | } else { |
563 | 570 | throw new Exception("Coordinate string should not be a cell range."); |
@@ -683,8 +690,9 @@ discard block |
||
683 | 690 | // though it's additional memory overhead |
684 | 691 | static $_indexCache = array(); |
685 | 692 | |
686 | - if (isset($_indexCache[$pString])) |
|
687 | - return $_indexCache[$pString]; |
|
693 | + if (isset($_indexCache[$pString])) { |
|
694 | + return $_indexCache[$pString]; |
|
695 | + } |
|
688 | 696 | |
689 | 697 | // It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord() |
690 | 698 | // and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | /** |
177 | 177 | * Get Plot Grouping Type |
178 | 178 | * |
179 | - * @return string |
|
179 | + * @return boolean |
|
180 | 180 | */ |
181 | 181 | public function getPlotGrouping() { |
182 | 182 | return $this->_plotGrouping; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | /** |
195 | 195 | * Get Plot Direction |
196 | 196 | * |
197 | - * @return string |
|
197 | + * @return boolean |
|
198 | 198 | */ |
199 | 199 | public function getPlotDirection() { |
200 | 200 | return $this->_plotDirection; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | /** |
321 | 321 | * Get Smooth Line |
322 | 322 | * |
323 | - * @return boolean |
|
323 | + * @return string |
|
324 | 324 | */ |
325 | 325 | public function getSmoothLine() { |
326 | 326 | return $this->_smoothLine; |
@@ -336,7 +336,7 @@ |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | public function refresh(PHPExcel_Worksheet $worksheet) { |
339 | - foreach($this->_plotValues as $plotValues) { |
|
339 | + foreach($this->_plotValues as $plotValues) { |
|
340 | 340 | $plotValues->refresh($worksheet); |
341 | 341 | } |
342 | 342 | } |
@@ -37,25 +37,25 @@ discard block |
||
37 | 37 | { |
38 | 38 | |
39 | 39 | const TYPE_BARCHART = 'barChart'; |
40 | - const TYPE_BARCHART_3D = 'bar3DChart'; |
|
40 | + const TYPE_BARCHART_3D = 'bar3DChart'; |
|
41 | 41 | const TYPE_LINECHART = 'lineChart'; |
42 | 42 | const TYPE_LINECHART_3D = 'line3DChart'; |
43 | 43 | const TYPE_AREACHART = 'areaChart'; |
44 | 44 | const TYPE_AREACHART_3D = 'area3DChart'; |
45 | 45 | const TYPE_PIECHART = 'pieChart'; |
46 | - const TYPE_PIECHART_3D = 'pie3DChart'; |
|
47 | - const TYPE_DOUGHTNUTCHART = 'doughnutChart'; |
|
48 | - const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym |
|
46 | + const TYPE_PIECHART_3D = 'pie3DChart'; |
|
47 | + const TYPE_DOUGHTNUTCHART = 'doughnutChart'; |
|
48 | + const TYPE_DONUTCHART = self::TYPE_DOUGHTNUTCHART; // Synonym |
|
49 | 49 | const TYPE_SCATTERCHART = 'scatterChart'; |
50 | 50 | const TYPE_SURFACECHART = 'surfaceChart'; |
51 | - const TYPE_SURFACECHART_3D = 'surface3DChart'; |
|
51 | + const TYPE_SURFACECHART_3D = 'surface3DChart'; |
|
52 | 52 | const TYPE_RADARCHART = 'radarChart'; |
53 | - const TYPE_BUBBLECHART = 'bubbleChart'; |
|
53 | + const TYPE_BUBBLECHART = 'bubbleChart'; |
|
54 | 54 | const TYPE_STOCKCHART = 'stockChart'; |
55 | 55 | |
56 | 56 | const GROUPING_CLUSTERED = 'clustered'; |
57 | - const GROUPING_STACKED = 'stacked'; |
|
58 | - const GROUPING_PERCENT_STACKED = 'percentStacked'; |
|
57 | + const GROUPING_STACKED = 'stacked'; |
|
58 | + const GROUPING_PERCENT_STACKED = 'percentStacked'; |
|
59 | 59 | const GROUPING_STANDARD = 'standard'; |
60 | 60 | |
61 | 61 | const DIRECTION_BAR = 'bar'; |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function getPlotLabelByIndex($index) { |
236 | 236 | $keys = array_keys($this->_plotLabel); |
237 | - if (in_array($index,$keys)) { |
|
237 | + if (in_array($index, $keys)) { |
|
238 | 238 | return $this->_plotLabel[$index]; |
239 | - } elseif(isset($keys[$index])) { |
|
239 | + } elseif (isset($keys[$index])) { |
|
240 | 240 | return $this->_plotLabel[$keys[$index]]; |
241 | 241 | } |
242 | 242 | return false; |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function getPlotCategoryByIndex($index) { |
260 | 260 | $keys = array_keys($this->_plotCategory); |
261 | - if (in_array($index,$keys)) { |
|
261 | + if (in_array($index, $keys)) { |
|
262 | 262 | return $this->_plotCategory[$index]; |
263 | - } elseif(isset($keys[$index])) { |
|
263 | + } elseif (isset($keys[$index])) { |
|
264 | 264 | return $this->_plotCategory[$keys[$index]]; |
265 | 265 | } |
266 | 266 | return false; |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function getPlotValuesByIndex($index) { |
302 | 302 | $keys = array_keys($this->_plotValues); |
303 | - if (in_array($index,$keys)) { |
|
303 | + if (in_array($index, $keys)) { |
|
304 | 304 | return $this->_plotValues[$index]; |
305 | - } elseif(isset($keys[$index])) { |
|
305 | + } elseif (isset($keys[$index])) { |
|
306 | 306 | return $this->_plotValues[$keys[$index]]; |
307 | 307 | } |
308 | 308 | return false; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | public function refresh(PHPExcel_Worksheet $worksheet) { |
339 | - foreach($this->_plotValues as $plotValues) { |
|
339 | + foreach ($this->_plotValues as $plotValues) { |
|
340 | 340 | $plotValues->refresh($worksheet); |
341 | 341 | } |
342 | 342 | } |
@@ -80,6 +80,8 @@ discard block |
||
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Create a new PHPExcel_Chart_DataSeriesValues object |
83 | + * @param string $dataType |
|
84 | + * @param string $dataSource |
|
83 | 85 | */ |
84 | 86 | public function __construct($dataType = null, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null) |
85 | 87 | { |
@@ -191,7 +193,7 @@ discard block |
||
191 | 193 | /** |
192 | 194 | * Identify if the Data Series is a multi-level or a simple series |
193 | 195 | * |
194 | - * @return boolean |
|
196 | + * @return boolean|null |
|
195 | 197 | */ |
196 | 198 | public function isMultiLevelSeries() { |
197 | 199 | if (count($this->_dataValues) > 0) { |
@@ -203,7 +205,7 @@ discard block |
||
203 | 205 | /** |
204 | 206 | * Return the level count of a multi-level Data Series |
205 | 207 | * |
206 | - * @return boolean |
|
208 | + * @return integer |
|
207 | 209 | */ |
208 | 210 | public function multiLevelCount() { |
209 | 211 | $levelCount = 0; |
@@ -258,12 +258,12 @@ |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | public function refresh(PHPExcel_Worksheet $worksheet) { |
261 | - if ($this->_dataSource !== NULL) { |
|
262 | - $calcEngine = PHPExcel_Calculation::getInstance(); |
|
261 | + if ($this->_dataSource !== NULL) { |
|
262 | + $calcEngine = PHPExcel_Calculation::getInstance(); |
|
263 | 263 | $this->_dataValues = PHPExcel_Calculation::_unwrapResult( |
264 | - $calcEngine->_calculateFormulaValue( |
|
265 | - $this->_dataSource |
|
266 | - ) |
|
264 | + $calcEngine->_calculateFormulaValue( |
|
265 | + $this->_dataSource |
|
266 | + ) |
|
267 | 267 | ); |
268 | 268 | } |
269 | 269 | } |
@@ -207,8 +207,8 @@ |
||
207 | 207 | */ |
208 | 208 | public function multiLevelCount() { |
209 | 209 | $levelCount = 0; |
210 | - foreach($this->_dataValues as $dataValueSet) { |
|
211 | - $levelCount = max($levelCount,count($dataValueSet)); |
|
210 | + foreach ($this->_dataValues as $dataValueSet) { |
|
211 | + $levelCount = max($levelCount, count($dataValueSet)); |
|
212 | 212 | } |
213 | 213 | return $levelCount; |
214 | 214 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * Get X-Position |
158 | 158 | * |
159 | - * @return number |
|
159 | + * @return double |
|
160 | 160 | */ |
161 | 161 | public function getXPosition() { |
162 | 162 | return $this->_xPos; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * Get Y-Position |
176 | 176 | * |
177 | - * @return number |
|
177 | + * @return double |
|
178 | 178 | */ |
179 | 179 | public function getYPosition() { |
180 | 180 | return $this->_yPos; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | /** |
193 | 193 | * Get Width |
194 | 194 | * |
195 | - * @return number |
|
195 | + * @return double |
|
196 | 196 | */ |
197 | 197 | public function getWidth() { |
198 | 198 | return $this->_width; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * Get Height |
212 | 212 | * |
213 | - * @return number |
|
213 | + * @return double |
|
214 | 214 | */ |
215 | 215 | public function getHeight() { |
216 | 216 | return $this->_height; |
@@ -47,56 +47,56 @@ |
||
47 | 47 | * |
48 | 48 | * @var string |
49 | 49 | */ |
50 | - private $_xMode = null; |
|
50 | + private $_xMode = null; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Y Mode |
54 | 54 | * |
55 | 55 | * @var string |
56 | 56 | */ |
57 | - private $_yMode = null; |
|
57 | + private $_yMode = null; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * X-Position |
61 | 61 | * |
62 | 62 | * @var float |
63 | 63 | */ |
64 | - private $_xPos = null; |
|
64 | + private $_xPos = null; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Y-Position |
68 | 68 | * |
69 | 69 | * @var float |
70 | 70 | */ |
71 | - private $_yPos = null; |
|
71 | + private $_yPos = null; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * width |
75 | 75 | * |
76 | 76 | * @var float |
77 | 77 | */ |
78 | - private $_width = null; |
|
78 | + private $_width = null; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * height |
82 | 82 | * |
83 | 83 | * @var float |
84 | 84 | */ |
85 | - private $_height = null; |
|
85 | + private $_height = null; |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Create a new PHPExcel_Chart_Layout |
90 | 90 | */ |
91 | - public function __construct($layout=array()) |
|
91 | + public function __construct($layout = array()) |
|
92 | 92 | { |
93 | - if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; } |
|
94 | - if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; } |
|
95 | - if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; } |
|
96 | - if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; } |
|
97 | - if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; } |
|
98 | - if (isset($layout['w'])) { $this->_width = (float) $layout['w']; } |
|
99 | - if (isset($layout['h'])) { $this->_height = (float) $layout['h']; } |
|
93 | + if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; } |
|
94 | + if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; } |
|
95 | + if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; } |
|
96 | + if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; } |
|
97 | + if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; } |
|
98 | + if (isset($layout['w'])) { $this->_width = (float) $layout['w']; } |
|
99 | + if (isset($layout['h'])) { $this->_height = (float) $layout['h']; } |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |