@@ -126,7 +126,7 @@ |
||
126 | 126 | /** |
127 | 127 | * Return the current cache storage class |
128 | 128 | * |
129 | - * @return \CachedObjectStorage\ICache|null |
|
129 | + * @return string |
|
130 | 130 | **/ |
131 | 131 | public static function getCacheStorageClass() |
132 | 132 | { |
@@ -171,7 +171,7 @@ |
||
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
174 | - $cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\'.$method; |
|
174 | + $cacheStorageClass = '\\PhpSpreadsheet\\CachedObjectStorage\\' . $method; |
|
175 | 175 | if (!call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) { |
176 | 176 | return false; |
177 | 177 | } |
@@ -2110,7 +2110,6 @@ discard block |
||
2110 | 2110 | * Unset an instance of this class |
2111 | 2111 | * |
2112 | 2112 | * @access public |
2113 | - * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset |
|
2114 | 2113 | */ |
2115 | 2114 | public function __destruct() |
2116 | 2115 | { |
@@ -2401,6 +2400,10 @@ discard block |
||
2401 | 2400 | return $formula; |
2402 | 2401 | } |
2403 | 2402 | |
2403 | + /** |
|
2404 | + * @param string $fromSeparator |
|
2405 | + * @param string $toSeparator |
|
2406 | + */ |
|
2404 | 2407 | private static function translateFormula($from, $to, $formula, $fromSeparator, $toSeparator) |
2405 | 2408 | { |
2406 | 2409 | // Convert any Excel function names to the required language |
@@ -2718,6 +2721,9 @@ discard block |
||
2718 | 2721 | } |
2719 | 2722 | |
2720 | 2723 | |
2724 | + /** |
|
2725 | + * @param string $cellReference |
|
2726 | + */ |
|
2721 | 2727 | public function getValueFromCache($cellReference, &$cellValue) |
2722 | 2728 | { |
2723 | 2729 | // Is calculation cacheing enabled? |
@@ -2732,6 +2738,9 @@ discard block |
||
2732 | 2738 | return false; |
2733 | 2739 | } |
2734 | 2740 | |
2741 | + /** |
|
2742 | + * @param string $cellReference |
|
2743 | + */ |
|
2735 | 2744 | public function saveValueToCache($cellReference, $cellValue) |
2736 | 2745 | { |
2737 | 2746 | if ($this->calculationCacheEnabled) { |
@@ -2851,7 +2860,7 @@ discard block |
||
2851 | 2860 | * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0 |
2852 | 2861 | * |
2853 | 2862 | * @param mixed &$matrix matrix operand |
2854 | - * @return array An array comprising the number of rows, and number of columns |
|
2863 | + * @return integer[] An array comprising the number of rows, and number of columns |
|
2855 | 2864 | */ |
2856 | 2865 | private static function getMatrixDimensions(&$matrix) |
2857 | 2866 | { |
@@ -3002,7 +3011,7 @@ discard block |
||
3002 | 3011 | * Format type and details of an operand for display in the log (based on operand type) |
3003 | 3012 | * |
3004 | 3013 | * @param mixed $value First matrix operand |
3005 | - * @return mixed |
|
3014 | + * @return string|null |
|
3006 | 3015 | */ |
3007 | 3016 | private function showTypeDetails($value) |
3008 | 3017 | { |
@@ -3036,6 +3045,9 @@ discard block |
||
3036 | 3045 | } |
3037 | 3046 | |
3038 | 3047 | |
3048 | + /** |
|
3049 | + * @param string $formula |
|
3050 | + */ |
|
3039 | 3051 | private function convertMatrixReferences($formula) |
3040 | 3052 | { |
3041 | 3053 | static $matrixReplaceFrom = array('{', ';', '}'); |
@@ -3126,6 +3138,10 @@ discard block |
||
3126 | 3138 | ); |
3127 | 3139 | |
3128 | 3140 | // Convert infix to postfix notation |
3141 | + |
|
3142 | + /** |
|
3143 | + * @param string $formula |
|
3144 | + */ |
|
3129 | 3145 | private function _parseFormula($formula, Cell $pCell = null) |
3130 | 3146 | { |
3131 | 3147 | if (($formula = $this->convertMatrixReferences(trim($formula))) === false) { |
@@ -3493,6 +3509,10 @@ discard block |
||
3493 | 3509 | } |
3494 | 3510 | |
3495 | 3511 | // evaluate postfix notation |
3512 | + |
|
3513 | + /** |
|
3514 | + * @param string $cellID |
|
3515 | + */ |
|
3496 | 3516 | private function processTokenStack($tokens, $cellID = null, Cell $pCell = null) |
3497 | 3517 | { |
3498 | 3518 | if ($tokens == false) { |
@@ -4077,6 +4097,9 @@ discard block |
||
4077 | 4097 | return strcmp($inversedStr1, $inversedStr2); |
4078 | 4098 | } |
4079 | 4099 | |
4100 | + /** |
|
4101 | + * @param string $matrixFunction |
|
4102 | + */ |
|
4080 | 4103 | private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack) |
4081 | 4104 | { |
4082 | 4105 | // Validate the two operands |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | 'NULL' => null |
262 | 262 | ); |
263 | 263 | |
264 | - // PhpSpreadsheet functions |
|
264 | + // PhpSpreadsheet functions |
|
265 | 265 | private static $phpSpreadsheetFunctions = array( |
266 | 266 | 'ABS' => array( |
267 | 267 | 'category' => Calculation\Categories::CATEGORY_MATH_AND_TRIG, |
@@ -3136,13 +3136,13 @@ discard block |
||
3136 | 3136 | $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; |
3137 | 3137 | |
3138 | 3138 | $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. |
3139 | - '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3140 | - '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3141 | - '|'.self::CALCULATION_REGEXP_STRING. |
|
3142 | - '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3143 | - '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3144 | - '|'.self::CALCULATION_REGEXP_ERROR. |
|
3145 | - ')/si'; |
|
3139 | + '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3140 | + '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3141 | + '|'.self::CALCULATION_REGEXP_STRING. |
|
3142 | + '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3143 | + '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3144 | + '|'.self::CALCULATION_REGEXP_ERROR. |
|
3145 | + ')/si'; |
|
3146 | 3146 | |
3147 | 3147 | // Start with initialisation |
3148 | 3148 | $index = 0; |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | // String operand |
51 | 51 | const CALCULATION_REGEXP_STRING = '"(?:[^"]|"")*"'; |
52 | 52 | // Opening bracket |
53 | - const CALCULATION_REGEXP_OPENBRACE = '\('; |
|
53 | + const CALCULATION_REGEXP_OPENBRACE = '\('; |
|
54 | 54 | // Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it) |
55 | - const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\('; |
|
55 | + const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\('; |
|
56 | 56 | // Cell reference (cell or range of cells, with or without a sheet reference) |
57 | - const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF; |
|
57 | + const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF; |
|
58 | 58 | // Named Range of cells |
59 | - const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE; |
|
59 | + const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE; |
|
60 | 60 | // Error |
61 | - const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; |
|
61 | + const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; |
|
62 | 62 | |
63 | 63 | |
64 | 64 | /** constants */ |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @access private |
101 | 101 | * @var array |
102 | 102 | */ |
103 | - private $calculationCache = array (); |
|
103 | + private $calculationCache = array(); |
|
104 | 104 | |
105 | 105 | |
106 | 106 | /** |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * @var array |
121 | 121 | */ |
122 | 122 | private static $operators = array( |
123 | - '+' => true, '-' => true, '*' => true, '/' => true, |
|
124 | - '^' => true, '&' => true, '%' => false, '~' => false, |
|
125 | - '>' => true, '<' => true, '=' => true, '>=' => true, |
|
126 | - '<=' => true, '<>' => true, '|' => true, ':' => true |
|
123 | + '+' => true, '-' => true, '*' => true, '/' => true, |
|
124 | + '^' => true, '&' => true, '%' => false, '~' => false, |
|
125 | + '>' => true, '<' => true, '=' => true, '>=' => true, |
|
126 | + '<=' => true, '<>' => true, '|' => true, ':' => true |
|
127 | 127 | ); |
128 | 128 | |
129 | 129 | /** |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | * @var array |
134 | 134 | */ |
135 | 135 | private static $binaryOperators = array( |
136 | - '+' => true, '-' => true, '*' => true, '/' => true, |
|
137 | - '^' => true, '&' => true, '>' => true, '<' => true, |
|
138 | - '=' => true, '>=' => true, '<=' => true, '<>' => true, |
|
139 | - '|' => true, ':' => true |
|
136 | + '+' => true, '-' => true, '*' => true, '/' => true, |
|
137 | + '^' => true, '&' => true, '>' => true, '<' => true, |
|
138 | + '=' => true, '>=' => true, '<=' => true, '<>' => true, |
|
139 | + '|' => true, ':' => true |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @var float |
206 | 206 | * |
207 | 207 | */ |
208 | - private $delta = 0.1e-12; |
|
208 | + private $delta = 0.1e-12; |
|
209 | 209 | |
210 | 210 | |
211 | 211 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @var string |
215 | 215 | * |
216 | 216 | */ |
217 | - private static $localeLanguage = 'en_us'; // US English (default locale) |
|
217 | + private static $localeLanguage = 'en_us'; // US English (default locale) |
|
218 | 218 | |
219 | 219 | /** |
220 | 220 | * List of available locale settings |
@@ -2072,9 +2072,9 @@ discard block |
||
2072 | 2072 | |
2073 | 2073 | private static function loadLocales() |
2074 | 2074 | { |
2075 | - $localeFileDirectory = PHPSPREADSHEET_ROOT.'PhpSpreadsheet/locale/'; |
|
2076 | - foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) { |
|
2077 | - $filename = substr($filename, strlen($localeFileDirectory)+1); |
|
2075 | + $localeFileDirectory = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet/locale/'; |
|
2076 | + foreach (glob($localeFileDirectory . '/*', GLOB_ONLYDIR) as $filename) { |
|
2077 | + $filename = substr($filename, strlen($localeFileDirectory) + 1); |
|
2078 | 2078 | if ($filename != 'en') { |
2079 | 2079 | self::$validLocaleLanguages[] = $filename; |
2080 | 2080 | } |
@@ -2319,10 +2319,10 @@ discard block |
||
2319 | 2319 | // Default is English, if user isn't requesting english, then read the necessary data from the locale files |
2320 | 2320 | if ($locale != 'en_us') { |
2321 | 2321 | // Search for a file with a list of function names for locale |
2322 | - $functionNamesFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions'; |
|
2322 | + $functionNamesFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions'; |
|
2323 | 2323 | if (!file_exists($functionNamesFile)) { |
2324 | 2324 | // If there isn't a locale specific function file, look for a language specific function file |
2325 | - $functionNamesFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions'; |
|
2325 | + $functionNamesFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . 'functions'; |
|
2326 | 2326 | if (!file_exists($functionNamesFile)) { |
2327 | 2327 | return false; |
2328 | 2328 | } |
@@ -2330,7 +2330,7 @@ discard block |
||
2330 | 2330 | // Retrieve the list of locale or language specific function names |
2331 | 2331 | $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
2332 | 2332 | foreach ($localeFunctions as $localeFunction) { |
2333 | - list($localeFunction) = explode('##', $localeFunction); // Strip out comments |
|
2333 | + list($localeFunction) = explode('##', $localeFunction); // Strip out comments |
|
2334 | 2334 | if (strpos($localeFunction, '=') !== false) { |
2335 | 2335 | list($fName, $lfName) = explode('=', $localeFunction); |
2336 | 2336 | $fName = trim($fName); |
@@ -2348,14 +2348,14 @@ discard block |
||
2348 | 2348 | self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE']; |
2349 | 2349 | } |
2350 | 2350 | |
2351 | - $configFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config'; |
|
2351 | + $configFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config'; |
|
2352 | 2352 | if (!file_exists($configFile)) { |
2353 | - $configFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config'; |
|
2353 | + $configFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . 'config'; |
|
2354 | 2354 | } |
2355 | 2355 | if (file_exists($configFile)) { |
2356 | 2356 | $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
2357 | 2357 | foreach ($localeSettings as $localeSetting) { |
2358 | - list($localeSetting) = explode('##', $localeSetting); // Strip out comments |
|
2358 | + list($localeSetting) = explode('##', $localeSetting); // Strip out comments |
|
2359 | 2359 | if (strpos($localeSetting, '=') !== false) { |
2360 | 2360 | list($settingName, $settingValue) = explode('=', $localeSetting); |
2361 | 2361 | $settingName = strtoupper(trim($settingName)); |
@@ -2393,7 +2393,7 @@ discard block |
||
2393 | 2393 | break; |
2394 | 2394 | case $fromSeparator: |
2395 | 2395 | if (!$inBraces) { |
2396 | - $formula = mb_substr($formula, 0, $i).$toSeparator.mb_substr($formula, $i+1); |
|
2396 | + $formula = mb_substr($formula, 0, $i) . $toSeparator . mb_substr($formula, $i + 1); |
|
2397 | 2397 | } |
2398 | 2398 | } |
2399 | 2399 | } |
@@ -2439,20 +2439,20 @@ discard block |
||
2439 | 2439 | if (self::$functionReplaceFromExcel === null) { |
2440 | 2440 | self::$functionReplaceFromExcel = array(); |
2441 | 2441 | foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { |
2442 | - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui'; |
|
2442 | + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName) . '([\s]*\()/Ui'; |
|
2443 | 2443 | } |
2444 | 2444 | foreach (array_keys(self::$localeBoolean) as $excelBoolean) { |
2445 | - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; |
|
2445 | + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean) . '([^\w\.])/Ui'; |
|
2446 | 2446 | } |
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | if (self::$functionReplaceToLocale === null) { |
2450 | 2450 | self::$functionReplaceToLocale = array(); |
2451 | 2451 | foreach (array_values(self::$localeFunctions) as $localeFunctionName) { |
2452 | - self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2'; |
|
2452 | + self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2'; |
|
2453 | 2453 | } |
2454 | 2454 | foreach (array_values(self::$localeBoolean) as $localeBoolean) { |
2455 | - self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2'; |
|
2455 | + self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2'; |
|
2456 | 2456 | } |
2457 | 2457 | } |
2458 | 2458 | |
@@ -2468,20 +2468,20 @@ discard block |
||
2468 | 2468 | if (self::$functionReplaceFromLocale === null) { |
2469 | 2469 | self::$functionReplaceFromLocale = array(); |
2470 | 2470 | foreach (array_values(self::$localeFunctions) as $localeFunctionName) { |
2471 | - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui'; |
|
2471 | + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName) . '([\s]*\()/Ui'; |
|
2472 | 2472 | } |
2473 | 2473 | foreach (array_values(self::$localeBoolean) as $excelBoolean) { |
2474 | - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; |
|
2474 | + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean) . '([^\w\.])/Ui'; |
|
2475 | 2475 | } |
2476 | 2476 | } |
2477 | 2477 | |
2478 | 2478 | if (self::$functionReplaceToExcel === null) { |
2479 | 2479 | self::$functionReplaceToExcel = array(); |
2480 | 2480 | foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { |
2481 | - self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2'; |
|
2481 | + self::$functionReplaceToExcel[] = '$1' . trim($excelFunctionName) . '$2'; |
|
2482 | 2482 | } |
2483 | 2483 | foreach (array_keys(self::$localeBoolean) as $excelBoolean) { |
2484 | - self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2'; |
|
2484 | + self::$functionReplaceToExcel[] = '$1' . trim($excelBoolean) . '$2'; |
|
2485 | 2485 | } |
2486 | 2486 | } |
2487 | 2487 | |
@@ -2517,12 +2517,12 @@ discard block |
||
2517 | 2517 | { |
2518 | 2518 | if (is_string($value)) { |
2519 | 2519 | // Error values cannot be "wrapped" |
2520 | - if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i', $value, $match)) { |
|
2520 | + if (preg_match('/^' . self::CALCULATION_REGEXP_ERROR . '$/i', $value, $match)) { |
|
2521 | 2521 | // Return Excel errors "as is" |
2522 | 2522 | return $value; |
2523 | 2523 | } |
2524 | 2524 | // Return strings wrapped in quotes |
2525 | - return '"'.$value.'"'; |
|
2525 | + return '"' . $value . '"'; |
|
2526 | 2526 | // Convert numeric errors to NaN error |
2527 | 2527 | } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { |
2528 | 2528 | return Calculation\Functions::NAN(); |
@@ -2842,7 +2842,7 @@ discard block |
||
2842 | 2842 | // Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller |
2843 | 2843 | self::resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); |
2844 | 2844 | } |
2845 | - return array( $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); |
|
2845 | + return array($matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); |
|
2846 | 2846 | } |
2847 | 2847 | |
2848 | 2848 | |
@@ -2928,14 +2928,14 @@ discard block |
||
2928 | 2928 | if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { |
2929 | 2929 | if ($matrix2Columns < $matrix1Columns) { |
2930 | 2930 | for ($i = 0; $i < $matrix2Rows; ++$i) { |
2931 | - $x = $matrix2[$i][$matrix2Columns-1]; |
|
2931 | + $x = $matrix2[$i][$matrix2Columns - 1]; |
|
2932 | 2932 | for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { |
2933 | 2933 | $matrix2[$i][$j] = $x; |
2934 | 2934 | } |
2935 | 2935 | } |
2936 | 2936 | } |
2937 | 2937 | if ($matrix2Rows < $matrix1Rows) { |
2938 | - $x = $matrix2[$matrix2Rows-1]; |
|
2938 | + $x = $matrix2[$matrix2Rows - 1]; |
|
2939 | 2939 | for ($i = 0; $i < $matrix1Rows; ++$i) { |
2940 | 2940 | $matrix2[$i] = $x; |
2941 | 2941 | } |
@@ -2945,14 +2945,14 @@ discard block |
||
2945 | 2945 | if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { |
2946 | 2946 | if ($matrix1Columns < $matrix2Columns) { |
2947 | 2947 | for ($i = 0; $i < $matrix1Rows; ++$i) { |
2948 | - $x = $matrix1[$i][$matrix1Columns-1]; |
|
2948 | + $x = $matrix1[$i][$matrix1Columns - 1]; |
|
2949 | 2949 | for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { |
2950 | 2950 | $matrix1[$i][$j] = $x; |
2951 | 2951 | } |
2952 | 2952 | } |
2953 | 2953 | } |
2954 | 2954 | if ($matrix1Rows < $matrix2Rows) { |
2955 | - $x = $matrix1[$matrix1Rows-1]; |
|
2955 | + $x = $matrix1[$matrix1Rows - 1]; |
|
2956 | 2956 | for ($i = 0; $i < $matrix2Rows; ++$i) { |
2957 | 2957 | $matrix1[$i] = $x; |
2958 | 2958 | } |
@@ -2986,9 +2986,9 @@ discard block |
||
2986 | 2986 | $returnMatrix[] = $this->showValue($row); |
2987 | 2987 | } |
2988 | 2988 | } |
2989 | - return '{ '.implode($rpad, $returnMatrix).' }'; |
|
2989 | + return '{ ' . implode($rpad, $returnMatrix) . ' }'; |
|
2990 | 2990 | } elseif (is_string($value) && (trim($value, '"') == $value)) { |
2991 | - return '"'.$value.'"'; |
|
2991 | + return '"' . $value . '"'; |
|
2992 | 2992 | } elseif (is_bool($value)) { |
2993 | 2993 | return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; |
2994 | 2994 | } |
@@ -3025,12 +3025,12 @@ discard block |
||
3025 | 3025 | if ($value == '') { |
3026 | 3026 | return 'an empty string'; |
3027 | 3027 | } elseif ($value{0} == '#') { |
3028 | - return 'a '.$value.' error'; |
|
3028 | + return 'a ' . $value . ' error'; |
|
3029 | 3029 | } else { |
3030 | 3030 | $typeString = 'a string'; |
3031 | 3031 | } |
3032 | 3032 | } |
3033 | - return $typeString.' with a value of '.$this->showValue($value); |
|
3033 | + return $typeString . ' with a value of ' . $this->showValue($value); |
|
3034 | 3034 | } |
3035 | 3035 | } |
3036 | 3036 | |
@@ -3096,31 +3096,31 @@ discard block |
||
3096 | 3096 | // Binary Operators |
3097 | 3097 | // These operators always work on two values |
3098 | 3098 | // Array key is the operator, the value indicates whether this is a left or right associative operator |
3099 | - private static $operatorAssociativity = array( |
|
3100 | - '^' => 0, // Exponentiation |
|
3101 | - '*' => 0, '/' => 0, // Multiplication and Division |
|
3102 | - '+' => 0, '-' => 0, // Addition and Subtraction |
|
3103 | - '&' => 0, // Concatenation |
|
3104 | - '|' => 0, ':' => 0, // Intersect and Range |
|
3099 | + private static $operatorAssociativity = array( |
|
3100 | + '^' => 0, // Exponentiation |
|
3101 | + '*' => 0, '/' => 0, // Multiplication and Division |
|
3102 | + '+' => 0, '-' => 0, // Addition and Subtraction |
|
3103 | + '&' => 0, // Concatenation |
|
3104 | + '|' => 0, ':' => 0, // Intersect and Range |
|
3105 | 3105 | '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison |
3106 | 3106 | ); |
3107 | 3107 | |
3108 | 3108 | // Comparison (Boolean) Operators |
3109 | 3109 | // These operators work on two values, but always return a boolean result |
3110 | - private static $comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true); |
|
3110 | + private static $comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true); |
|
3111 | 3111 | |
3112 | 3112 | // Operator Precedence |
3113 | 3113 | // This list includes all valid operators, whether binary (including boolean) or unary (such as %) |
3114 | 3114 | // Array key is the operator, the value is its precedence |
3115 | - private static $operatorPrecedence = array( |
|
3116 | - ':' => 8, // Range |
|
3117 | - '|' => 7, // Intersect |
|
3118 | - '~' => 6, // Negation |
|
3119 | - '%' => 5, // Percentage |
|
3120 | - '^' => 4, // Exponentiation |
|
3121 | - '*' => 3, '/' => 3, // Multiplication and Division |
|
3122 | - '+' => 2, '-' => 2, // Addition and Subtraction |
|
3123 | - '&' => 1, // Concatenation |
|
3115 | + private static $operatorPrecedence = array( |
|
3116 | + ':' => 8, // Range |
|
3117 | + '|' => 7, // Intersect |
|
3118 | + '~' => 6, // Negation |
|
3119 | + '%' => 5, // Percentage |
|
3120 | + '^' => 4, // Exponentiation |
|
3121 | + '*' => 3, '/' => 3, // Multiplication and Division |
|
3122 | + '+' => 2, '-' => 2, // Addition and Subtraction |
|
3123 | + '&' => 1, // Concatenation |
|
3124 | 3124 | '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison |
3125 | 3125 | ); |
3126 | 3126 | |
@@ -3135,22 +3135,22 @@ discard block |
||
3135 | 3135 | // so we store the parent worksheet so that we can re-attach it when necessary |
3136 | 3136 | $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; |
3137 | 3137 | |
3138 | - $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. |
|
3139 | - '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3140 | - '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3141 | - '|'.self::CALCULATION_REGEXP_STRING. |
|
3142 | - '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3143 | - '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3144 | - '|'.self::CALCULATION_REGEXP_ERROR. |
|
3138 | + $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_FUNCTION . |
|
3139 | + '|' . self::CALCULATION_REGEXP_CELLREF . |
|
3140 | + '|' . self::CALCULATION_REGEXP_NUMBER . |
|
3141 | + '|' . self::CALCULATION_REGEXP_STRING . |
|
3142 | + '|' . self::CALCULATION_REGEXP_OPENBRACE . |
|
3143 | + '|' . self::CALCULATION_REGEXP_NAMEDRANGE . |
|
3144 | + '|' . self::CALCULATION_REGEXP_ERROR . |
|
3145 | 3145 | ')/si'; |
3146 | 3146 | |
3147 | 3147 | // Start with initialisation |
3148 | 3148 | $index = 0; |
3149 | 3149 | $stack = new Calculation\Token\Stack; |
3150 | 3150 | $output = array(); |
3151 | - $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a |
|
3151 | + $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a |
|
3152 | 3152 | // - is a negation or + is a positive operator rather than an operation |
3153 | - $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand |
|
3153 | + $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand |
|
3154 | 3154 | // should be null in a function call |
3155 | 3155 | // The guts of the lexical parser |
3156 | 3156 | // Loop through the formula extracting each operator and operand in turn |
@@ -3158,7 +3158,7 @@ discard block |
||
3158 | 3158 | //echo 'Assessing Expression '.substr($formula, $index), PHP_EOL; |
3159 | 3159 | $opCharacter = $formula{$index}; // Get the first character of the value at the current index position |
3160 | 3160 | //echo 'Initial character of expression block is '.$opCharacter, PHP_EOL; |
3161 | - if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) { |
|
3161 | + if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index + 1}]))) { |
|
3162 | 3162 | $opCharacter .= $formula{++$index}; |
3163 | 3163 | //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL; |
3164 | 3164 | } |
@@ -3170,26 +3170,26 @@ discard block |
||
3170 | 3170 | |
3171 | 3171 | if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus? |
3172 | 3172 | //echo 'Element is a Negation operator', PHP_EOL; |
3173 | - $stack->push('Unary Operator', '~'); // Put a negation on the stack |
|
3174 | - ++$index; // and drop the negation symbol |
|
3173 | + $stack->push('Unary Operator', '~'); // Put a negation on the stack |
|
3174 | + ++$index; // and drop the negation symbol |
|
3175 | 3175 | } elseif ($opCharacter == '%' && $expectingOperator) { |
3176 | 3176 | //echo 'Element is a Percentage operator', PHP_EOL; |
3177 | - $stack->push('Unary Operator', '%'); // Put a percentage on the stack |
|
3177 | + $stack->push('Unary Operator', '%'); // Put a percentage on the stack |
|
3178 | 3178 | ++$index; |
3179 | 3179 | } elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded? |
3180 | 3180 | //echo 'Element is a Positive number, not Plus operator', PHP_EOL; |
3181 | - ++$index; // Drop the redundant plus symbol |
|
3181 | + ++$index; // Drop the redundant plus symbol |
|
3182 | 3182 | } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal |
3183 | - return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression |
|
3183 | + return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression |
|
3184 | 3184 | } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? |
3185 | 3185 | //echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL; |
3186 | 3186 | while ($stack->count() > 0 && |
3187 | 3187 | ($o2 = $stack->last()) && |
3188 | 3188 | isset(self::$operators[$o2['value']]) && |
3189 | 3189 | @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { |
3190 | - $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3190 | + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3191 | 3191 | } |
3192 | - $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack |
|
3192 | + $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack |
|
3193 | 3193 | ++$index; |
3194 | 3194 | $expectingOperator = false; |
3195 | 3195 | } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
@@ -3203,11 +3203,11 @@ discard block |
||
3203 | 3203 | } |
3204 | 3204 | } |
3205 | 3205 | $d = $stack->last(2); |
3206 | - if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3207 | - $functionName = $matches[1]; // Get the function name |
|
3206 | + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3207 | + $functionName = $matches[1]; // Get the function name |
|
3208 | 3208 | //echo 'Closed Function is '.$functionName, PHP_EOL; |
3209 | 3209 | $d = $stack->pop(); |
3210 | - $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) |
|
3210 | + $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) |
|
3211 | 3211 | //if ($argumentCount == 0) { |
3212 | 3212 | // echo 'With no arguments', PHP_EOL; |
3213 | 3213 | //} elseif ($argumentCount == 1) { |
@@ -3215,8 +3215,8 @@ discard block |
||
3215 | 3215 | //} else { |
3216 | 3216 | // echo 'With '.$argumentCount.' arguments', PHP_EOL; |
3217 | 3217 | //} |
3218 | - $output[] = $d; // Dump the argument count on the output |
|
3219 | - $output[] = $stack->pop(); // Pop the function and push onto the output |
|
3218 | + $output[] = $d; // Dump the argument count on the output |
|
3219 | + $output[] = $stack->pop(); // Pop the function and push onto the output |
|
3220 | 3220 | if (isset(self::$controlFunctions[$functionName])) { |
3221 | 3221 | //echo 'Built-in function '.$functionName, PHP_EOL; |
3222 | 3222 | $expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount']; |
@@ -3235,7 +3235,7 @@ discard block |
||
3235 | 3235 | //echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount), PHP_EOL; |
3236 | 3236 | if ($argumentCount > abs($expectedArgumentCount)) { |
3237 | 3237 | $argumentCountError = true; |
3238 | - $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount); |
|
3238 | + $expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount); |
|
3239 | 3239 | } |
3240 | 3240 | } else { |
3241 | 3241 | //echo '$expectedArgumentCount is numeric '.$expectedArgumentCount, PHP_EOL; |
@@ -3252,25 +3252,25 @@ discard block |
||
3252 | 3252 | case '+': |
3253 | 3253 | if ($argumentCount < $argMatch[1]) { |
3254 | 3254 | $argumentCountError = true; |
3255 | - $expectedArgumentCountString = $argMatch[1].' or more '; |
|
3255 | + $expectedArgumentCountString = $argMatch[1] . ' or more '; |
|
3256 | 3256 | } |
3257 | 3257 | break; |
3258 | 3258 | case '-': |
3259 | 3259 | if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { |
3260 | 3260 | $argumentCountError = true; |
3261 | - $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3]; |
|
3261 | + $expectedArgumentCountString = 'between ' . $argMatch[1] . ' and ' . $argMatch[3]; |
|
3262 | 3262 | } |
3263 | 3263 | break; |
3264 | 3264 | case ',': |
3265 | 3265 | if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { |
3266 | 3266 | $argumentCountError = true; |
3267 | - $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3]; |
|
3267 | + $expectedArgumentCountString = 'either ' . $argMatch[1] . ' or ' . $argMatch[3]; |
|
3268 | 3268 | } |
3269 | 3269 | break; |
3270 | 3270 | } |
3271 | 3271 | } |
3272 | 3272 | if ($argumentCountError) { |
3273 | - return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString." expected"); |
|
3273 | + return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, " . $expectedArgumentCountString . " expected"); |
|
3274 | 3274 | } |
3275 | 3275 | } |
3276 | 3276 | ++$index; |
@@ -3280,7 +3280,7 @@ discard block |
||
3280 | 3280 | if ($o2 === null) { |
3281 | 3281 | return $this->raiseFormulaError("Formula Error: Unexpected ,"); |
3282 | 3282 | } else { |
3283 | - $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3283 | + $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3284 | 3284 | } |
3285 | 3285 | } |
3286 | 3286 | // If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
@@ -3290,12 +3290,12 @@ discard block |
||
3290 | 3290 | } |
3291 | 3291 | // make sure there was a function |
3292 | 3292 | $d = $stack->last(2); |
3293 | - if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { |
|
3293 | + if (!preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { |
|
3294 | 3294 | return $this->raiseFormulaError("Formula Error: Unexpected ,"); |
3295 | 3295 | } |
3296 | 3296 | $d = $stack->pop(); |
3297 | - $stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count |
|
3298 | - $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again |
|
3297 | + $stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count |
|
3298 | + $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again |
|
3299 | 3299 | $expectingOperator = false; |
3300 | 3300 | $expectingOperand = true; |
3301 | 3301 | ++$index; |
@@ -3310,24 +3310,24 @@ discard block |
||
3310 | 3310 | $length = strlen($val); |
3311 | 3311 | // echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />'; |
3312 | 3312 | |
3313 | - if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) { |
|
3313 | + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $val, $matches)) { |
|
3314 | 3314 | $val = preg_replace('/\s/u', '', $val); |
3315 | 3315 | // echo 'Element '.$val.' is a Function<br />'; |
3316 | 3316 | if (isset(self::$phpSpreadsheetFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function |
3317 | 3317 | $stack->push('Function', strtoupper($val)); |
3318 | - $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch); |
|
3318 | + $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index + $length), $amatch); |
|
3319 | 3319 | if ($ax) { |
3320 | - $stack->push('Operand Count for Function '.strtoupper($val).')', 0); |
|
3320 | + $stack->push('Operand Count for Function ' . strtoupper($val) . ')', 0); |
|
3321 | 3321 | $expectingOperator = true; |
3322 | 3322 | } else { |
3323 | - $stack->push('Operand Count for Function '.strtoupper($val).')', 1); |
|
3323 | + $stack->push('Operand Count for Function ' . strtoupper($val) . ')', 1); |
|
3324 | 3324 | $expectingOperator = false; |
3325 | 3325 | } |
3326 | 3326 | $stack->push('Brace', '('); |
3327 | 3327 | } else { // it's a var w/ implicit multiplication |
3328 | 3328 | $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => null); |
3329 | 3329 | } |
3330 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) { |
|
3330 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $val, $matches)) { |
|
3331 | 3331 | // echo 'Element '.$val.' is a Cell reference<br />'; |
3332 | 3332 | // Watch for this case-change when modifying to allow cell references in different worksheets... |
3333 | 3333 | // Should only be applied to the actual cell column, not the worksheet name |
@@ -3339,10 +3339,10 @@ discard block |
||
3339 | 3339 | if ($matches[2] == '') { |
3340 | 3340 | // Otherwise, we 'inherit' the worksheet reference from the start cell reference |
3341 | 3341 | // The start of the cell range reference should be the last entry in $output |
3342 | - $startCellRef = $output[count($output)-1]['value']; |
|
3343 | - preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $startCellRef, $startMatches); |
|
3342 | + $startCellRef = $output[count($output) - 1]['value']; |
|
3343 | + preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $startCellRef, $startMatches); |
|
3344 | 3344 | if ($startMatches[2] > '') { |
3345 | - $val = $startMatches[2].'!'.$val; |
|
3345 | + $val = $startMatches[2] . '!' . $val; |
|
3346 | 3346 | } |
3347 | 3347 | } else { |
3348 | 3348 | return $this->raiseFormulaError("3D Range references are not yet supported"); |
@@ -3356,7 +3356,7 @@ discard block |
||
3356 | 3356 | // If the last entry on the stack was a : operator, then we may have a row or column range reference |
3357 | 3357 | $testPrevOp = $stack->last(1); |
3358 | 3358 | if ($testPrevOp['value'] == ':') { |
3359 | - $startRowColRef = $output[count($output)-1]['value']; |
|
3359 | + $startRowColRef = $output[count($output) - 1]['value']; |
|
3360 | 3360 | $rangeWS1 = ''; |
3361 | 3361 | if (strpos('!', $startRowColRef) !== false) { |
3362 | 3362 | list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef); |
@@ -3374,15 +3374,15 @@ discard block |
||
3374 | 3374 | if ((is_integer($startRowColRef)) && (ctype_digit($val)) && |
3375 | 3375 | ($startRowColRef <= 1048576) && ($val <= 1048576)) { |
3376 | 3376 | // Row range |
3377 | - $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 |
|
3378 | - $output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef; |
|
3379 | - $val = $rangeWS2.$endRowColRef.$val; |
|
3377 | + $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 |
|
3378 | + $output[count($output) - 1]['value'] = $rangeWS1 . 'A' . $startRowColRef; |
|
3379 | + $val = $rangeWS2 . $endRowColRef . $val; |
|
3380 | 3380 | } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) && |
3381 | 3381 | (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) { |
3382 | 3382 | // Column range |
3383 | - $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 |
|
3384 | - $output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1'; |
|
3385 | - $val = $rangeWS2.$val.$endRowColRef; |
|
3383 | + $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 |
|
3384 | + $output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1'; |
|
3385 | + $val = $rangeWS2 . $val . $endRowColRef; |
|
3386 | 3386 | } |
3387 | 3387 | } |
3388 | 3388 | |
@@ -3451,16 +3451,16 @@ discard block |
||
3451 | 3451 | // If we're expecting an operator, but only have a space between the previous and next operands (and both are |
3452 | 3452 | // Cell References) then we have an INTERSECTION operator |
3453 | 3453 | // echo 'Possible Intersect Operator<br />'; |
3454 | - if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) && |
|
3455 | - ($output[count($output)-1]['type'] == 'Cell Reference')) { |
|
3454 | + if (($expectingOperator) && (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) && |
|
3455 | + ($output[count($output) - 1]['type'] == 'Cell Reference')) { |
|
3456 | 3456 | // echo 'Element is an Intersect Operator<br />'; |
3457 | 3457 | while ($stack->count() > 0 && |
3458 | 3458 | ($o2 = $stack->last()) && |
3459 | 3459 | isset(self::$operators[$o2['value']]) && |
3460 | 3460 | @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { |
3461 | - $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3461 | + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3462 | 3462 | } |
3463 | - $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack |
|
3463 | + $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack |
|
3464 | 3464 | $expectingOperator = false; |
3465 | 3465 | } |
3466 | 3466 | } |
@@ -3468,7 +3468,7 @@ discard block |
||
3468 | 3468 | |
3469 | 3469 | while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output |
3470 | 3470 | if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { |
3471 | - return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3471 | + return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3472 | 3472 | } |
3473 | 3473 | $output[] = $op; |
3474 | 3474 | } |
@@ -3485,7 +3485,7 @@ discard block |
||
3485 | 3485 | $cKeys = array_keys(array_keys($operand[$rowKey])); |
3486 | 3486 | $colKey = array_shift($cKeys); |
3487 | 3487 | if (ctype_upper($colKey)) { |
3488 | - $operandData['reference'] = $colKey.$rowKey; |
|
3488 | + $operandData['reference'] = $colKey . $rowKey; |
|
3489 | 3489 | } |
3490 | 3490 | } |
3491 | 3491 | return $operand; |
@@ -3558,20 +3558,20 @@ discard block |
||
3558 | 3558 | if ($sheet1 == $sheet2) { |
3559 | 3559 | if ($operand1Data['reference'] === null) { |
3560 | 3560 | if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) { |
3561 | - $operand1Data['reference'] = $pCell->getColumn().$operand1Data['value']; |
|
3561 | + $operand1Data['reference'] = $pCell->getColumn() . $operand1Data['value']; |
|
3562 | 3562 | } elseif (trim($operand1Data['reference']) == '') { |
3563 | 3563 | $operand1Data['reference'] = $pCell->getCoordinate(); |
3564 | 3564 | } else { |
3565 | - $operand1Data['reference'] = $operand1Data['value'].$pCell->getRow(); |
|
3565 | + $operand1Data['reference'] = $operand1Data['value'] . $pCell->getRow(); |
|
3566 | 3566 | } |
3567 | 3567 | } |
3568 | 3568 | if ($operand2Data['reference'] === null) { |
3569 | 3569 | if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) { |
3570 | - $operand2Data['reference'] = $pCell->getColumn().$operand2Data['value']; |
|
3570 | + $operand2Data['reference'] = $pCell->getColumn() . $operand2Data['value']; |
|
3571 | 3571 | } elseif (trim($operand2Data['reference']) == '') { |
3572 | 3572 | $operand2Data['reference'] = $pCell->getCoordinate(); |
3573 | 3573 | } else { |
3574 | - $operand2Data['reference'] = $operand2Data['value'].$pCell->getRow(); |
|
3574 | + $operand2Data['reference'] = $operand2Data['value'] . $pCell->getRow(); |
|
3575 | 3575 | } |
3576 | 3576 | } |
3577 | 3577 | |
@@ -3582,7 +3582,7 @@ discard block |
||
3582 | 3582 | $oCol[] = Cell::columnIndexFromString($oCR[0]) - 1; |
3583 | 3583 | $oRow[] = $oCR[1]; |
3584 | 3584 | } |
3585 | - $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); |
|
3585 | + $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow); |
|
3586 | 3586 | if ($pCellParent !== null) { |
3587 | 3587 | $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($sheet1), false); |
3588 | 3588 | } else { |
@@ -3632,7 +3632,7 @@ discard block |
||
3632 | 3632 | $result = '#VALUE!'; |
3633 | 3633 | } |
3634 | 3634 | } else { |
3635 | - $result = '"'.str_replace('""', '"', self::unwrapResult($operand1, '"').self::unwrapResult($operand2, '"')).'"'; |
|
3635 | + $result = '"' . str_replace('""', '"', self::unwrapResult($operand1, '"') . self::unwrapResult($operand2, '"')) . '"'; |
|
3636 | 3636 | } |
3637 | 3637 | $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); |
3638 | 3638 | $stack->push('Value', $result); |
@@ -3647,7 +3647,7 @@ discard block |
||
3647 | 3647 | $cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]); |
3648 | 3648 | } |
3649 | 3649 | } |
3650 | - $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); |
|
3650 | + $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow); |
|
3651 | 3651 | $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect)); |
3652 | 3652 | $stack->push('Value', $cellIntersect, $cellRef); |
3653 | 3653 | break; |
@@ -3684,7 +3684,7 @@ discard block |
||
3684 | 3684 | } else { |
3685 | 3685 | $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack); |
3686 | 3686 | } |
3687 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { |
|
3687 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) { |
|
3688 | 3688 | $cellRef = null; |
3689 | 3689 | // echo 'Element '.$token.' is a Cell reference<br />'; |
3690 | 3690 | if (isset($matches[8])) { |
@@ -3693,7 +3693,7 @@ discard block |
||
3693 | 3693 | // We can't access the range, so return a REF error |
3694 | 3694 | $cellValue = Calculation\Functions::REF(); |
3695 | 3695 | } else { |
3696 | - $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; |
|
3696 | + $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; |
|
3697 | 3697 | if ($matches[2] > '') { |
3698 | 3698 | $matches[2] = trim($matches[2], "\"'"); |
3699 | 3699 | if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { |
@@ -3727,7 +3727,7 @@ discard block |
||
3727 | 3727 | // We can't access the cell, so return a REF error |
3728 | 3728 | $cellValue = Calculation\Functions::REF(); |
3729 | 3729 | } else { |
3730 | - $cellRef = $matches[6].$matches[7]; |
|
3730 | + $cellRef = $matches[6] . $matches[7]; |
|
3731 | 3731 | if ($matches[2] > '') { |
3732 | 3732 | $matches[2] = trim($matches[2], "\"'"); |
3733 | 3733 | if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { |
@@ -3765,7 +3765,7 @@ discard block |
||
3765 | 3765 | $stack->push('Value', $cellValue, $cellRef); |
3766 | 3766 | |
3767 | 3767 | // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on |
3768 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) { |
|
3768 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) { |
|
3769 | 3769 | // echo 'Token is a function<br />'; |
3770 | 3770 | $functionName = $matches[1]; |
3771 | 3771 | $argCount = $stack->pop(); |
@@ -3822,7 +3822,7 @@ discard block |
||
3822 | 3822 | if ($functionName != 'MKMATRIX') { |
3823 | 3823 | if ($this->_debugLog->getWriteDebugLog()) { |
3824 | 3824 | krsort($argArrayVals); |
3825 | - $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); |
|
3825 | + $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); |
|
3826 | 3826 | } |
3827 | 3827 | } |
3828 | 3828 | // Process each argument in turn, building the return value as an array |
@@ -3877,7 +3877,7 @@ discard block |
||
3877 | 3877 | // echo 'Token is a number, boolean, string, null or an Excel error<br />'; |
3878 | 3878 | $stack->push('Value', $token); |
3879 | 3879 | // if the token is a named range, push the named range name onto the stack |
3880 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) { |
|
3880 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) { |
|
3881 | 3881 | // echo 'Token is a named range<br />'; |
3882 | 3882 | $namedRange = $matches[6]; |
3883 | 3883 | // echo 'Named Range is '.$namedRange.'<br />'; |
@@ -4105,8 +4105,8 @@ discard block |
||
4105 | 4105 | } |
4106 | 4106 | } else { |
4107 | 4107 | if ((Calculation\Functions::getCompatibilityMode() != Calculation\Functions::COMPATIBILITY_OPENOFFICE) && |
4108 | - ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) || |
|
4109 | - (is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) { |
|
4108 | + ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) || |
|
4109 | + (is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0))) { |
|
4110 | 4110 | $result = Calculation\Functions::VALUE(); |
4111 | 4111 | } else { |
4112 | 4112 | // If we're dealing with non-matrix operations, execute the necessary operation |
@@ -4174,7 +4174,7 @@ discard block |
||
4174 | 4174 | public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) |
4175 | 4175 | { |
4176 | 4176 | // Return value |
4177 | - $returnValue = array (); |
|
4177 | + $returnValue = array(); |
|
4178 | 4178 | |
4179 | 4179 | // echo 'extractCellRange('.$pRange.')', PHP_EOL; |
4180 | 4180 | if ($pSheet !== null) { |
@@ -4191,7 +4191,7 @@ discard block |
||
4191 | 4191 | |
4192 | 4192 | // Extract range |
4193 | 4193 | $aReferences = Cell::extractAllCellReferencesInRange($pRange); |
4194 | - $pRange = $pSheetName.'!'.$pRange; |
|
4194 | + $pRange = $pSheetName . '!' . $pRange; |
|
4195 | 4195 | if (!isset($aReferences[1])) { |
4196 | 4196 | // Single cell in range |
4197 | 4197 | sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow); |
@@ -4232,7 +4232,7 @@ discard block |
||
4232 | 4232 | public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) |
4233 | 4233 | { |
4234 | 4234 | // Return value |
4235 | - $returnValue = array (); |
|
4235 | + $returnValue = array(); |
|
4236 | 4236 | |
4237 | 4237 | // echo 'extractNamedRange('.$pRange.')<br />'; |
4238 | 4238 | if ($pSheet !== null) { |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @access public |
474 | 474 | * @category Date/Time Functions |
475 | - * @param string $dateValue Text that represents a date in a Microsoft Excel date format. |
|
475 | + * @param integer $dateValue Text that represents a date in a Microsoft Excel date format. |
|
476 | 476 | * For example, "1/30/2008" or "30-Jan-2008" are text strings within |
477 | 477 | * quotation marks that represent dates. Using the default date |
478 | 478 | * system in Excel for Windows, date_text must represent a date from |
@@ -657,9 +657,9 @@ discard block |
||
657 | 657 | /** |
658 | 658 | * DATEDIF |
659 | 659 | * |
660 | - * @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
660 | + * @param integer $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
661 | 661 | * or a standard date string |
662 | - * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
662 | + * @param integer $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
663 | 663 | * or a standard date string |
664 | 664 | * @param string $unit |
665 | 665 | * @return integer Interval between the dates |
@@ -771,9 +771,9 @@ discard block |
||
771 | 771 | * |
772 | 772 | * @access public |
773 | 773 | * @category Date/Time Functions |
774 | - * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
774 | + * @param integer $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
775 | 775 | * PHP DateTime object, or a standard date string |
776 | - * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
776 | + * @param integer $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
777 | 777 | * PHP DateTime object, or a standard date string |
778 | 778 | * @param boolean $method US or European Method |
779 | 779 | * FALSE or omitted: U.S. (NASD) method. If the starting date is |
@@ -832,9 +832,9 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @access public |
834 | 834 | * @category Date/Time Functions |
835 | - * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
835 | + * @param integer $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
836 | 836 | * PHP DateTime object, or a standard date string |
837 | - * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
837 | + * @param integer $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
838 | 838 | * PHP DateTime object, or a standard date string |
839 | 839 | * @param integer $method Method used for the calculation |
840 | 840 | * 0 or omitted US (NASD) 30/360 |
@@ -934,10 +934,6 @@ discard block |
||
934 | 934 | * PHP DateTime object, or a standard date string |
935 | 935 | * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), |
936 | 936 | * PHP DateTime object, or a standard date string |
937 | - * @param mixed $holidays,... Optional series of Excel date serial value (float), PHP date |
|
938 | - * timestamp (integer), PHP DateTime object, or a standard date |
|
939 | - * strings that will be excluded from the working calendar, such |
|
940 | - * as state and federal holidays and floating holidays. |
|
941 | 937 | * @return integer Interval between the dates |
942 | 938 | */ |
943 | 939 | public static function NETWORKDAYS($startDate, $endDate) |
@@ -1020,10 +1016,6 @@ discard block |
||
1020 | 1016 | * @param integer $endDays The number of nonweekend and nonholiday days before or after |
1021 | 1017 | * startDate. A positive value for days yields a future date; a |
1022 | 1018 | * negative value yields a past date. |
1023 | - * @param mixed $holidays,... Optional series of Excel date serial value (float), PHP date |
|
1024 | - * timestamp (integer), PHP DateTime object, or a standard date |
|
1025 | - * strings that will be excluded from the working calendar, such |
|
1026 | - * as state and federal holidays and floating holidays. |
|
1027 | 1019 | * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, |
1028 | 1020 | * depending on the value of the ReturnDateType flag |
1029 | 1021 | */ |
@@ -1128,7 +1120,7 @@ discard block |
||
1128 | 1120 | * Excel Function: |
1129 | 1121 | * DAY(dateValue) |
1130 | 1122 | * |
1131 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1123 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1132 | 1124 | * PHP DateTime object, or a standard date string |
1133 | 1125 | * @return int Day of the month |
1134 | 1126 | */ |
@@ -1162,7 +1154,7 @@ discard block |
||
1162 | 1154 | * Excel Function: |
1163 | 1155 | * WEEKDAY(dateValue[,style]) |
1164 | 1156 | * |
1165 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1157 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1166 | 1158 | * PHP DateTime object, or a standard date string |
1167 | 1159 | * @param int $style A number that determines the type of return value |
1168 | 1160 | * 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). |
@@ -1239,9 +1231,9 @@ discard block |
||
1239 | 1231 | * Excel Function: |
1240 | 1232 | * WEEKNUM(dateValue[,style]) |
1241 | 1233 | * |
1242 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1234 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1243 | 1235 | * PHP DateTime object, or a standard date string |
1244 | - * @param boolean $method Week begins on Sunday or Monday |
|
1236 | + * @param integer $method Week begins on Sunday or Monday |
|
1245 | 1237 | * 1 or omitted Week begins on Sunday. |
1246 | 1238 | * 2 Week begins on Monday. |
1247 | 1239 | * @return int Week Number |
@@ -1288,7 +1280,7 @@ discard block |
||
1288 | 1280 | * Excel Function: |
1289 | 1281 | * MONTH(dateValue) |
1290 | 1282 | * |
1291 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1283 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1292 | 1284 | * PHP DateTime object, or a standard date string |
1293 | 1285 | * @return int Month of the year |
1294 | 1286 | */ |
@@ -1321,7 +1313,7 @@ discard block |
||
1321 | 1313 | * Excel Function: |
1322 | 1314 | * YEAR(dateValue) |
1323 | 1315 | * |
1324 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1316 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1325 | 1317 | * PHP DateTime object, or a standard date string |
1326 | 1318 | * @return int Year |
1327 | 1319 | */ |
@@ -1353,7 +1345,7 @@ discard block |
||
1353 | 1345 | * Excel Function: |
1354 | 1346 | * HOUR(timeValue) |
1355 | 1347 | * |
1356 | - * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1348 | + * @param integer $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1357 | 1349 | * PHP DateTime object, or a standard time string |
1358 | 1350 | * @return int Hour |
1359 | 1351 | */ |
@@ -1394,7 +1386,7 @@ discard block |
||
1394 | 1386 | * Excel Function: |
1395 | 1387 | * MINUTE(timeValue) |
1396 | 1388 | * |
1397 | - * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1389 | + * @param integer $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1398 | 1390 | * PHP DateTime object, or a standard time string |
1399 | 1391 | * @return int Minute |
1400 | 1392 | */ |
@@ -1435,7 +1427,7 @@ discard block |
||
1435 | 1427 | * Excel Function: |
1436 | 1428 | * SECOND(timeValue) |
1437 | 1429 | * |
1438 | - * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1430 | + * @param integer $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1439 | 1431 | * PHP DateTime object, or a standard time string |
1440 | 1432 | * @return int Second |
1441 | 1433 | */ |
@@ -1478,7 +1470,7 @@ discard block |
||
1478 | 1470 | * Excel Function: |
1479 | 1471 | * EDATE(dateValue,adjustmentMonths) |
1480 | 1472 | * |
1481 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1473 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1482 | 1474 | * PHP DateTime object, or a standard date string |
1483 | 1475 | * @param int $adjustmentMonths The number of months before or after start_date. |
1484 | 1476 | * A positive value for months yields a future date; |
@@ -1524,7 +1516,7 @@ discard block |
||
1524 | 1516 | * Excel Function: |
1525 | 1517 | * EOMONTH(dateValue,adjustmentMonths) |
1526 | 1518 | * |
1527 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1519 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1528 | 1520 | * PHP DateTime object, or a standard date string |
1529 | 1521 | * @param int $adjustmentMonths The number of months before or after start_date. |
1530 | 1522 | * A positive value for months yields a future date; |
@@ -874,7 +874,7 @@ |
||
874 | 874 | $endDay = self::DAYOFMONTH($endDate); |
875 | 875 | if (($startMonth < 3) || |
876 | 876 | (($endMonth * 100 + $endDay) >= (2 * 100 + 29))) { |
877 | - $leapDays += 1; |
|
877 | + $leapDays += 1; |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | } else { |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | $adjustmentMonthsString = (string) $adjustmentMonths; |
128 | 128 | if ($adjustmentMonths > 0) { |
129 | - $adjustmentMonthsString = '+'.$adjustmentMonths; |
|
129 | + $adjustmentMonthsString = '+' . $adjustmentMonths; |
|
130 | 130 | } |
131 | 131 | if ($adjustmentMonths != 0) { |
132 | - $PHPDateObject->modify($adjustmentMonthsString.' months'); |
|
132 | + $PHPDateObject->modify($adjustmentMonthsString . ' months'); |
|
133 | 133 | } |
134 | 134 | $nMonth = (int) $PHPDateObject->format('m'); |
135 | 135 | $nYear = (int) $PHPDateObject->format('Y'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12); |
138 | 138 | if ($monthDiff != $adjustmentMonths) { |
139 | 139 | $adjustDays = (int) $PHPDateObject->format('d'); |
140 | - $adjustDaysString = '-'.$adjustDays.' days'; |
|
140 | + $adjustDaysString = '-' . $adjustDays . ' days'; |
|
141 | 141 | $PHPDateObject->modify($adjustDaysString); |
142 | 142 | } |
143 | 143 | return $PHPDateObject; |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | (!is_numeric($day))) { |
300 | 300 | return Functions::VALUE(); |
301 | 301 | } |
302 | - $year = (integer) $year; |
|
302 | + $year = (integer) $year; |
|
303 | 303 | $month = (integer) $month; |
304 | - $day = (integer) $day; |
|
304 | + $day = (integer) $day; |
|
305 | 305 | |
306 | 306 | $baseYear = \PhpSpreadsheet\Shared\Date::getExcelCalendar(); |
307 | 307 | // Validate parameters |
308 | - if ($year < ($baseYear-1900)) { |
|
308 | + if ($year < ($baseYear - 1900)) { |
|
309 | 309 | return Functions::NAN(); |
310 | 310 | } |
311 | - if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { |
|
311 | + if ((($baseYear - 1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { |
|
312 | 312 | return Functions::NAN(); |
313 | 313 | } |
314 | 314 | |
315 | - if (($year < $baseYear) && ($year >= ($baseYear-1900))) { |
|
315 | + if (($year < $baseYear) && ($year >= ($baseYear - 1900))) { |
|
316 | 316 | $year += 1900; |
317 | 317 | } |
318 | 318 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | } |
433 | 433 | return (float) \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); |
434 | 434 | case Functions::RETURNDATE_PHP_NUMERIC: |
435 | - return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 |
|
435 | + return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 |
|
436 | 436 | case Functions::RETURNDATE_PHP_OBJECT: |
437 | 437 | $dayAdjust = 0; |
438 | 438 | if ($hour < 0) { |
@@ -445,9 +445,9 @@ discard block |
||
445 | 445 | $dayAdjust = floor($hour / 24); |
446 | 446 | $hour = $hour % 24; |
447 | 447 | } |
448 | - $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second); |
|
448 | + $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second); |
|
449 | 449 | if ($dayAdjust != 0) { |
450 | - $phpDateObject->modify($dayAdjust.' days'); |
|
450 | + $phpDateObject->modify($dayAdjust . ' days'); |
|
451 | 451 | } |
452 | 452 | return $phpDateObject; |
453 | 453 | } |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | */ |
483 | 483 | public static function DATEVALUE($dateValue = 1) |
484 | 484 | { |
485 | - $dateValueOrig= $dateValue; |
|
485 | + $dateValueOrig = $dateValue; |
|
486 | 486 | $dateValue = trim(Functions::flattenSingleValue($dateValue), '"'); |
487 | 487 | // Strip any ordinals because they're allowed in Excel (English only) |
488 | 488 | $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue); |
489 | 489 | // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany) |
490 | - $dateValue = str_replace(array('/', '.', '-', ' '), array(' ', ' ', ' ', ' '), $dateValue); |
|
490 | + $dateValue = str_replace(array('/', '.', '-', ' '), array(' ', ' ', ' ', ' '), $dateValue); |
|
491 | 491 | |
492 | 492 | $yearFound = false; |
493 | 493 | $t1 = explode(' ', $dateValue); |
@@ -541,9 +541,9 @@ discard block |
||
541 | 541 | if ($testVal1 < 31 && $testVal2 < 12 && $testVal3 < 12 && strlen($testVal3) == 2) { |
542 | 542 | $testVal3 += 2000; |
543 | 543 | } |
544 | - $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3); |
|
544 | + $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3); |
|
545 | 545 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
546 | - $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3); |
|
546 | + $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3); |
|
547 | 547 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
548 | 548 | return Functions::VALUE(); |
549 | 549 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | case Functions::RETURNDATE_PHP_NUMERIC: |
584 | 584 | return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue); |
585 | 585 | case Functions::RETURNDATE_PHP_OBJECT: |
586 | - return new \DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); |
|
586 | + return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | return Functions::VALUE(); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | $timeValue = str_replace(array('/', '.'), array('-', '-'), $timeValue); |
619 | 619 | |
620 | 620 | $arraySplit = preg_split('/[\/:\-\s]/', $timeValue); |
621 | - if ((count($arraySplit) == 2 ||count($arraySplit) == 3) && $arraySplit[0] > 24) { |
|
621 | + if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) { |
|
622 | 622 | $arraySplit[0] = ($arraySplit[0] % 24); |
623 | 623 | $timeValue = implode(':', $arraySplit); |
624 | 624 | } |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | case Functions::RETURNDATE_EXCEL: |
643 | 643 | return (float) $excelDateValue; |
644 | 644 | case Functions::RETURNDATE_PHP_NUMERIC: |
645 | - return (integer) $phpDateValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue+25569) - 3600; |
|
645 | + return (integer) $phpDateValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600; |
|
646 | 646 | case Functions::RETURNDATE_PHP_OBJECT: |
647 | - return new \DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); |
|
647 | + return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | return Functions::VALUE(); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | case 'MD': |
720 | 720 | if ($endDays < $startDays) { |
721 | 721 | $retVal = $endDays; |
722 | - $PHPEndDateObject->modify('-'.$endDays.' days'); |
|
722 | + $PHPEndDateObject->modify('-' . $endDays . ' days'); |
|
723 | 723 | $adjustDays = $PHPEndDateObject->format('j'); |
724 | 724 | $retVal += ($adjustDays - $startDays); |
725 | 725 | } else { |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | */ |
788 | 788 | public static function DAYS360($startDate = 0, $endDate = 0, $method = false) |
789 | 789 | { |
790 | - $startDate = Functions::flattenSingleValue($startDate); |
|
791 | - $endDate = Functions::flattenSingleValue($endDate); |
|
790 | + $startDate = Functions::flattenSingleValue($startDate); |
|
791 | + $endDate = Functions::flattenSingleValue($endDate); |
|
792 | 792 | |
793 | 793 | if (is_string($startDate = self::getDateValue($startDate))) { |
794 | 794 | return Functions::VALUE(); |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | */ |
844 | 844 | public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) |
845 | 845 | { |
846 | - $startDate = Functions::flattenSingleValue($startDate); |
|
847 | - $endDate = Functions::flattenSingleValue($endDate); |
|
848 | - $method = Functions::flattenSingleValue($method); |
|
846 | + $startDate = Functions::flattenSingleValue($startDate); |
|
847 | + $endDate = Functions::flattenSingleValue($endDate); |
|
848 | + $method = Functions::flattenSingleValue($method); |
|
849 | 849 | |
850 | 850 | if (is_string($startDate = self::getDateValue($startDate))) { |
851 | 851 | return Functions::VALUE(); |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | public static function NETWORKDAYS($startDate, $endDate) |
941 | 941 | { |
942 | 942 | // Retrieve the mandatory start and end date that are referenced in the function definition |
943 | - $startDate = Functions::flattenSingleValue($startDate); |
|
944 | - $endDate = Functions::flattenSingleValue($endDate); |
|
943 | + $startDate = Functions::flattenSingleValue($startDate); |
|
944 | + $endDate = Functions::flattenSingleValue($endDate); |
|
945 | 945 | // Flush the mandatory start and end date that are referenced in the function definition, and get the optional days |
946 | 946 | $dateArgs = Functions::flattenArray(func_get_args()); |
947 | 947 | array_shift($dateArgs); |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | public static function WORKDAY($startDate, $endDays) |
1028 | 1028 | { |
1029 | 1029 | // Retrieve the mandatory start date and days that are referenced in the function definition |
1030 | - $startDate = Functions::flattenSingleValue($startDate); |
|
1031 | - $endDays = Functions::flattenSingleValue($endDays); |
|
1030 | + $startDate = Functions::flattenSingleValue($startDate); |
|
1031 | + $endDays = Functions::flattenSingleValue($endDays); |
|
1032 | 1032 | // Flush the mandatory start date and days that are referenced in the function definition, and get the optional days |
1033 | 1033 | $dateArgs = Functions::flattenArray(func_get_args()); |
1034 | 1034 | array_shift($dateArgs); |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | $startDoW = self::DAYOFWEEK($startDate, 3); |
1052 | 1052 | if (self::DAYOFWEEK($startDate, 3) >= 5) { |
1053 | - $startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW; |
|
1053 | + $startDate += ($decrementing) ? -$startDoW + 4 : 7 - $startDoW; |
|
1054 | 1054 | ($decrementing) ? $endDays++ : $endDays--; |
1055 | 1055 | } |
1056 | 1056 | |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | // Adjust the calculated end date if it falls over a weekend |
1061 | 1061 | $endDoW = self::DAYOFWEEK($endDate, 3); |
1062 | 1062 | if ($endDoW >= 5) { |
1063 | - $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW; |
|
1063 | + $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | // Test any extra holiday parameters |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | */ |
1132 | 1132 | public static function DAYOFMONTH($dateValue = 1) |
1133 | 1133 | { |
1134 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1134 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1135 | 1135 | |
1136 | 1136 | if ($dateValue === null) { |
1137 | 1137 | $dateValue = 1; |
@@ -1245,8 +1245,8 @@ discard block |
||
1245 | 1245 | */ |
1246 | 1246 | public static function WEEKOFYEAR($dateValue = 1, $method = 1) |
1247 | 1247 | { |
1248 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1249 | - $method = Functions::flattenSingleValue($method); |
|
1248 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1249 | + $method = Functions::flattenSingleValue($method); |
|
1250 | 1250 | |
1251 | 1251 | if (!is_numeric($method)) { |
1252 | 1252 | return Functions::VALUE(); |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | */ |
1292 | 1292 | public static function MONTHOFYEAR($dateValue = 1) |
1293 | 1293 | { |
1294 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1294 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1295 | 1295 | |
1296 | 1296 | if (empty($dateValue)) { |
1297 | 1297 | $dateValue = 1; |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | */ |
1325 | 1325 | public static function YEAR($dateValue = 1) |
1326 | 1326 | { |
1327 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1327 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1328 | 1328 | |
1329 | 1329 | if ($dateValue === null) { |
1330 | 1330 | $dateValue = 1; |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | */ |
1357 | 1357 | public static function HOUROFDAY($timeValue = 0) |
1358 | 1358 | { |
1359 | - $timeValue = Functions::flattenSingleValue($timeValue); |
|
1359 | + $timeValue = Functions::flattenSingleValue($timeValue); |
|
1360 | 1360 | |
1361 | 1361 | if (!is_numeric($timeValue)) { |
1362 | 1362 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | */ |
1398 | 1398 | public static function MINUTEOFHOUR($timeValue = 0) |
1399 | 1399 | { |
1400 | - $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); |
|
1400 | + $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); |
|
1401 | 1401 | |
1402 | 1402 | if (!is_numeric($timeValue)) { |
1403 | 1403 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | */ |
1439 | 1439 | public static function SECONDOFMINUTE($timeValue = 0) |
1440 | 1440 | { |
1441 | - $timeValue = Functions::flattenSingleValue($timeValue); |
|
1441 | + $timeValue = Functions::flattenSingleValue($timeValue); |
|
1442 | 1442 | |
1443 | 1443 | if (!is_numeric($timeValue)) { |
1444 | 1444 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
@@ -1485,8 +1485,8 @@ discard block |
||
1485 | 1485 | */ |
1486 | 1486 | public static function EDATE($dateValue = 1, $adjustmentMonths = 0) |
1487 | 1487 | { |
1488 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1489 | - $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1488 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1489 | + $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1490 | 1490 | |
1491 | 1491 | if (!is_numeric($adjustmentMonths)) { |
1492 | 1492 | return Functions::VALUE(); |
@@ -1531,8 +1531,8 @@ discard block |
||
1531 | 1531 | */ |
1532 | 1532 | public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) |
1533 | 1533 | { |
1534 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1535 | - $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1534 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1535 | + $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1536 | 1536 | |
1537 | 1537 | if (!is_numeric($adjustmentMonths)) { |
1538 | 1538 | return Functions::VALUE(); |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | } |
1545 | 1545 | |
1546 | 1546 | // Execute function |
1547 | - $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths+1); |
|
1547 | + $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths + 1); |
|
1548 | 1548 | $adjustDays = (int) $PHPDateObject->format('d'); |
1549 | 1549 | $adjustDaysString = '-' . $adjustDays . ' days'; |
1550 | 1550 | $PHPDateObject->modify($adjustDaysString); |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | * @access public |
1827 | 1827 | * @category Engineering Functions |
1828 | 1828 | * @param string $complexNumber The complex number for which you want the real coefficient. |
1829 | - * @return float |
|
1829 | + * @return string |
|
1830 | 1830 | */ |
1831 | 1831 | public static function IMREAL($complexNumber) |
1832 | 1832 | { |
@@ -2260,7 +2260,6 @@ discard block |
||
2260 | 2260 | * Excel Function: |
2261 | 2261 | * IMSUM(complexNumber[,complexNumber[,...]]) |
2262 | 2262 | * |
2263 | - * @param string $complexNumber,... Series of complex numbers to add |
|
2264 | 2263 | * @return string |
2265 | 2264 | */ |
2266 | 2265 | public static function IMSUM() |
@@ -2299,7 +2298,6 @@ discard block |
||
2299 | 2298 | * Excel Function: |
2300 | 2299 | * IMPRODUCT(complexNumber[,complexNumber[,...]]) |
2301 | 2300 | * |
2302 | - * @param string $complexNumber,... Series of complex numbers to multiply |
|
2303 | 2301 | * @return string |
2304 | 2302 | */ |
2305 | 2303 | public static function IMPRODUCT() |
@@ -2342,7 +2340,7 @@ discard block |
||
2342 | 2340 | * DELTA(a[,b]) |
2343 | 2341 | * |
2344 | 2342 | * @param float $a The first number. |
2345 | - * @param float $b The second number. If omitted, b is assumed to be zero. |
|
2343 | + * @param integer $b The second number. If omitted, b is assumed to be zero. |
|
2346 | 2344 | * @return int |
2347 | 2345 | */ |
2348 | 2346 | public static function DELTA($a, $b = 0) |
@@ -2365,7 +2363,7 @@ discard block |
||
2365 | 2363 | * functions you calculate the count of values that exceed a threshold. |
2366 | 2364 | * |
2367 | 2365 | * @param float $number The value to test against step. |
2368 | - * @param float $step The threshold value. |
|
2366 | + * @param integer $step The threshold value. |
|
2369 | 2367 | * If you omit a value for step, GESTEP uses zero. |
2370 | 2368 | * @return int |
2371 | 2369 | */ |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | */ |
748 | 748 | public static function parseComplex($complexNumber) |
749 | 749 | { |
750 | - $workString = (string)$complexNumber; |
|
750 | + $workString = (string) $complexNumber; |
|
751 | 751 | |
752 | 752 | $realNumber = $imaginary = 0; |
753 | 753 | // Extract the suffix, if there is one |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | { |
829 | 829 | if (!is_null($places)) { |
830 | 830 | if (is_numeric($places)) { |
831 | - $places = (int)$places; |
|
831 | + $places = (int) $places; |
|
832 | 832 | } else { |
833 | 833 | return Functions::VALUE(); |
834 | 834 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | |
1154 | 1154 | if (is_bool($x)) { |
1155 | 1155 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1156 | - $x = (int)$x; |
|
1156 | + $x = (int) $x; |
|
1157 | 1157 | } else { |
1158 | 1158 | return Functions::VALUE(); |
1159 | 1159 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1162 | 1162 | $x = floor($x); |
1163 | 1163 | } |
1164 | - $x = (string)$x; |
|
1164 | + $x = (string) $x; |
|
1165 | 1165 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1166 | 1166 | return Functions::NAN(); |
1167 | 1167 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | // Argument X |
1209 | 1209 | if (is_bool($x)) { |
1210 | 1210 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1211 | - $x = (int)$x; |
|
1211 | + $x = (int) $x; |
|
1212 | 1212 | } else { |
1213 | 1213 | return Functions::VALUE(); |
1214 | 1214 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1217 | 1217 | $x = floor($x); |
1218 | 1218 | } |
1219 | - $x = (string)$x; |
|
1219 | + $x = (string) $x; |
|
1220 | 1220 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1221 | 1221 | return Functions::NAN(); |
1222 | 1222 | } |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | // Two's Complement |
1227 | 1227 | return str_repeat('F', 8) . substr(strtoupper(dechex(bindec(substr($x, -9)))), -2); |
1228 | 1228 | } |
1229 | - $hexVal = (string)strtoupper(dechex(bindec($x))); |
|
1229 | + $hexVal = (string) strtoupper(dechex(bindec($x))); |
|
1230 | 1230 | |
1231 | 1231 | return self::nbrConversionFormat($hexVal, $places); |
1232 | 1232 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | if (is_bool($x)) { |
1265 | 1265 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1266 | - $x = (int)$x; |
|
1266 | + $x = (int) $x; |
|
1267 | 1267 | } else { |
1268 | 1268 | return Functions::VALUE(); |
1269 | 1269 | } |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1272 | 1272 | $x = floor($x); |
1273 | 1273 | } |
1274 | - $x = (string)$x; |
|
1274 | + $x = (string) $x; |
|
1275 | 1275 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1276 | 1276 | return Functions::NAN(); |
1277 | 1277 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | // Two's Complement |
1282 | 1282 | return str_repeat('7', 7) . substr(strtoupper(decoct(bindec(substr($x, -9)))), -3); |
1283 | 1283 | } |
1284 | - $octVal = (string)decoct(bindec($x)); |
|
1284 | + $octVal = (string) decoct(bindec($x)); |
|
1285 | 1285 | |
1286 | 1286 | return self::nbrConversionFormat($octVal, $places); |
1287 | 1287 | } |
@@ -1322,17 +1322,17 @@ discard block |
||
1322 | 1322 | |
1323 | 1323 | if (is_bool($x)) { |
1324 | 1324 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1325 | - $x = (int)$x; |
|
1325 | + $x = (int) $x; |
|
1326 | 1326 | } else { |
1327 | 1327 | return Functions::VALUE(); |
1328 | 1328 | } |
1329 | 1329 | } |
1330 | - $x = (string)$x; |
|
1330 | + $x = (string) $x; |
|
1331 | 1331 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1332 | 1332 | return Functions::VALUE(); |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - $x = (string)floor($x); |
|
1335 | + $x = (string) floor($x); |
|
1336 | 1336 | if ($x < -512 || $x > 511) { |
1337 | 1337 | return Functions::NAN(); |
1338 | 1338 | } |
@@ -1383,16 +1383,16 @@ discard block |
||
1383 | 1383 | |
1384 | 1384 | if (is_bool($x)) { |
1385 | 1385 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1386 | - $x = (int)$x; |
|
1386 | + $x = (int) $x; |
|
1387 | 1387 | } else { |
1388 | 1388 | return Functions::VALUE(); |
1389 | 1389 | } |
1390 | 1390 | } |
1391 | - $x = (string)$x; |
|
1391 | + $x = (string) $x; |
|
1392 | 1392 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1393 | 1393 | return Functions::VALUE(); |
1394 | 1394 | } |
1395 | - $x = (string)floor($x); |
|
1395 | + $x = (string) floor($x); |
|
1396 | 1396 | $r = strtoupper(dechex($x)); |
1397 | 1397 | if (strlen($r) == 8) { |
1398 | 1398 | // Two's Complement |
@@ -1439,16 +1439,16 @@ discard block |
||
1439 | 1439 | |
1440 | 1440 | if (is_bool($x)) { |
1441 | 1441 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1442 | - $x = (int)$x; |
|
1442 | + $x = (int) $x; |
|
1443 | 1443 | } else { |
1444 | 1444 | return Functions::VALUE(); |
1445 | 1445 | } |
1446 | 1446 | } |
1447 | - $x = (string)$x; |
|
1447 | + $x = (string) $x; |
|
1448 | 1448 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1449 | 1449 | return Functions::VALUE(); |
1450 | 1450 | } |
1451 | - $x = (string)floor($x); |
|
1451 | + $x = (string) floor($x); |
|
1452 | 1452 | $r = decoct($x); |
1453 | 1453 | if (strlen($r) == 11) { |
1454 | 1454 | // Two's Complement |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | if (is_bool($x)) { |
1496 | 1496 | return Functions::VALUE(); |
1497 | 1497 | } |
1498 | - $x = (string)$x; |
|
1498 | + $x = (string) $x; |
|
1499 | 1499 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1500 | 1500 | return Functions::NAN(); |
1501 | 1501 | } |
@@ -1530,12 +1530,12 @@ discard block |
||
1530 | 1530 | if (is_bool($x)) { |
1531 | 1531 | return Functions::VALUE(); |
1532 | 1532 | } |
1533 | - $x = (string)$x; |
|
1533 | + $x = (string) $x; |
|
1534 | 1534 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1535 | 1535 | return Functions::NAN(); |
1536 | 1536 | } |
1537 | 1537 | |
1538 | - if (strlen($x)> 10) { |
|
1538 | + if (strlen($x) > 10) { |
|
1539 | 1539 | return Functions::NAN(); |
1540 | 1540 | } |
1541 | 1541 | |
@@ -1593,7 +1593,7 @@ discard block |
||
1593 | 1593 | if (is_bool($x)) { |
1594 | 1594 | return Functions::VALUE(); |
1595 | 1595 | } |
1596 | - $x = (string)$x; |
|
1596 | + $x = (string) $x; |
|
1597 | 1597 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1598 | 1598 | return Functions::NAN(); |
1599 | 1599 | } |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | if (is_bool($x)) { |
1649 | 1649 | return Functions::VALUE(); |
1650 | 1650 | } |
1651 | - $x = (string)$x; |
|
1651 | + $x = (string) $x; |
|
1652 | 1652 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1653 | 1653 | return Functions::NAN(); |
1654 | 1654 | } |
@@ -1683,13 +1683,13 @@ discard block |
||
1683 | 1683 | if (is_bool($x)) { |
1684 | 1684 | return Functions::VALUE(); |
1685 | 1685 | } |
1686 | - $x = (string)$x; |
|
1686 | + $x = (string) $x; |
|
1687 | 1687 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1688 | 1688 | return Functions::NAN(); |
1689 | 1689 | } |
1690 | 1690 | $binX = ''; |
1691 | 1691 | foreach (str_split($x) as $char) { |
1692 | - $binX .= str_pad(decbin((int)$char), 3, '0', STR_PAD_LEFT); |
|
1692 | + $binX .= str_pad(decbin((int) $char), 3, '0', STR_PAD_LEFT); |
|
1693 | 1693 | } |
1694 | 1694 | if (strlen($binX) == 30 && $binX[0] == '1') { |
1695 | 1695 | for ($i = 0; $i < 30; $i++) { |
@@ -1737,7 +1737,7 @@ discard block |
||
1737 | 1737 | if (is_bool($x)) { |
1738 | 1738 | return Functions::VALUE(); |
1739 | 1739 | } |
1740 | - $x = (string)$x; |
|
1740 | + $x = (string) $x; |
|
1741 | 1741 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1742 | 1742 | return Functions::NAN(); |
1743 | 1743 | } |
@@ -1772,32 +1772,32 @@ discard block |
||
1772 | 1772 | if (((is_numeric($realNumber)) && (is_numeric($imaginary))) && |
1773 | 1773 | (($suffix == 'i') || ($suffix == 'j') || ($suffix == '')) |
1774 | 1774 | ) { |
1775 | - $realNumber = (float)$realNumber; |
|
1776 | - $imaginary = (float)$imaginary; |
|
1775 | + $realNumber = (float) $realNumber; |
|
1776 | + $imaginary = (float) $imaginary; |
|
1777 | 1777 | |
1778 | 1778 | if ($suffix == '') { |
1779 | 1779 | $suffix = 'i'; |
1780 | 1780 | } |
1781 | 1781 | if ($realNumber == 0.0) { |
1782 | 1782 | if ($imaginary == 0.0) { |
1783 | - return (string)'0'; |
|
1783 | + return (string) '0'; |
|
1784 | 1784 | } elseif ($imaginary == 1.0) { |
1785 | - return (string)$suffix; |
|
1785 | + return (string) $suffix; |
|
1786 | 1786 | } elseif ($imaginary == -1.0) { |
1787 | - return (string)'-' . $suffix; |
|
1787 | + return (string) '-' . $suffix; |
|
1788 | 1788 | } |
1789 | - return (string)$imaginary . $suffix; |
|
1789 | + return (string) $imaginary . $suffix; |
|
1790 | 1790 | } elseif ($imaginary == 0.0) { |
1791 | - return (string)$realNumber; |
|
1791 | + return (string) $realNumber; |
|
1792 | 1792 | } elseif ($imaginary == 1.0) { |
1793 | - return (string)$realNumber . '+' . $suffix; |
|
1793 | + return (string) $realNumber . '+' . $suffix; |
|
1794 | 1794 | } elseif ($imaginary == -1.0) { |
1795 | - return (string)$realNumber . '-' . $suffix; |
|
1795 | + return (string) $realNumber . '-' . $suffix; |
|
1796 | 1796 | } |
1797 | 1797 | if ($imaginary > 0) { |
1798 | - $imaginary = (string)'+' . $imaginary; |
|
1798 | + $imaginary = (string) '+' . $imaginary; |
|
1799 | 1799 | } |
1800 | - return (string)$realNumber . $imaginary . $suffix; |
|
1800 | + return (string) $realNumber . $imaginary . $suffix; |
|
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | return Functions::VALUE(); |
@@ -2362,7 +2362,7 @@ discard block |
||
2362 | 2362 | $a = Functions::flattenSingleValue($a); |
2363 | 2363 | $b = Functions::flattenSingleValue($b); |
2364 | 2364 | |
2365 | - return (int)($a == $b); |
|
2365 | + return (int) ($a == $b); |
|
2366 | 2366 | } |
2367 | 2367 | |
2368 | 2368 | |
@@ -2386,7 +2386,7 @@ discard block |
||
2386 | 2386 | $number = Functions::flattenSingleValue($number); |
2387 | 2387 | $step = Functions::flattenSingleValue($step); |
2388 | 2388 | |
2389 | - return (int)($number >= $step); |
|
2389 | + return (int) ($number >= $step); |
|
2390 | 2390 | } |
2391 | 2391 | |
2392 | 2392 |
@@ -63,6 +63,10 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | + /** |
|
67 | + * @param integer $frequency |
|
68 | + * @param boolean $next |
|
69 | + */ |
|
66 | 70 | private static function couponFirstPeriodDate($settlement, $maturity, $frequency, $next) |
67 | 71 | { |
68 | 72 | $months = 12 / $frequency; |
@@ -85,6 +89,9 @@ discard block |
||
85 | 89 | } |
86 | 90 | |
87 | 91 | |
92 | + /** |
|
93 | + * @param integer $frequency |
|
94 | + */ |
|
88 | 95 | private static function isValidFrequency($frequency) |
89 | 96 | { |
90 | 97 | if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) { |
@@ -162,7 +169,7 @@ discard block |
||
162 | 169 | * The security settlement date is the date after the issue date |
163 | 170 | * when the security is traded to the buyer. |
164 | 171 | * @param float $rate The security's annual coupon rate. |
165 | - * @param float $par The security's par value. |
|
172 | + * @param integer $par The security's par value. |
|
166 | 173 | * If you omit par, ACCRINT uses $1,000. |
167 | 174 | * @param integer $frequency the number of coupon payments per year. |
168 | 175 | * Valid frequency values are: |
@@ -432,6 +439,7 @@ discard block |
||
432 | 439 | * 2 Actual/360 |
433 | 440 | * 3 Actual/365 |
434 | 441 | * 4 European 30/360 |
442 | + * @param integer $frequency |
|
435 | 443 | * @return float |
436 | 444 | */ |
437 | 445 | public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0) |
@@ -491,6 +499,7 @@ discard block |
||
491 | 499 | * 2 Actual/360 |
492 | 500 | * 3 Actual/365 |
493 | 501 | * 4 European 30/360 |
502 | + * @param integer $frequency |
|
494 | 503 | * @return float |
495 | 504 | */ |
496 | 505 | public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0) |
@@ -564,6 +573,7 @@ discard block |
||
564 | 573 | * 2 Actual/360 |
565 | 574 | * 3 Actual/365 |
566 | 575 | * 4 European 30/360 |
576 | + * @param integer $frequency |
|
567 | 577 | * @return float |
568 | 578 | */ |
569 | 579 | public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0) |
@@ -681,6 +691,7 @@ discard block |
||
681 | 691 | * 2 Actual/360 |
682 | 692 | * 3 Actual/365 |
683 | 693 | * 4 European 30/360 |
694 | + * @param integer $frequency |
|
684 | 695 | * @return integer |
685 | 696 | */ |
686 | 697 | public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0) |
@@ -1144,7 +1155,7 @@ discard block |
||
1144 | 1155 | * |
1145 | 1156 | * @access public |
1146 | 1157 | * @category Financial Functions |
1147 | - * @param float $nominal_rate Nominal interest rate |
|
1158 | + * @param integer $nominal_rate Nominal interest rate |
|
1148 | 1159 | * @param integer $npery Number of compounding payments per year |
1149 | 1160 | * @return float |
1150 | 1161 | */ |
@@ -1172,12 +1183,12 @@ discard block |
||
1172 | 1183 | * |
1173 | 1184 | * @access public |
1174 | 1185 | * @category Financial Functions |
1175 | - * @param float $rate The interest rate per period |
|
1186 | + * @param integer $rate The interest rate per period |
|
1176 | 1187 | * @param int $nper Total number of payment periods in an annuity |
1177 | - * @param float $pmt The payment made each period: it cannot change over the |
|
1188 | + * @param integer $pmt The payment made each period: it cannot change over the |
|
1178 | 1189 | * life of the annuity. Typically, pmt contains principal |
1179 | 1190 | * and interest but no other fees or taxes. |
1180 | - * @param float $pv Present Value, or the lump-sum amount that a series of |
|
1191 | + * @param integer $pv Present Value, or the lump-sum amount that a series of |
|
1181 | 1192 | * future payments is worth right now. |
1182 | 1193 | * @param integer $type A number 0 or 1 and indicates when payments are due: |
1183 | 1194 | * 0 or omitted At the end of the period. |
@@ -1293,7 +1304,7 @@ discard block |
||
1293 | 1304 | * @param int $per Period for which we want to find the interest |
1294 | 1305 | * @param int $nper Number of periods |
1295 | 1306 | * @param float $pv Present Value |
1296 | - * @param float $fv Future Value |
|
1307 | + * @param integer $fv Future Value |
|
1297 | 1308 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1298 | 1309 | * @return float |
1299 | 1310 | */ |
@@ -1485,7 +1496,7 @@ discard block |
||
1485 | 1496 | * |
1486 | 1497 | * Returns the nominal interest rate given the effective rate and the number of compounding payments per year. |
1487 | 1498 | * |
1488 | - * @param float $effect_rate Effective interest rate |
|
1499 | + * @param integer $effect_rate Effective interest rate |
|
1489 | 1500 | * @param int $npery Number of compounding payments per year |
1490 | 1501 | * @return float |
1491 | 1502 | */ |
@@ -1509,10 +1520,10 @@ discard block |
||
1509 | 1520 | * |
1510 | 1521 | * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate. |
1511 | 1522 | * |
1512 | - * @param float $rate Interest rate per period |
|
1523 | + * @param integer $rate Interest rate per period |
|
1513 | 1524 | * @param int $pmt Periodic payment (annuity) |
1514 | - * @param float $pv Present Value |
|
1515 | - * @param float $fv Future Value |
|
1525 | + * @param integer $pv Present Value |
|
1526 | + * @param integer $fv Future Value |
|
1516 | 1527 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1517 | 1528 | * @return float |
1518 | 1529 | */ |
@@ -1575,10 +1586,10 @@ discard block |
||
1575 | 1586 | * |
1576 | 1587 | * Returns the constant payment (annuity) for a cash flow with a constant interest rate. |
1577 | 1588 | * |
1578 | - * @param float $rate Interest rate per period |
|
1589 | + * @param integer $rate Interest rate per period |
|
1579 | 1590 | * @param int $nper Number of periods |
1580 | - * @param float $pv Present Value |
|
1581 | - * @param float $fv Future Value |
|
1591 | + * @param integer $pv Present Value |
|
1592 | + * @param integer $fv Future Value |
|
1582 | 1593 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1583 | 1594 | * @return float |
1584 | 1595 | */ |
@@ -1612,7 +1623,7 @@ discard block |
||
1612 | 1623 | * @param int $per Period for which we want to find the interest |
1613 | 1624 | * @param int $nper Number of periods |
1614 | 1625 | * @param float $pv Present Value |
1615 | - * @param float $fv Future Value |
|
1626 | + * @param integer $fv Future Value |
|
1616 | 1627 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1617 | 1628 | * @return float |
1618 | 1629 | */ |
@@ -1795,10 +1806,10 @@ discard block |
||
1795 | 1806 | * |
1796 | 1807 | * Returns the Present Value of a cash flow with constant payments and interest rate (annuities). |
1797 | 1808 | * |
1798 | - * @param float $rate Interest rate per period |
|
1809 | + * @param integer $rate Interest rate per period |
|
1799 | 1810 | * @param int $nper Number of periods |
1800 | - * @param float $pmt Periodic payment (annuity) |
|
1801 | - * @param float $fv Future Value |
|
1811 | + * @param integer $pmt Periodic payment (annuity) |
|
1812 | + * @param integer $fv Future Value |
|
1802 | 1813 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1803 | 1814 | * @return float |
1804 | 1815 | */ |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | $eom = self::isLastDayOfMonth($result); |
72 | 72 | |
73 | 73 | while ($settlement < \PHPExcel\Shared\Date::PHPToExcel($result)) { |
74 | - $result->modify('-'.$months.' months'); |
|
74 | + $result->modify('-' . $months . ' months'); |
|
75 | 75 | } |
76 | 76 | if ($next) { |
77 | - $result->modify('+'.$months.' months'); |
|
77 | + $result->modify('+' . $months . ' months'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | if ($eom) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $pmt = self::PMT($rate, $nper, $pv, $fv, $type); |
139 | 139 | $capital = $pv; |
140 | - for ($i = 1; $i<= $per; ++$i) { |
|
140 | + for ($i = 1; $i <= $per; ++$i) { |
|
141 | 141 | $interest = ($type && $i == 1) ? 0 : -$capital * $rate; |
142 | 142 | $principal = $pmt - $interest; |
143 | 143 | $capital += $principal; |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0) |
185 | 185 | { |
186 | - $issue = Functions::flattenSingleValue($issue); |
|
187 | - $firstinterest = Functions::flattenSingleValue($firstinterest); |
|
188 | - $settlement = Functions::flattenSingleValue($settlement); |
|
189 | - $rate = Functions::flattenSingleValue($rate); |
|
190 | - $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
191 | - $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency); |
|
192 | - $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
186 | + $issue = Functions::flattenSingleValue($issue); |
|
187 | + $firstinterest = Functions::flattenSingleValue($firstinterest); |
|
188 | + $settlement = Functions::flattenSingleValue($settlement); |
|
189 | + $rate = Functions::flattenSingleValue($rate); |
|
190 | + $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
191 | + $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency); |
|
192 | + $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
193 | 193 | |
194 | 194 | // Validate |
195 | 195 | if ((is_numeric($rate)) && (is_numeric($par))) { |
196 | - $rate = (float) $rate; |
|
197 | - $par = (float) $par; |
|
196 | + $rate = (float) $rate; |
|
197 | + $par = (float) $par; |
|
198 | 198 | if (($rate <= 0) || ($par <= 0)) { |
199 | 199 | return Functions::NAN(); |
200 | 200 | } |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0) |
237 | 237 | { |
238 | - $issue = Functions::flattenSingleValue($issue); |
|
239 | - $settlement = Functions::flattenSingleValue($settlement); |
|
240 | - $rate = Functions::flattenSingleValue($rate); |
|
241 | - $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
242 | - $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
238 | + $issue = Functions::flattenSingleValue($issue); |
|
239 | + $settlement = Functions::flattenSingleValue($settlement); |
|
240 | + $rate = Functions::flattenSingleValue($rate); |
|
241 | + $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
242 | + $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
243 | 243 | |
244 | 244 | // Validate |
245 | 245 | if ((is_numeric($rate)) && (is_numeric($par))) { |
246 | - $rate = (float) $rate; |
|
247 | - $par = (float) $par; |
|
246 | + $rate = (float) $rate; |
|
247 | + $par = (float) $par; |
|
248 | 248 | if (($rate <= 0) || ($par <= 0)) { |
249 | 249 | return Functions::NAN(); |
250 | 250 | } |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) |
294 | 294 | { |
295 | - $cost = Functions::flattenSingleValue($cost); |
|
296 | - $purchased = Functions::flattenSingleValue($purchased); |
|
295 | + $cost = Functions::flattenSingleValue($cost); |
|
296 | + $purchased = Functions::flattenSingleValue($purchased); |
|
297 | 297 | $firstPeriod = Functions::flattenSingleValue($firstPeriod); |
298 | 298 | $salvage = Functions::flattenSingleValue($salvage); |
299 | - $period = floor(Functions::flattenSingleValue($period)); |
|
300 | - $rate = Functions::flattenSingleValue($rate); |
|
301 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
299 | + $period = floor(Functions::flattenSingleValue($period)); |
|
300 | + $rate = Functions::flattenSingleValue($rate); |
|
301 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
302 | 302 | |
303 | 303 | // The depreciation coefficients are: |
304 | 304 | // Life of assets (1/rate) Depreciation coefficient |
@@ -628,10 +628,10 @@ discard block |
||
628 | 628 | */ |
629 | 629 | public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0) |
630 | 630 | { |
631 | - $settlement = Functions::flattenSingleValue($settlement); |
|
632 | - $maturity = Functions::flattenSingleValue($maturity); |
|
631 | + $settlement = Functions::flattenSingleValue($settlement); |
|
632 | + $maturity = Functions::flattenSingleValue($maturity); |
|
633 | 633 | $frequency = (int) Functions::flattenSingleValue($frequency); |
634 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
634 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
635 | 635 | |
636 | 636 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
637 | 637 | return Functions::VALUE(); |
@@ -685,10 +685,10 @@ discard block |
||
685 | 685 | */ |
686 | 686 | public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0) |
687 | 687 | { |
688 | - $settlement = Functions::flattenSingleValue($settlement); |
|
689 | - $maturity = Functions::flattenSingleValue($maturity); |
|
688 | + $settlement = Functions::flattenSingleValue($settlement); |
|
689 | + $maturity = Functions::flattenSingleValue($maturity); |
|
690 | 690 | $frequency = (int) Functions::flattenSingleValue($frequency); |
691 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
691 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
692 | 692 | |
693 | 693 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
694 | 694 | return Functions::VALUE(); |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0) |
759 | 759 | { |
760 | - $settlement = Functions::flattenSingleValue($settlement); |
|
761 | - $maturity = Functions::flattenSingleValue($maturity); |
|
760 | + $settlement = Functions::flattenSingleValue($settlement); |
|
761 | + $maturity = Functions::flattenSingleValue($maturity); |
|
762 | 762 | $frequency = (int) Functions::flattenSingleValue($frequency); |
763 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
763 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
764 | 764 | |
765 | 765 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
766 | 766 | return Functions::VALUE(); |
@@ -804,10 +804,10 @@ discard block |
||
804 | 804 | { |
805 | 805 | $rate = Functions::flattenSingleValue($rate); |
806 | 806 | $nper = (int) Functions::flattenSingleValue($nper); |
807 | - $pv = Functions::flattenSingleValue($pv); |
|
808 | - $start = (int) Functions::flattenSingleValue($start); |
|
809 | - $end = (int) Functions::flattenSingleValue($end); |
|
810 | - $type = (int) Functions::flattenSingleValue($type); |
|
807 | + $pv = Functions::flattenSingleValue($pv); |
|
808 | + $start = (int) Functions::flattenSingleValue($start); |
|
809 | + $end = (int) Functions::flattenSingleValue($end); |
|
810 | + $type = (int) Functions::flattenSingleValue($type); |
|
811 | 811 | |
812 | 812 | // Validate parameters |
813 | 813 | if ($type != 0 && $type != 1) { |
@@ -852,10 +852,10 @@ discard block |
||
852 | 852 | { |
853 | 853 | $rate = Functions::flattenSingleValue($rate); |
854 | 854 | $nper = (int) Functions::flattenSingleValue($nper); |
855 | - $pv = Functions::flattenSingleValue($pv); |
|
856 | - $start = (int) Functions::flattenSingleValue($start); |
|
857 | - $end = (int) Functions::flattenSingleValue($end); |
|
858 | - $type = (int) Functions::flattenSingleValue($type); |
|
855 | + $pv = Functions::flattenSingleValue($pv); |
|
856 | + $start = (int) Functions::flattenSingleValue($start); |
|
857 | + $end = (int) Functions::flattenSingleValue($end); |
|
858 | + $type = (int) Functions::flattenSingleValue($type); |
|
859 | 859 | |
860 | 860 | // Validate parameters |
861 | 861 | if ($type != 0 && $type != 1) { |
@@ -904,10 +904,10 @@ discard block |
||
904 | 904 | public static function DB($cost, $salvage, $life, $period, $month = 12) |
905 | 905 | { |
906 | 906 | $cost = Functions::flattenSingleValue($cost); |
907 | - $salvage = Functions::flattenSingleValue($salvage); |
|
907 | + $salvage = Functions::flattenSingleValue($salvage); |
|
908 | 908 | $life = Functions::flattenSingleValue($life); |
909 | - $period = Functions::flattenSingleValue($period); |
|
910 | - $month = Functions::flattenSingleValue($month); |
|
909 | + $period = Functions::flattenSingleValue($period); |
|
910 | + $month = Functions::flattenSingleValue($month); |
|
911 | 911 | |
912 | 912 | // Validate |
913 | 913 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) { |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | public static function DDB($cost, $salvage, $life, $period, $factor = 2.0) |
973 | 973 | { |
974 | 974 | $cost = Functions::flattenSingleValue($cost); |
975 | - $salvage = Functions::flattenSingleValue($salvage); |
|
975 | + $salvage = Functions::flattenSingleValue($salvage); |
|
976 | 976 | $life = Functions::flattenSingleValue($life); |
977 | 977 | $period = Functions::flattenSingleValue($period); |
978 | 978 | $factor = Functions::flattenSingleValue($factor); |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0) |
1035 | 1035 | { |
1036 | 1036 | $settlement = Functions::flattenSingleValue($settlement); |
1037 | - $maturity = Functions::flattenSingleValue($maturity); |
|
1037 | + $maturity = Functions::flattenSingleValue($maturity); |
|
1038 | 1038 | $price = Functions::flattenSingleValue($price); |
1039 | 1039 | $redemption = Functions::flattenSingleValue($redemption); |
1040 | 1040 | $basis = Functions::flattenSingleValue($basis); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | // Validate |
1043 | 1043 | if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) { |
1044 | 1044 | $price = (float) $price; |
1045 | - $redemption = (float) $redemption; |
|
1045 | + $redemption = (float) $redemption; |
|
1046 | 1046 | $basis = (int) $basis; |
1047 | 1047 | if (($price <= 0) || ($redemption <= 0)) { |
1048 | 1048 | return Functions::NAN(); |
@@ -1077,8 +1077,8 @@ discard block |
||
1077 | 1077 | */ |
1078 | 1078 | public static function DOLLARDE($fractional_dollar = null, $fraction = 0) |
1079 | 1079 | { |
1080 | - $fractional_dollar = Functions::flattenSingleValue($fractional_dollar); |
|
1081 | - $fraction = (int)Functions::flattenSingleValue($fraction); |
|
1080 | + $fractional_dollar = Functions::flattenSingleValue($fractional_dollar); |
|
1081 | + $fraction = (int) Functions::flattenSingleValue($fraction); |
|
1082 | 1082 | |
1083 | 1083 | // Validate parameters |
1084 | 1084 | if (is_null($fractional_dollar) || $fraction < 0) { |
@@ -1114,8 +1114,8 @@ discard block |
||
1114 | 1114 | */ |
1115 | 1115 | public static function DOLLARFR($decimal_dollar = null, $fraction = 0) |
1116 | 1116 | { |
1117 | - $decimal_dollar = Functions::flattenSingleValue($decimal_dollar); |
|
1118 | - $fraction = (int)Functions::flattenSingleValue($fraction); |
|
1117 | + $decimal_dollar = Functions::flattenSingleValue($decimal_dollar); |
|
1118 | + $fraction = (int) Functions::flattenSingleValue($fraction); |
|
1119 | 1119 | |
1120 | 1120 | // Validate parameters |
1121 | 1121 | if (is_null($decimal_dollar) || $fraction < 0) { |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | */ |
1151 | 1151 | public static function EFFECT($nominal_rate = 0, $npery = 0) |
1152 | 1152 | { |
1153 | - $nominal_rate = Functions::flattenSingleValue($nominal_rate); |
|
1154 | - $npery = (int)Functions::flattenSingleValue($npery); |
|
1153 | + $nominal_rate = Functions::flattenSingleValue($nominal_rate); |
|
1154 | + $npery = (int) Functions::flattenSingleValue($npery); |
|
1155 | 1155 | |
1156 | 1156 | // Validate parameters |
1157 | 1157 | if ($nominal_rate <= 0 || $npery < 1) { |
@@ -1188,8 +1188,8 @@ discard block |
||
1188 | 1188 | { |
1189 | 1189 | $rate = Functions::flattenSingleValue($rate); |
1190 | 1190 | $nper = Functions::flattenSingleValue($nper); |
1191 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1192 | - $pv = Functions::flattenSingleValue($pv); |
|
1191 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1192 | + $pv = Functions::flattenSingleValue($pv); |
|
1193 | 1193 | $type = Functions::flattenSingleValue($type); |
1194 | 1194 | |
1195 | 1195 | // Validate parameters |
@@ -1220,8 +1220,8 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | public static function FVSCHEDULE($principal, $schedule) |
1222 | 1222 | { |
1223 | - $principal = Functions::flattenSingleValue($principal); |
|
1224 | - $schedule = Functions::flattenArray($schedule); |
|
1223 | + $principal = Functions::flattenSingleValue($principal); |
|
1224 | + $schedule = Functions::flattenArray($schedule); |
|
1225 | 1225 | |
1226 | 1226 | foreach ($schedule as $rate) { |
1227 | 1227 | $principal *= 1 + $rate; |
@@ -1256,16 +1256,16 @@ discard block |
||
1256 | 1256 | public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0) |
1257 | 1257 | { |
1258 | 1258 | $settlement = Functions::flattenSingleValue($settlement); |
1259 | - $maturity = Functions::flattenSingleValue($maturity); |
|
1259 | + $maturity = Functions::flattenSingleValue($maturity); |
|
1260 | 1260 | $investment = Functions::flattenSingleValue($investment); |
1261 | 1261 | $redemption = Functions::flattenSingleValue($redemption); |
1262 | - $basis = Functions::flattenSingleValue($basis); |
|
1262 | + $basis = Functions::flattenSingleValue($basis); |
|
1263 | 1263 | |
1264 | 1264 | // Validate |
1265 | 1265 | if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) { |
1266 | 1266 | $investment = (float) $investment; |
1267 | 1267 | $redemption = (float) $redemption; |
1268 | - $basis = (int) $basis; |
|
1268 | + $basis = (int) $basis; |
|
1269 | 1269 | if (($investment <= 0) || ($redemption <= 0)) { |
1270 | 1270 | return Functions::NAN(); |
1271 | 1271 | } |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) |
1301 | 1301 | { |
1302 | 1302 | $rate = Functions::flattenSingleValue($rate); |
1303 | - $per = (int) Functions::flattenSingleValue($per); |
|
1303 | + $per = (int) Functions::flattenSingleValue($per); |
|
1304 | 1304 | $nper = (int) Functions::flattenSingleValue($nper); |
1305 | 1305 | $pv = Functions::flattenSingleValue($pv); |
1306 | 1306 | $fv = Functions::flattenSingleValue($fv); |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | |
1420 | 1420 | // Calculate |
1421 | 1421 | $principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0); |
1422 | - for ($i=0; $i <= $period; ++$i) { |
|
1422 | + for ($i = 0; $i <= $period; ++$i) { |
|
1423 | 1423 | $returnValue = $interestRate * $principleRemaining * -1; |
1424 | 1424 | $principleRemaining -= $principlePayment; |
1425 | 1425 | // principle needs to be 0 after the last payment, don't let floating point screw it up |
@@ -1452,9 +1452,9 @@ discard block |
||
1452 | 1452 | if (!is_array($values)) { |
1453 | 1453 | return Functions::VALUE(); |
1454 | 1454 | } |
1455 | - $values = Functions::flattenArray($values); |
|
1456 | - $finance_rate = Functions::flattenSingleValue($finance_rate); |
|
1457 | - $reinvestment_rate = Functions::flattenSingleValue($reinvestment_rate); |
|
1455 | + $values = Functions::flattenArray($values); |
|
1456 | + $finance_rate = Functions::flattenSingleValue($finance_rate); |
|
1457 | + $reinvestment_rate = Functions::flattenSingleValue($reinvestment_rate); |
|
1458 | 1458 | $n = count($values); |
1459 | 1459 | |
1460 | 1460 | $rr = 1.0 + $reinvestment_rate; |
@@ -1491,8 +1491,8 @@ discard block |
||
1491 | 1491 | */ |
1492 | 1492 | public static function NOMINAL($effect_rate = 0, $npery = 0) |
1493 | 1493 | { |
1494 | - $effect_rate = Functions::flattenSingleValue($effect_rate); |
|
1495 | - $npery = (int)Functions::flattenSingleValue($npery); |
|
1494 | + $effect_rate = Functions::flattenSingleValue($effect_rate); |
|
1495 | + $npery = (int) Functions::flattenSingleValue($npery); |
|
1496 | 1496 | |
1497 | 1497 | // Validate parameters |
1498 | 1498 | if ($effect_rate <= 0 || $npery < 1) { |
@@ -1518,11 +1518,11 @@ discard block |
||
1518 | 1518 | */ |
1519 | 1519 | public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) |
1520 | 1520 | { |
1521 | - $rate = Functions::flattenSingleValue($rate); |
|
1522 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1521 | + $rate = Functions::flattenSingleValue($rate); |
|
1522 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1523 | 1523 | $pv = Functions::flattenSingleValue($pv); |
1524 | 1524 | $fv = Functions::flattenSingleValue($fv); |
1525 | - $type = Functions::flattenSingleValue($type); |
|
1525 | + $type = Functions::flattenSingleValue($type); |
|
1526 | 1526 | |
1527 | 1527 | // Validate parameters |
1528 | 1528 | if ($type != 0 && $type != 1) { |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | if ($pmt == 0) { |
1540 | 1540 | return Functions::NAN(); |
1541 | 1541 | } |
1542 | - return (-$pv -$fv) / $pmt; |
|
1542 | + return (-$pv - $fv) / $pmt; |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | /** |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) |
1620 | 1620 | { |
1621 | 1621 | $rate = Functions::flattenSingleValue($rate); |
1622 | - $per = (int) Functions::flattenSingleValue($per); |
|
1622 | + $per = (int) Functions::flattenSingleValue($per); |
|
1623 | 1623 | $nper = (int) Functions::flattenSingleValue($nper); |
1624 | 1624 | $pv = Functions::flattenSingleValue($pv); |
1625 | 1625 | $fv = Functions::flattenSingleValue($fv); |
@@ -1641,13 +1641,13 @@ discard block |
||
1641 | 1641 | |
1642 | 1642 | public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0) |
1643 | 1643 | { |
1644 | - $settlement = Functions::flattenSingleValue($settlement); |
|
1644 | + $settlement = Functions::flattenSingleValue($settlement); |
|
1645 | 1645 | $maturity = Functions::flattenSingleValue($maturity); |
1646 | 1646 | $rate = (float) Functions::flattenSingleValue($rate); |
1647 | 1647 | $yield = (float) Functions::flattenSingleValue($yield); |
1648 | - $redemption = (float) Functions::flattenSingleValue($redemption); |
|
1648 | + $redemption = (float) Functions::flattenSingleValue($redemption); |
|
1649 | 1649 | $frequency = (int) Functions::flattenSingleValue($frequency); |
1650 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
1650 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
1651 | 1651 | |
1652 | 1652 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
1653 | 1653 | return Functions::VALUE(); |
@@ -1667,9 +1667,9 @@ discard block |
||
1667 | 1667 | $n = self::COUPNUM($settlement, $maturity, $frequency, $basis); |
1668 | 1668 | $a = self::COUPDAYBS($settlement, $maturity, $frequency, $basis); |
1669 | 1669 | |
1670 | - $baseYF = 1.0 + ($yield / $frequency); |
|
1670 | + $baseYF = 1.0 + ($yield / $frequency); |
|
1671 | 1671 | $rfp = 100 * ($rate / $frequency); |
1672 | - $de = $dsc / $e; |
|
1672 | + $de = $dsc / $e; |
|
1673 | 1673 | |
1674 | 1674 | $result = $redemption / pow($baseYF, (--$n + $de)); |
1675 | 1675 | for ($k = 0; $k <= $n; ++$k) { |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | $maturity = Functions::flattenSingleValue($maturity); |
1707 | 1707 | $discount = (float) Functions::flattenSingleValue($discount); |
1708 | 1708 | $redemption = (float) Functions::flattenSingleValue($redemption); |
1709 | - $basis = (int) Functions::flattenSingleValue($basis); |
|
1709 | + $basis = (int) Functions::flattenSingleValue($basis); |
|
1710 | 1710 | |
1711 | 1711 | // Validate |
1712 | 1712 | if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) { |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | */ |
1748 | 1748 | public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0) |
1749 | 1749 | { |
1750 | - $settlement = Functions::flattenSingleValue($settlement); |
|
1750 | + $settlement = Functions::flattenSingleValue($settlement); |
|
1751 | 1751 | $maturity = Functions::flattenSingleValue($maturity); |
1752 | 1752 | $issue = Functions::flattenSingleValue($issue); |
1753 | 1753 | $rate = Functions::flattenSingleValue($rate); |
@@ -1806,8 +1806,8 @@ discard block |
||
1806 | 1806 | { |
1807 | 1807 | $rate = Functions::flattenSingleValue($rate); |
1808 | 1808 | $nper = Functions::flattenSingleValue($nper); |
1809 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1810 | - $fv = Functions::flattenSingleValue($fv); |
|
1809 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1810 | + $fv = Functions::flattenSingleValue($fv); |
|
1811 | 1811 | $type = Functions::flattenSingleValue($type); |
1812 | 1812 | |
1813 | 1813 | // Validate parameters |
@@ -1855,12 +1855,12 @@ discard block |
||
1855 | 1855 | **/ |
1856 | 1856 | public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) |
1857 | 1857 | { |
1858 | - $nper = (int) Functions::flattenSingleValue($nper); |
|
1859 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1858 | + $nper = (int) Functions::flattenSingleValue($nper); |
|
1859 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1860 | 1860 | $pv = Functions::flattenSingleValue($pv); |
1861 | - $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv); |
|
1862 | - $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type); |
|
1863 | - $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); |
|
1861 | + $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv); |
|
1862 | + $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type); |
|
1863 | + $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); |
|
1864 | 1864 | |
1865 | 1865 | $rate = $guess; |
1866 | 1866 | if (abs($rate) < FINANCIAL_PRECISION) { |
@@ -1922,7 +1922,7 @@ discard block |
||
1922 | 1922 | $maturity = Functions::flattenSingleValue($maturity); |
1923 | 1923 | $investment = (float) Functions::flattenSingleValue($investment); |
1924 | 1924 | $discount = (float) Functions::flattenSingleValue($discount); |
1925 | - $basis = (int) Functions::flattenSingleValue($basis); |
|
1925 | + $basis = (int) Functions::flattenSingleValue($basis); |
|
1926 | 1926 | |
1927 | 1927 | // Validate |
1928 | 1928 | if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) { |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | return $daysBetweenSettlementAndMaturity; |
1936 | 1936 | } |
1937 | 1937 | |
1938 | - return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity)); |
|
1938 | + return $investment / (1 - ($discount * $daysBetweenSettlementAndMaturity)); |
|
1939 | 1939 | } |
1940 | 1940 | return Functions::VALUE(); |
1941 | 1941 | } |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | public static function SLN($cost, $salvage, $life) |
1955 | 1955 | { |
1956 | 1956 | $cost = Functions::flattenSingleValue($cost); |
1957 | - $salvage = Functions::flattenSingleValue($salvage); |
|
1957 | + $salvage = Functions::flattenSingleValue($salvage); |
|
1958 | 1958 | $life = Functions::flattenSingleValue($life); |
1959 | 1959 | |
1960 | 1960 | // Calculate |
@@ -1982,9 +1982,9 @@ discard block |
||
1982 | 1982 | public static function SYD($cost, $salvage, $life, $period) |
1983 | 1983 | { |
1984 | 1984 | $cost = Functions::flattenSingleValue($cost); |
1985 | - $salvage = Functions::flattenSingleValue($salvage); |
|
1985 | + $salvage = Functions::flattenSingleValue($salvage); |
|
1986 | 1986 | $life = Functions::flattenSingleValue($life); |
1987 | - $period = Functions::flattenSingleValue($period); |
|
1987 | + $period = Functions::flattenSingleValue($period); |
|
1988 | 1988 | |
1989 | 1989 | // Calculate |
1990 | 1990 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) { |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | */ |
2012 | 2012 | public static function TBILLEQ($settlement, $maturity, $discount) |
2013 | 2013 | { |
2014 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2014 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2015 | 2015 | $maturity = Functions::flattenSingleValue($maturity); |
2016 | 2016 | $discount = Functions::flattenSingleValue($discount); |
2017 | 2017 | |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | */ |
2051 | 2051 | public static function TBILLPRICE($settlement, $maturity, $discount) |
2052 | 2052 | { |
2053 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2053 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2054 | 2054 | $maturity = Functions::flattenSingleValue($maturity); |
2055 | 2055 | $discount = Functions::flattenSingleValue($discount); |
2056 | 2056 | |
@@ -2103,9 +2103,9 @@ discard block |
||
2103 | 2103 | */ |
2104 | 2104 | public static function TBILLYIELD($settlement, $maturity, $price) |
2105 | 2105 | { |
2106 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2107 | - $maturity = Functions::flattenSingleValue($maturity); |
|
2108 | - $price = Functions::flattenSingleValue($price); |
|
2106 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2107 | + $maturity = Functions::flattenSingleValue($maturity); |
|
2108 | + $price = Functions::flattenSingleValue($price); |
|
2109 | 2109 | |
2110 | 2110 | // Validate |
2111 | 2111 | if (is_numeric($price)) { |
@@ -2216,7 +2216,7 @@ discard block |
||
2216 | 2216 | if ((!is_array($values)) || (!is_array($dates))) { |
2217 | 2217 | return Functions::VALUE(); |
2218 | 2218 | } |
2219 | - $values = Functions::flattenArray($values); |
|
2219 | + $values = Functions::flattenArray($values); |
|
2220 | 2220 | $dates = Functions::flattenArray($dates); |
2221 | 2221 | $valCount = count($values); |
2222 | 2222 | if ($valCount != count($dates)) { |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0) |
2260 | 2260 | { |
2261 | 2261 | $settlement = Functions::flattenSingleValue($settlement); |
2262 | - $maturity = Functions::flattenSingleValue($maturity); |
|
2262 | + $maturity = Functions::flattenSingleValue($maturity); |
|
2263 | 2263 | $price = Functions::flattenSingleValue($price); |
2264 | 2264 | $redemption = Functions::flattenSingleValue($redemption); |
2265 | 2265 | $basis = (int) Functions::flattenSingleValue($basis); |
@@ -2308,7 +2308,7 @@ discard block |
||
2308 | 2308 | */ |
2309 | 2309 | public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0) |
2310 | 2310 | { |
2311 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2311 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2312 | 2312 | $maturity = Functions::flattenSingleValue($maturity); |
2313 | 2313 | $issue = Functions::flattenSingleValue($issue); |
2314 | 2314 | $rate = Functions::flattenSingleValue($rate); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * Get Token |
117 | 117 | * |
118 | 118 | * @param int $pId Token id |
119 | - * @return string |
|
119 | + * @return FormulaToken |
|
120 | 120 | * @throws Exception |
121 | 121 | */ |
122 | 122 | public function getToken($pId = 0) |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | /** |
132 | 132 | * Get Token count |
133 | 133 | * |
134 | - * @return string |
|
134 | + * @return integer |
|
135 | 135 | */ |
136 | 136 | public function getTokenCount() |
137 | 137 | { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || |
501 | 501 | (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || |
502 | 502 | ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) |
503 | - ) ) { |
|
503 | + ) ) { |
|
504 | 504 | continue; |
505 | 505 | } |
506 | 506 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || |
513 | 513 | (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || |
514 | 514 | ($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) |
515 | - ) ) { |
|
515 | + ) ) { |
|
516 | 516 | continue; |
517 | 517 | } |
518 | 518 |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | const COMMA = ','; |
66 | 66 | const ERROR_START = '#'; |
67 | 67 | |
68 | - const OPERATORS_SN = "+-"; |
|
69 | - const OPERATORS_INFIX = "+-*/^&=><"; |
|
70 | - const OPERATORS_POSTFIX = "%"; |
|
68 | + const OPERATORS_SN = "+-"; |
|
69 | + const OPERATORS_INFIX = "+-*/^&=><"; |
|
70 | + const OPERATORS_POSTFIX = "%"; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Formula |
@@ -163,15 +163,15 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | // Helper variables |
166 | - $tokens1 = $tokens2 = $stack = array(); |
|
167 | - $inString = $inPath = $inRange = $inError = false; |
|
168 | - $token = $previousToken = $nextToken = null; |
|
166 | + $tokens1 = $tokens2 = $stack = array(); |
|
167 | + $inString = $inPath = $inRange = $inError = false; |
|
168 | + $token = $previousToken = $nextToken = null; |
|
169 | 169 | |
170 | 170 | $index = 1; |
171 | 171 | $value = ''; |
172 | 172 | |
173 | - $ERRORS = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"); |
|
174 | - $COMPARATORS_MULTI = array(">=", "<=", "<>"); |
|
173 | + $ERRORS = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A"); |
|
174 | + $COMPARATORS_MULTI = array(">=", "<=", "<>"); |
|
175 | 175 | |
176 | 176 | while ($index < $formulaLength) { |
177 | 177 | // state-dependent character evaluation (order is important) |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | // standard infix operators |
387 | 387 | if (strpos(self::OPERATORS_INFIX, $this->formula{$index}) !== false) { |
388 | 388 | if (strlen($value) > 0) { |
389 | - $tokens1[] =new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); |
|
389 | + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); |
|
390 | 390 | $value = ""; |
391 | 391 | } |
392 | 392 | $tokens1[] = new FormulaToken($this->formula{$index}, FormulaToken::TOKEN_TYPE_OPERATORINFIX); |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | continue; |
497 | 497 | } |
498 | 498 | |
499 | - if (! ( |
|
499 | + if (!( |
|
500 | 500 | (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || |
501 | 501 | (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || |
502 | 502 | ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) |
503 | - ) ) { |
|
503 | + )) { |
|
504 | 504 | continue; |
505 | 505 | } |
506 | 506 | |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | continue; |
509 | 509 | } |
510 | 510 | |
511 | - if (! ( |
|
511 | + if (!( |
|
512 | 512 | (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || |
513 | 513 | (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || |
514 | 514 | ($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) |
515 | - ) ) { |
|
515 | + )) { |
|
516 | 516 | continue; |
517 | 517 | } |
518 | 518 |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * IS_EVEN |
419 | 419 | * |
420 | 420 | * @param mixed $value Value to check |
421 | - * @return boolean |
|
421 | + * @return string|boolean |
|
422 | 422 | */ |
423 | 423 | public static function isEven($value = null) |
424 | 424 | { |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * IS_ODD |
439 | 439 | * |
440 | 440 | * @param mixed $value Value to check |
441 | - * @return boolean |
|
441 | + * @return string|boolean |
|
442 | 442 | */ |
443 | 443 | public static function isOdd($value = null) |
444 | 444 | { |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | case 'integer': |
550 | 550 | return $value; |
551 | 551 | case 'boolean': |
552 | - return (integer)$value; |
|
552 | + return (integer) $value; |
|
553 | 553 | case 'string': |
554 | 554 | // Errors |
555 | 555 | if ((strlen($value) > 0) && ($value{0} == '#')) { |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | public static function flattenArray($array) |
621 | 621 | { |
622 | 622 | if (!is_array($array)) { |
623 | - return (array)$array; |
|
623 | + return (array) $array; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | $arrayValues = array(); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | public static function flattenArrayIndexed($array) |
654 | 654 | { |
655 | 655 | if (!is_array($array)) { |
656 | - return (array)$array; |
|
656 | + return (array) $array; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | $arrayValues = array(); |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | return $ret; |
739 | 739 | } |
740 | 740 | |
741 | - foreach ((array)$search as $key => $s) { |
|
741 | + foreach ((array) $search as $key => $s) { |
|
742 | 742 | if ($s == '' && $s !== 0) { |
743 | 743 | continue; |
744 | 744 | } |
@@ -83,8 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @access public |
85 | 85 | * @category Logical Functions |
86 | - * @param mixed $arg,... Data values |
|
87 | - * @return boolean The logical AND of the arguments. |
|
86 | + * @return string|boolean The logical AND of the arguments. |
|
88 | 87 | */ |
89 | 88 | public static function logicalAnd() |
90 | 89 | { |
@@ -139,8 +138,7 @@ discard block |
||
139 | 138 | * |
140 | 139 | * @access public |
141 | 140 | * @category Logical Functions |
142 | - * @param mixed $arg,... Data values |
|
143 | - * @return boolean The logical OR of the arguments. |
|
141 | + * @return string|boolean The logical OR of the arguments. |
|
144 | 142 | */ |
145 | 143 | public static function logicalOr() |
146 | 144 | { |
@@ -195,7 +193,7 @@ discard block |
||
195 | 193 | * @access public |
196 | 194 | * @category Logical Functions |
197 | 195 | * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE |
198 | - * @return boolean The boolean inverse of the argument. |
|
196 | + * @return boolean|string The boolean inverse of the argument. |
|
199 | 197 | */ |
200 | 198 | public static function NOT($logical = false) |
201 | 199 | { |
@@ -241,8 +239,8 @@ discard block |
||
241 | 239 | * |
242 | 240 | * @access public |
243 | 241 | * @category Logical Functions |
244 | - * @param mixed $condition Condition to evaluate |
|
245 | - * @param mixed $returnIfTrue Value to return when condition is true |
|
242 | + * @param boolean $condition Condition to evaluate |
|
243 | + * @param integer $returnIfTrue Value to return when condition is true |
|
246 | 244 | * @param mixed $returnIfFalse Optional value to return when condition is false |
247 | 245 | * @return mixed The value of returnIfTrue or returnIfFalse determined by condition |
248 | 246 | */ |
@@ -248,8 +248,8 @@ |
||
248 | 248 | */ |
249 | 249 | public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false) |
250 | 250 | { |
251 | - $condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition); |
|
252 | - $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue); |
|
251 | + $condition = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition); |
|
252 | + $returnIfTrue = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue); |
|
253 | 253 | $returnIfFalse = (is_null($returnIfFalse)) ? false : Functions::flattenSingleValue($returnIfFalse); |
254 | 254 | |
255 | 255 | return ($condition) ? $returnIfTrue : $returnIfFalse; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param row Row number to use in the cell reference |
41 | 41 | * @param column Column number to use in the cell reference |
42 | - * @param relativity Flag indicating the type of reference to return |
|
42 | + * @param relativity integer indicating the type of reference to return |
|
43 | 43 | * 1 or omitted Absolute |
44 | 44 | * 2 Absolute row; relative column |
45 | 45 | * 3 Relative row; absolute column |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @param cellAddress The reference from which you want to base the offset. Reference must refer to a cell or |
354 | 354 | * range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value. |
355 | - * @param rows The number of rows, up or down, that you want the upper-left cell to refer to. |
|
355 | + * @param rows integer number of rows, up or down, that you want the upper-left cell to refer to. |
|
356 | 356 | * Using 5 as the rows argument specifies that the upper-left cell in the reference is |
357 | 357 | * five rows below reference. Rows can be positive (which means below the starting reference) |
358 | 358 | * or negative (which means above the starting reference). |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @param lookup_value The value that you want to match in lookup_array |
492 | 492 | * @param lookup_array The range of cells being searched |
493 | - * @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. |
|
493 | + * @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. |
|
494 | 494 | * @return integer The relative position of the found item |
495 | 495 | */ |
496 | 496 | public static function MATCH($lookup_value, $lookup_array, $match_type = 1) |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | * 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. |
681 | 681 | * @param lookup_value The value that you want to match in lookup_array |
682 | 682 | * @param lookup_array The range of cells being searched |
683 | - * @param index_number The column number in table_array from which the matching value must be returned. The first column is 1. |
|
683 | + * @param index_number integer column number in table_array from which the matching value must be returned. The first column is 1. |
|
684 | 684 | * @param not_exact_match Determines if you are looking for an exact match based on lookup_value. |
685 | 685 | * @return mixed The value of the found cell |
686 | 686 | */ |
@@ -60,28 +60,28 @@ discard block |
||
60 | 60 | |
61 | 61 | if ($sheetText > '') { |
62 | 62 | if (strpos($sheetText, ' ') !== false) { |
63 | - $sheetText = "'".$sheetText."'"; |
|
63 | + $sheetText = "'" . $sheetText . "'"; |
|
64 | 64 | } |
65 | - $sheetText .='!'; |
|
65 | + $sheetText .= '!'; |
|
66 | 66 | } |
67 | 67 | if ((!is_bool($referenceStyle)) || $referenceStyle) { |
68 | 68 | $rowRelative = $columnRelative = '$'; |
69 | - $column = \PhpSpreadsheet\Cell::stringFromColumnIndex($column-1); |
|
69 | + $column = \PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1); |
|
70 | 70 | if (($relativity == 2) || ($relativity == 4)) { |
71 | 71 | $columnRelative = ''; |
72 | 72 | } |
73 | 73 | if (($relativity == 3) || ($relativity == 4)) { |
74 | 74 | $rowRelative = ''; |
75 | 75 | } |
76 | - return $sheetText.$columnRelative.$column.$rowRelative.$row; |
|
76 | + return $sheetText . $columnRelative . $column . $rowRelative . $row; |
|
77 | 77 | } else { |
78 | 78 | if (($relativity == 2) || ($relativity == 4)) { |
79 | - $column = '['.$column.']'; |
|
79 | + $column = '[' . $column . ']'; |
|
80 | 80 | } |
81 | 81 | if (($relativity == 3) || ($relativity == 4)) { |
82 | - $row = '['.$row.']'; |
|
82 | + $row = '[' . $row . ']'; |
|
83 | 83 | } |
84 | - return $sheetText.'R'.$row.'C'.$column; |
|
84 | + return $sheetText . 'R' . $row . 'C' . $column; |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $args = func_get_args(); |
260 | 260 | $pCell = array_pop($args); |
261 | 261 | |
262 | - $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); |
|
262 | + $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); |
|
263 | 263 | $displayName = (is_null($displayName)) ? '' : Functions::flattenSingleValue($displayName); |
264 | 264 | |
265 | 265 | if ((!is_object($pCell)) || (trim($linkURL) == '')) { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public static function INDIRECT($cellAddress = null, \PhpSpreadsheet\Cell $pCell = null) |
299 | 299 | { |
300 | - $cellAddress = Functions::flattenSingleValue($cellAddress); |
|
300 | + $cellAddress = Functions::flattenSingleValue($cellAddress); |
|
301 | 301 | if (is_null($cellAddress) || $cellAddress === '') { |
302 | 302 | return Functions::REF(); |
303 | 303 | } |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | list($cellAddress1, $cellAddress2) = explode(':', $cellAddress); |
309 | 309 | } |
310 | 310 | |
311 | - if ((!preg_match('/^'.\PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || |
|
312 | - ((!is_null($cellAddress2)) && (!preg_match('/^'.\PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { |
|
313 | - if (!preg_match('/^'.\PhpSpreadsheet\Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { |
|
311 | + if ((!preg_match('/^' . \PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) || |
|
312 | + ((!is_null($cellAddress2)) && (!preg_match('/^' . \PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress2, $matches)))) { |
|
313 | + if (!preg_match('/^' . \PhpSpreadsheet\Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $cellAddress1, $matches)) { |
|
314 | 314 | return Functions::REF(); |
315 | 315 | } |
316 | 316 | |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | } |
418 | 418 | $endCellColumn = \PhpSpreadsheet\Cell::stringFromColumnIndex($endCellColumn); |
419 | 419 | |
420 | - $cellAddress = $startCellColumn.$startCellRow; |
|
420 | + $cellAddress = $startCellColumn . $startCellRow; |
|
421 | 421 | if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) { |
422 | - $cellAddress .= ':'.$endCellColumn.$endCellRow; |
|
422 | + $cellAddress .= ':' . $endCellColumn . $endCellRow; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | if ($sheetName !== null) { |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | { |
495 | 495 | $lookup_array = Functions::flattenArray($lookup_array); |
496 | 496 | $lookup_value = Functions::flattenSingleValue($lookup_value); |
497 | - $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type); |
|
497 | + $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type); |
|
498 | 498 | // MATCH is not case sensitive |
499 | 499 | $lookup_value = strtolower($lookup_value); |
500 | 500 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $lookup_array[$i] = strtolower($lookupArrayValue); |
527 | 527 | } |
528 | 528 | if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) { |
529 | - $lookup_array = array_slice($lookup_array, 0, $i-1); |
|
529 | + $lookup_array = array_slice($lookup_array, 0, $i - 1); |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | break; |
555 | 555 | } else { |
556 | 556 | // the previous cell was the match |
557 | - return $keySet[$i-1]+1; |
|
557 | + return $keySet[$i - 1] + 1; |
|
558 | 558 | } |
559 | 559 | } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) { |
560 | 560 | $i = array_search($i, $keySet); |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | break; |
565 | 565 | } else { |
566 | 566 | // the previous cell was the match |
567 | - return $keySet[$i-1]+1; |
|
567 | + return $keySet[$i - 1] + 1; |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | { |
753 | 753 | $lookup_value = Functions::flattenSingleValue($lookup_value); |
754 | 754 | $index_number = Functions::flattenSingleValue($index_number); |
755 | - $not_exact_match = Functions::flattenSingleValue($not_exact_match); |
|
755 | + $not_exact_match = Functions::flattenSingleValue($not_exact_match); |
|
756 | 756 | |
757 | 757 | // index_number must be greater than or equal to 1 |
758 | 758 | if ($index_number < 1) { |