@@ -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 | { |
@@ -174,7 +174,7 @@ |
||
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | - $cacheStorageClass = '\\PHPExcel\\CachedObjectStorage\\'.$method; |
|
177 | + $cacheStorageClass = '\\PHPExcel\\CachedObjectStorage\\' . $method; |
|
178 | 178 | if (!call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) { |
179 | 179 | return false; |
180 | 180 | } |
@@ -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 |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | 'NULL' => null |
263 | 263 | ); |
264 | 264 | |
265 | - // PHPExcel functions |
|
265 | + // PHPExcel functions |
|
266 | 266 | private static $PHPExcelFunctions = array( |
267 | 267 | 'ABS' => array( |
268 | 268 | 'category' => Calculation\Categories::CATEGORY_MATH_AND_TRIG, |
@@ -3137,13 +3137,13 @@ discard block |
||
3137 | 3137 | $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; |
3138 | 3138 | |
3139 | 3139 | $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. |
3140 | - '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3141 | - '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3142 | - '|'.self::CALCULATION_REGEXP_STRING. |
|
3143 | - '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3144 | - '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3145 | - '|'.self::CALCULATION_REGEXP_ERROR. |
|
3146 | - ')/si'; |
|
3140 | + '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3141 | + '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3142 | + '|'.self::CALCULATION_REGEXP_STRING. |
|
3143 | + '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3144 | + '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3145 | + '|'.self::CALCULATION_REGEXP_ERROR. |
|
3146 | + ')/si'; |
|
3147 | 3147 | |
3148 | 3148 | // Start with initialisation |
3149 | 3149 | $index = 0; |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | // String operand |
52 | 52 | const CALCULATION_REGEXP_STRING = '"(?:[^"]|"")*"'; |
53 | 53 | // Opening bracket |
54 | - const CALCULATION_REGEXP_OPENBRACE = '\('; |
|
54 | + const CALCULATION_REGEXP_OPENBRACE = '\('; |
|
55 | 55 | // Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it) |
56 | - const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\('; |
|
56 | + const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\('; |
|
57 | 57 | // Cell reference (cell or range of cells, with or without a sheet reference) |
58 | - const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF; |
|
58 | + const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF; |
|
59 | 59 | // Named Range of cells |
60 | - const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE; |
|
60 | + const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE; |
|
61 | 61 | // Error |
62 | - const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; |
|
62 | + const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; |
|
63 | 63 | |
64 | 64 | |
65 | 65 | /** constants */ |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @access private |
102 | 102 | * @var array |
103 | 103 | */ |
104 | - private $calculationCache = array (); |
|
104 | + private $calculationCache = array(); |
|
105 | 105 | |
106 | 106 | |
107 | 107 | /** |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * @var array |
122 | 122 | */ |
123 | 123 | private static $operators = array( |
124 | - '+' => true, '-' => true, '*' => true, '/' => true, |
|
125 | - '^' => true, '&' => true, '%' => false, '~' => false, |
|
126 | - '>' => true, '<' => true, '=' => true, '>=' => true, |
|
127 | - '<=' => true, '<>' => true, '|' => true, ':' => true |
|
124 | + '+' => true, '-' => true, '*' => true, '/' => true, |
|
125 | + '^' => true, '&' => true, '%' => false, '~' => false, |
|
126 | + '>' => true, '<' => true, '=' => true, '>=' => true, |
|
127 | + '<=' => true, '<>' => true, '|' => true, ':' => true |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | /** |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @var array |
135 | 135 | */ |
136 | 136 | private static $binaryOperators = array( |
137 | - '+' => true, '-' => true, '*' => true, '/' => true, |
|
138 | - '^' => true, '&' => true, '>' => true, '<' => true, |
|
139 | - '=' => true, '>=' => true, '<=' => true, '<>' => true, |
|
140 | - '|' => true, ':' => true |
|
137 | + '+' => true, '-' => true, '*' => true, '/' => true, |
|
138 | + '^' => true, '&' => true, '>' => true, '<' => true, |
|
139 | + '=' => true, '>=' => true, '<=' => true, '<>' => true, |
|
140 | + '|' => true, ':' => true |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @var float |
207 | 207 | * |
208 | 208 | */ |
209 | - private $delta = 0.1e-12; |
|
209 | + private $delta = 0.1e-12; |
|
210 | 210 | |
211 | 211 | |
212 | 212 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @var string |
216 | 216 | * |
217 | 217 | */ |
218 | - private static $localeLanguage = 'en_us'; // US English (default locale) |
|
218 | + private static $localeLanguage = 'en_us'; // US English (default locale) |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * List of available locale settings |
@@ -2073,9 +2073,9 @@ discard block |
||
2073 | 2073 | |
2074 | 2074 | private static function loadLocales() |
2075 | 2075 | { |
2076 | - $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; |
|
2077 | - foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) { |
|
2078 | - $filename = substr($filename, strlen($localeFileDirectory)+1); |
|
2076 | + $localeFileDirectory = PHPEXCEL_ROOT . 'PHPExcel/locale/'; |
|
2077 | + foreach (glob($localeFileDirectory . '/*', GLOB_ONLYDIR) as $filename) { |
|
2078 | + $filename = substr($filename, strlen($localeFileDirectory) + 1); |
|
2079 | 2079 | if ($filename != 'en') { |
2080 | 2080 | self::$validLocaleLanguages[] = $filename; |
2081 | 2081 | } |
@@ -2320,10 +2320,10 @@ discard block |
||
2320 | 2320 | // Default is English, if user isn't requesting english, then read the necessary data from the locale files |
2321 | 2321 | if ($locale != 'en_us') { |
2322 | 2322 | // Search for a file with a list of function names for locale |
2323 | - $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions'; |
|
2323 | + $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions'; |
|
2324 | 2324 | if (!file_exists($functionNamesFile)) { |
2325 | 2325 | // If there isn't a locale specific function file, look for a language specific function file |
2326 | - $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions'; |
|
2326 | + $functionNamesFile = PHPEXCEL_ROOT . 'PHPExcel' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . 'functions'; |
|
2327 | 2327 | if (!file_exists($functionNamesFile)) { |
2328 | 2328 | return false; |
2329 | 2329 | } |
@@ -2331,7 +2331,7 @@ discard block |
||
2331 | 2331 | // Retrieve the list of locale or language specific function names |
2332 | 2332 | $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
2333 | 2333 | foreach ($localeFunctions as $localeFunction) { |
2334 | - list($localeFunction) = explode('##', $localeFunction); // Strip out comments |
|
2334 | + list($localeFunction) = explode('##', $localeFunction); // Strip out comments |
|
2335 | 2335 | if (strpos($localeFunction, '=') !== false) { |
2336 | 2336 | list($fName, $lfName) = explode('=', $localeFunction); |
2337 | 2337 | $fName = trim($fName); |
@@ -2349,14 +2349,14 @@ discard block |
||
2349 | 2349 | self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE']; |
2350 | 2350 | } |
2351 | 2351 | |
2352 | - $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config'; |
|
2352 | + $configFile = PHPEXCEL_ROOT . 'PHPExcel' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config'; |
|
2353 | 2353 | if (!file_exists($configFile)) { |
2354 | - $configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config'; |
|
2354 | + $configFile = PHPEXCEL_ROOT . 'PHPExcel' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . 'config'; |
|
2355 | 2355 | } |
2356 | 2356 | if (file_exists($configFile)) { |
2357 | 2357 | $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
2358 | 2358 | foreach ($localeSettings as $localeSetting) { |
2359 | - list($localeSetting) = explode('##', $localeSetting); // Strip out comments |
|
2359 | + list($localeSetting) = explode('##', $localeSetting); // Strip out comments |
|
2360 | 2360 | if (strpos($localeSetting, '=') !== false) { |
2361 | 2361 | list($settingName, $settingValue) = explode('=', $localeSetting); |
2362 | 2362 | $settingName = strtoupper(trim($settingName)); |
@@ -2394,7 +2394,7 @@ discard block |
||
2394 | 2394 | break; |
2395 | 2395 | case $fromSeparator: |
2396 | 2396 | if (!$inBraces) { |
2397 | - $formula = mb_substr($formula, 0, $i).$toSeparator.mb_substr($formula, $i+1); |
|
2397 | + $formula = mb_substr($formula, 0, $i) . $toSeparator . mb_substr($formula, $i + 1); |
|
2398 | 2398 | } |
2399 | 2399 | } |
2400 | 2400 | } |
@@ -2440,20 +2440,20 @@ discard block |
||
2440 | 2440 | if (self::$functionReplaceFromExcel === null) { |
2441 | 2441 | self::$functionReplaceFromExcel = array(); |
2442 | 2442 | foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { |
2443 | - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui'; |
|
2443 | + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName) . '([\s]*\()/Ui'; |
|
2444 | 2444 | } |
2445 | 2445 | foreach (array_keys(self::$localeBoolean) as $excelBoolean) { |
2446 | - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; |
|
2446 | + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean) . '([^\w\.])/Ui'; |
|
2447 | 2447 | } |
2448 | 2448 | } |
2449 | 2449 | |
2450 | 2450 | if (self::$functionReplaceToLocale === null) { |
2451 | 2451 | self::$functionReplaceToLocale = array(); |
2452 | 2452 | foreach (array_values(self::$localeFunctions) as $localeFunctionName) { |
2453 | - self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2'; |
|
2453 | + self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2'; |
|
2454 | 2454 | } |
2455 | 2455 | foreach (array_values(self::$localeBoolean) as $localeBoolean) { |
2456 | - self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2'; |
|
2456 | + self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2'; |
|
2457 | 2457 | } |
2458 | 2458 | } |
2459 | 2459 | |
@@ -2469,20 +2469,20 @@ discard block |
||
2469 | 2469 | if (self::$functionReplaceFromLocale === null) { |
2470 | 2470 | self::$functionReplaceFromLocale = array(); |
2471 | 2471 | foreach (array_values(self::$localeFunctions) as $localeFunctionName) { |
2472 | - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui'; |
|
2472 | + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName) . '([\s]*\()/Ui'; |
|
2473 | 2473 | } |
2474 | 2474 | foreach (array_values(self::$localeBoolean) as $excelBoolean) { |
2475 | - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; |
|
2475 | + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean) . '([^\w\.])/Ui'; |
|
2476 | 2476 | } |
2477 | 2477 | } |
2478 | 2478 | |
2479 | 2479 | if (self::$functionReplaceToExcel === null) { |
2480 | 2480 | self::$functionReplaceToExcel = array(); |
2481 | 2481 | foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { |
2482 | - self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2'; |
|
2482 | + self::$functionReplaceToExcel[] = '$1' . trim($excelFunctionName) . '$2'; |
|
2483 | 2483 | } |
2484 | 2484 | foreach (array_keys(self::$localeBoolean) as $excelBoolean) { |
2485 | - self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2'; |
|
2485 | + self::$functionReplaceToExcel[] = '$1' . trim($excelBoolean) . '$2'; |
|
2486 | 2486 | } |
2487 | 2487 | } |
2488 | 2488 | |
@@ -2518,12 +2518,12 @@ discard block |
||
2518 | 2518 | { |
2519 | 2519 | if (is_string($value)) { |
2520 | 2520 | // Error values cannot be "wrapped" |
2521 | - if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i', $value, $match)) { |
|
2521 | + if (preg_match('/^' . self::CALCULATION_REGEXP_ERROR . '$/i', $value, $match)) { |
|
2522 | 2522 | // Return Excel errors "as is" |
2523 | 2523 | return $value; |
2524 | 2524 | } |
2525 | 2525 | // Return strings wrapped in quotes |
2526 | - return '"'.$value.'"'; |
|
2526 | + return '"' . $value . '"'; |
|
2527 | 2527 | // Convert numeric errors to NaN error |
2528 | 2528 | } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { |
2529 | 2529 | return Calculation\Functions::NAN(); |
@@ -2843,7 +2843,7 @@ discard block |
||
2843 | 2843 | // Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller |
2844 | 2844 | self::resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); |
2845 | 2845 | } |
2846 | - return array( $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); |
|
2846 | + return array($matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); |
|
2847 | 2847 | } |
2848 | 2848 | |
2849 | 2849 | |
@@ -2929,14 +2929,14 @@ discard block |
||
2929 | 2929 | if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { |
2930 | 2930 | if ($matrix2Columns < $matrix1Columns) { |
2931 | 2931 | for ($i = 0; $i < $matrix2Rows; ++$i) { |
2932 | - $x = $matrix2[$i][$matrix2Columns-1]; |
|
2932 | + $x = $matrix2[$i][$matrix2Columns - 1]; |
|
2933 | 2933 | for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { |
2934 | 2934 | $matrix2[$i][$j] = $x; |
2935 | 2935 | } |
2936 | 2936 | } |
2937 | 2937 | } |
2938 | 2938 | if ($matrix2Rows < $matrix1Rows) { |
2939 | - $x = $matrix2[$matrix2Rows-1]; |
|
2939 | + $x = $matrix2[$matrix2Rows - 1]; |
|
2940 | 2940 | for ($i = 0; $i < $matrix1Rows; ++$i) { |
2941 | 2941 | $matrix2[$i] = $x; |
2942 | 2942 | } |
@@ -2946,14 +2946,14 @@ discard block |
||
2946 | 2946 | if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { |
2947 | 2947 | if ($matrix1Columns < $matrix2Columns) { |
2948 | 2948 | for ($i = 0; $i < $matrix1Rows; ++$i) { |
2949 | - $x = $matrix1[$i][$matrix1Columns-1]; |
|
2949 | + $x = $matrix1[$i][$matrix1Columns - 1]; |
|
2950 | 2950 | for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { |
2951 | 2951 | $matrix1[$i][$j] = $x; |
2952 | 2952 | } |
2953 | 2953 | } |
2954 | 2954 | } |
2955 | 2955 | if ($matrix1Rows < $matrix2Rows) { |
2956 | - $x = $matrix1[$matrix1Rows-1]; |
|
2956 | + $x = $matrix1[$matrix1Rows - 1]; |
|
2957 | 2957 | for ($i = 0; $i < $matrix2Rows; ++$i) { |
2958 | 2958 | $matrix1[$i] = $x; |
2959 | 2959 | } |
@@ -2987,9 +2987,9 @@ discard block |
||
2987 | 2987 | $returnMatrix[] = $this->showValue($row); |
2988 | 2988 | } |
2989 | 2989 | } |
2990 | - return '{ '.implode($rpad, $returnMatrix).' }'; |
|
2990 | + return '{ ' . implode($rpad, $returnMatrix) . ' }'; |
|
2991 | 2991 | } elseif (is_string($value) && (trim($value, '"') == $value)) { |
2992 | - return '"'.$value.'"'; |
|
2992 | + return '"' . $value . '"'; |
|
2993 | 2993 | } elseif (is_bool($value)) { |
2994 | 2994 | return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; |
2995 | 2995 | } |
@@ -3026,12 +3026,12 @@ discard block |
||
3026 | 3026 | if ($value == '') { |
3027 | 3027 | return 'an empty string'; |
3028 | 3028 | } elseif ($value{0} == '#') { |
3029 | - return 'a '.$value.' error'; |
|
3029 | + return 'a ' . $value . ' error'; |
|
3030 | 3030 | } else { |
3031 | 3031 | $typeString = 'a string'; |
3032 | 3032 | } |
3033 | 3033 | } |
3034 | - return $typeString.' with a value of '.$this->showValue($value); |
|
3034 | + return $typeString . ' with a value of ' . $this->showValue($value); |
|
3035 | 3035 | } |
3036 | 3036 | } |
3037 | 3037 | |
@@ -3097,31 +3097,31 @@ discard block |
||
3097 | 3097 | // Binary Operators |
3098 | 3098 | // These operators always work on two values |
3099 | 3099 | // Array key is the operator, the value indicates whether this is a left or right associative operator |
3100 | - private static $operatorAssociativity = array( |
|
3101 | - '^' => 0, // Exponentiation |
|
3102 | - '*' => 0, '/' => 0, // Multiplication and Division |
|
3103 | - '+' => 0, '-' => 0, // Addition and Subtraction |
|
3104 | - '&' => 0, // Concatenation |
|
3105 | - '|' => 0, ':' => 0, // Intersect and Range |
|
3100 | + private static $operatorAssociativity = array( |
|
3101 | + '^' => 0, // Exponentiation |
|
3102 | + '*' => 0, '/' => 0, // Multiplication and Division |
|
3103 | + '+' => 0, '-' => 0, // Addition and Subtraction |
|
3104 | + '&' => 0, // Concatenation |
|
3105 | + '|' => 0, ':' => 0, // Intersect and Range |
|
3106 | 3106 | '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison |
3107 | 3107 | ); |
3108 | 3108 | |
3109 | 3109 | // Comparison (Boolean) Operators |
3110 | 3110 | // These operators work on two values, but always return a boolean result |
3111 | - private static $comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true); |
|
3111 | + private static $comparisonOperators = array('>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true); |
|
3112 | 3112 | |
3113 | 3113 | // Operator Precedence |
3114 | 3114 | // This list includes all valid operators, whether binary (including boolean) or unary (such as %) |
3115 | 3115 | // Array key is the operator, the value is its precedence |
3116 | - private static $operatorPrecedence = array( |
|
3117 | - ':' => 8, // Range |
|
3118 | - '|' => 7, // Intersect |
|
3119 | - '~' => 6, // Negation |
|
3120 | - '%' => 5, // Percentage |
|
3121 | - '^' => 4, // Exponentiation |
|
3122 | - '*' => 3, '/' => 3, // Multiplication and Division |
|
3123 | - '+' => 2, '-' => 2, // Addition and Subtraction |
|
3124 | - '&' => 1, // Concatenation |
|
3116 | + private static $operatorPrecedence = array( |
|
3117 | + ':' => 8, // Range |
|
3118 | + '|' => 7, // Intersect |
|
3119 | + '~' => 6, // Negation |
|
3120 | + '%' => 5, // Percentage |
|
3121 | + '^' => 4, // Exponentiation |
|
3122 | + '*' => 3, '/' => 3, // Multiplication and Division |
|
3123 | + '+' => 2, '-' => 2, // Addition and Subtraction |
|
3124 | + '&' => 1, // Concatenation |
|
3125 | 3125 | '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0 // Comparison |
3126 | 3126 | ); |
3127 | 3127 | |
@@ -3136,22 +3136,22 @@ discard block |
||
3136 | 3136 | // so we store the parent worksheet so that we can re-attach it when necessary |
3137 | 3137 | $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; |
3138 | 3138 | |
3139 | - $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. |
|
3140 | - '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3141 | - '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3142 | - '|'.self::CALCULATION_REGEXP_STRING. |
|
3143 | - '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3144 | - '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3145 | - '|'.self::CALCULATION_REGEXP_ERROR. |
|
3139 | + $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_FUNCTION . |
|
3140 | + '|' . self::CALCULATION_REGEXP_CELLREF . |
|
3141 | + '|' . self::CALCULATION_REGEXP_NUMBER . |
|
3142 | + '|' . self::CALCULATION_REGEXP_STRING . |
|
3143 | + '|' . self::CALCULATION_REGEXP_OPENBRACE . |
|
3144 | + '|' . self::CALCULATION_REGEXP_NAMEDRANGE . |
|
3145 | + '|' . self::CALCULATION_REGEXP_ERROR . |
|
3146 | 3146 | ')/si'; |
3147 | 3147 | |
3148 | 3148 | // Start with initialisation |
3149 | 3149 | $index = 0; |
3150 | 3150 | $stack = new Calculation\Token\Stack; |
3151 | 3151 | $output = array(); |
3152 | - $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a |
|
3152 | + $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a |
|
3153 | 3153 | // - is a negation or + is a positive operator rather than an operation |
3154 | - $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand |
|
3154 | + $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand |
|
3155 | 3155 | // should be null in a function call |
3156 | 3156 | // The guts of the lexical parser |
3157 | 3157 | // Loop through the formula extracting each operator and operand in turn |
@@ -3159,7 +3159,7 @@ discard block |
||
3159 | 3159 | //echo 'Assessing Expression '.substr($formula, $index), PHP_EOL; |
3160 | 3160 | $opCharacter = $formula{$index}; // Get the first character of the value at the current index position |
3161 | 3161 | //echo 'Initial character of expression block is '.$opCharacter, PHP_EOL; |
3162 | - if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) { |
|
3162 | + if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index + 1}]))) { |
|
3163 | 3163 | $opCharacter .= $formula{++$index}; |
3164 | 3164 | //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL; |
3165 | 3165 | } |
@@ -3171,26 +3171,26 @@ discard block |
||
3171 | 3171 | |
3172 | 3172 | if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus? |
3173 | 3173 | //echo 'Element is a Negation operator', PHP_EOL; |
3174 | - $stack->push('Unary Operator', '~'); // Put a negation on the stack |
|
3175 | - ++$index; // and drop the negation symbol |
|
3174 | + $stack->push('Unary Operator', '~'); // Put a negation on the stack |
|
3175 | + ++$index; // and drop the negation symbol |
|
3176 | 3176 | } elseif ($opCharacter == '%' && $expectingOperator) { |
3177 | 3177 | //echo 'Element is a Percentage operator', PHP_EOL; |
3178 | - $stack->push('Unary Operator', '%'); // Put a percentage on the stack |
|
3178 | + $stack->push('Unary Operator', '%'); // Put a percentage on the stack |
|
3179 | 3179 | ++$index; |
3180 | 3180 | } elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded? |
3181 | 3181 | //echo 'Element is a Positive number, not Plus operator', PHP_EOL; |
3182 | - ++$index; // Drop the redundant plus symbol |
|
3182 | + ++$index; // Drop the redundant plus symbol |
|
3183 | 3183 | } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal |
3184 | - return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression |
|
3184 | + return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression |
|
3185 | 3185 | } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? |
3186 | 3186 | //echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL; |
3187 | 3187 | while ($stack->count() > 0 && |
3188 | 3188 | ($o2 = $stack->last()) && |
3189 | 3189 | isset(self::$operators[$o2['value']]) && |
3190 | 3190 | @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { |
3191 | - $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3191 | + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3192 | 3192 | } |
3193 | - $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack |
|
3193 | + $stack->push('Binary Operator', $opCharacter); // Finally put our current operator onto the stack |
|
3194 | 3194 | ++$index; |
3195 | 3195 | $expectingOperator = false; |
3196 | 3196 | } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
@@ -3204,11 +3204,11 @@ discard block |
||
3204 | 3204 | } |
3205 | 3205 | } |
3206 | 3206 | $d = $stack->last(2); |
3207 | - if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3208 | - $functionName = $matches[1]; // Get the function name |
|
3207 | + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3208 | + $functionName = $matches[1]; // Get the function name |
|
3209 | 3209 | //echo 'Closed Function is '.$functionName, PHP_EOL; |
3210 | 3210 | $d = $stack->pop(); |
3211 | - $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) |
|
3211 | + $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) |
|
3212 | 3212 | //if ($argumentCount == 0) { |
3213 | 3213 | // echo 'With no arguments', PHP_EOL; |
3214 | 3214 | //} elseif ($argumentCount == 1) { |
@@ -3216,8 +3216,8 @@ discard block |
||
3216 | 3216 | //} else { |
3217 | 3217 | // echo 'With '.$argumentCount.' arguments', PHP_EOL; |
3218 | 3218 | //} |
3219 | - $output[] = $d; // Dump the argument count on the output |
|
3220 | - $output[] = $stack->pop(); // Pop the function and push onto the output |
|
3219 | + $output[] = $d; // Dump the argument count on the output |
|
3220 | + $output[] = $stack->pop(); // Pop the function and push onto the output |
|
3221 | 3221 | if (isset(self::$controlFunctions[$functionName])) { |
3222 | 3222 | //echo 'Built-in function '.$functionName, PHP_EOL; |
3223 | 3223 | $expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount']; |
@@ -3236,7 +3236,7 @@ discard block |
||
3236 | 3236 | //echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount), PHP_EOL; |
3237 | 3237 | if ($argumentCount > abs($expectedArgumentCount)) { |
3238 | 3238 | $argumentCountError = true; |
3239 | - $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount); |
|
3239 | + $expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount); |
|
3240 | 3240 | } |
3241 | 3241 | } else { |
3242 | 3242 | //echo '$expectedArgumentCount is numeric '.$expectedArgumentCount, PHP_EOL; |
@@ -3253,25 +3253,25 @@ discard block |
||
3253 | 3253 | case '+': |
3254 | 3254 | if ($argumentCount < $argMatch[1]) { |
3255 | 3255 | $argumentCountError = true; |
3256 | - $expectedArgumentCountString = $argMatch[1].' or more '; |
|
3256 | + $expectedArgumentCountString = $argMatch[1] . ' or more '; |
|
3257 | 3257 | } |
3258 | 3258 | break; |
3259 | 3259 | case '-': |
3260 | 3260 | if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { |
3261 | 3261 | $argumentCountError = true; |
3262 | - $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3]; |
|
3262 | + $expectedArgumentCountString = 'between ' . $argMatch[1] . ' and ' . $argMatch[3]; |
|
3263 | 3263 | } |
3264 | 3264 | break; |
3265 | 3265 | case ',': |
3266 | 3266 | if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { |
3267 | 3267 | $argumentCountError = true; |
3268 | - $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3]; |
|
3268 | + $expectedArgumentCountString = 'either ' . $argMatch[1] . ' or ' . $argMatch[3]; |
|
3269 | 3269 | } |
3270 | 3270 | break; |
3271 | 3271 | } |
3272 | 3272 | } |
3273 | 3273 | if ($argumentCountError) { |
3274 | - return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString." expected"); |
|
3274 | + return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, " . $expectedArgumentCountString . " expected"); |
|
3275 | 3275 | } |
3276 | 3276 | } |
3277 | 3277 | ++$index; |
@@ -3281,7 +3281,7 @@ discard block |
||
3281 | 3281 | if ($o2 === null) { |
3282 | 3282 | return $this->raiseFormulaError("Formula Error: Unexpected ,"); |
3283 | 3283 | } else { |
3284 | - $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3284 | + $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3285 | 3285 | } |
3286 | 3286 | } |
3287 | 3287 | // If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
@@ -3291,12 +3291,12 @@ discard block |
||
3291 | 3291 | } |
3292 | 3292 | // make sure there was a function |
3293 | 3293 | $d = $stack->last(2); |
3294 | - if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { |
|
3294 | + if (!preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { |
|
3295 | 3295 | return $this->raiseFormulaError("Formula Error: Unexpected ,"); |
3296 | 3296 | } |
3297 | 3297 | $d = $stack->pop(); |
3298 | - $stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count |
|
3299 | - $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again |
|
3298 | + $stack->push($d['type'], ++$d['value'], $d['reference']); // increment the argument count |
|
3299 | + $stack->push('Brace', '('); // put the ( back on, we'll need to pop back to it again |
|
3300 | 3300 | $expectingOperator = false; |
3301 | 3301 | $expectingOperand = true; |
3302 | 3302 | ++$index; |
@@ -3311,24 +3311,24 @@ discard block |
||
3311 | 3311 | $length = strlen($val); |
3312 | 3312 | // echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />'; |
3313 | 3313 | |
3314 | - if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) { |
|
3314 | + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $val, $matches)) { |
|
3315 | 3315 | $val = preg_replace('/\s/u', '', $val); |
3316 | 3316 | // echo 'Element '.$val.' is a Function<br />'; |
3317 | 3317 | if (isset(self::$PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function |
3318 | 3318 | $stack->push('Function', strtoupper($val)); |
3319 | - $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch); |
|
3319 | + $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index + $length), $amatch); |
|
3320 | 3320 | if ($ax) { |
3321 | - $stack->push('Operand Count for Function '.strtoupper($val).')', 0); |
|
3321 | + $stack->push('Operand Count for Function ' . strtoupper($val) . ')', 0); |
|
3322 | 3322 | $expectingOperator = true; |
3323 | 3323 | } else { |
3324 | - $stack->push('Operand Count for Function '.strtoupper($val).')', 1); |
|
3324 | + $stack->push('Operand Count for Function ' . strtoupper($val) . ')', 1); |
|
3325 | 3325 | $expectingOperator = false; |
3326 | 3326 | } |
3327 | 3327 | $stack->push('Brace', '('); |
3328 | 3328 | } else { // it's a var w/ implicit multiplication |
3329 | 3329 | $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => null); |
3330 | 3330 | } |
3331 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) { |
|
3331 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $val, $matches)) { |
|
3332 | 3332 | // echo 'Element '.$val.' is a Cell reference<br />'; |
3333 | 3333 | // Watch for this case-change when modifying to allow cell references in different worksheets... |
3334 | 3334 | // Should only be applied to the actual cell column, not the worksheet name |
@@ -3340,10 +3340,10 @@ discard block |
||
3340 | 3340 | if ($matches[2] == '') { |
3341 | 3341 | // Otherwise, we 'inherit' the worksheet reference from the start cell reference |
3342 | 3342 | // The start of the cell range reference should be the last entry in $output |
3343 | - $startCellRef = $output[count($output)-1]['value']; |
|
3344 | - preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $startCellRef, $startMatches); |
|
3343 | + $startCellRef = $output[count($output) - 1]['value']; |
|
3344 | + preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $startCellRef, $startMatches); |
|
3345 | 3345 | if ($startMatches[2] > '') { |
3346 | - $val = $startMatches[2].'!'.$val; |
|
3346 | + $val = $startMatches[2] . '!' . $val; |
|
3347 | 3347 | } |
3348 | 3348 | } else { |
3349 | 3349 | return $this->raiseFormulaError("3D Range references are not yet supported"); |
@@ -3357,7 +3357,7 @@ discard block |
||
3357 | 3357 | // If the last entry on the stack was a : operator, then we may have a row or column range reference |
3358 | 3358 | $testPrevOp = $stack->last(1); |
3359 | 3359 | if ($testPrevOp['value'] == ':') { |
3360 | - $startRowColRef = $output[count($output)-1]['value']; |
|
3360 | + $startRowColRef = $output[count($output) - 1]['value']; |
|
3361 | 3361 | $rangeWS1 = ''; |
3362 | 3362 | if (strpos('!', $startRowColRef) !== false) { |
3363 | 3363 | list($rangeWS1, $startRowColRef) = explode('!', $startRowColRef); |
@@ -3375,15 +3375,15 @@ discard block |
||
3375 | 3375 | if ((is_integer($startRowColRef)) && (ctype_digit($val)) && |
3376 | 3376 | ($startRowColRef <= 1048576) && ($val <= 1048576)) { |
3377 | 3377 | // Row range |
3378 | - $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 |
|
3379 | - $output[count($output)-1]['value'] = $rangeWS1.'A'.$startRowColRef; |
|
3380 | - $val = $rangeWS2.$endRowColRef.$val; |
|
3378 | + $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 |
|
3379 | + $output[count($output) - 1]['value'] = $rangeWS1 . 'A' . $startRowColRef; |
|
3380 | + $val = $rangeWS2 . $endRowColRef . $val; |
|
3381 | 3381 | } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) && |
3382 | 3382 | (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) { |
3383 | 3383 | // Column range |
3384 | - $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 |
|
3385 | - $output[count($output)-1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1'; |
|
3386 | - $val = $rangeWS2.$val.$endRowColRef; |
|
3384 | + $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 |
|
3385 | + $output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1'; |
|
3386 | + $val = $rangeWS2 . $val . $endRowColRef; |
|
3387 | 3387 | } |
3388 | 3388 | } |
3389 | 3389 | |
@@ -3452,16 +3452,16 @@ discard block |
||
3452 | 3452 | // If we're expecting an operator, but only have a space between the previous and next operands (and both are |
3453 | 3453 | // Cell References) then we have an INTERSECTION operator |
3454 | 3454 | // echo 'Possible Intersect Operator<br />'; |
3455 | - if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) && |
|
3456 | - ($output[count($output)-1]['type'] == 'Cell Reference')) { |
|
3455 | + if (($expectingOperator) && (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) && |
|
3456 | + ($output[count($output) - 1]['type'] == 'Cell Reference')) { |
|
3457 | 3457 | // echo 'Element is an Intersect Operator<br />'; |
3458 | 3458 | while ($stack->count() > 0 && |
3459 | 3459 | ($o2 = $stack->last()) && |
3460 | 3460 | isset(self::$operators[$o2['value']]) && |
3461 | 3461 | @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { |
3462 | - $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3462 | + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output |
|
3463 | 3463 | } |
3464 | - $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack |
|
3464 | + $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack |
|
3465 | 3465 | $expectingOperator = false; |
3466 | 3466 | } |
3467 | 3467 | } |
@@ -3469,7 +3469,7 @@ discard block |
||
3469 | 3469 | |
3470 | 3470 | while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output |
3471 | 3471 | if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { |
3472 | - return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3472 | + return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3473 | 3473 | } |
3474 | 3474 | $output[] = $op; |
3475 | 3475 | } |
@@ -3486,7 +3486,7 @@ discard block |
||
3486 | 3486 | $cKeys = array_keys(array_keys($operand[$rowKey])); |
3487 | 3487 | $colKey = array_shift($cKeys); |
3488 | 3488 | if (ctype_upper($colKey)) { |
3489 | - $operandData['reference'] = $colKey.$rowKey; |
|
3489 | + $operandData['reference'] = $colKey . $rowKey; |
|
3490 | 3490 | } |
3491 | 3491 | } |
3492 | 3492 | return $operand; |
@@ -3559,20 +3559,20 @@ discard block |
||
3559 | 3559 | if ($sheet1 == $sheet2) { |
3560 | 3560 | if ($operand1Data['reference'] === null) { |
3561 | 3561 | if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) { |
3562 | - $operand1Data['reference'] = $pCell->getColumn().$operand1Data['value']; |
|
3562 | + $operand1Data['reference'] = $pCell->getColumn() . $operand1Data['value']; |
|
3563 | 3563 | } elseif (trim($operand1Data['reference']) == '') { |
3564 | 3564 | $operand1Data['reference'] = $pCell->getCoordinate(); |
3565 | 3565 | } else { |
3566 | - $operand1Data['reference'] = $operand1Data['value'].$pCell->getRow(); |
|
3566 | + $operand1Data['reference'] = $operand1Data['value'] . $pCell->getRow(); |
|
3567 | 3567 | } |
3568 | 3568 | } |
3569 | 3569 | if ($operand2Data['reference'] === null) { |
3570 | 3570 | if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) { |
3571 | - $operand2Data['reference'] = $pCell->getColumn().$operand2Data['value']; |
|
3571 | + $operand2Data['reference'] = $pCell->getColumn() . $operand2Data['value']; |
|
3572 | 3572 | } elseif (trim($operand2Data['reference']) == '') { |
3573 | 3573 | $operand2Data['reference'] = $pCell->getCoordinate(); |
3574 | 3574 | } else { |
3575 | - $operand2Data['reference'] = $operand2Data['value'].$pCell->getRow(); |
|
3575 | + $operand2Data['reference'] = $operand2Data['value'] . $pCell->getRow(); |
|
3576 | 3576 | } |
3577 | 3577 | } |
3578 | 3578 | |
@@ -3583,7 +3583,7 @@ discard block |
||
3583 | 3583 | $oCol[] = Cell::columnIndexFromString($oCR[0]) - 1; |
3584 | 3584 | $oRow[] = $oCR[1]; |
3585 | 3585 | } |
3586 | - $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); |
|
3586 | + $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow); |
|
3587 | 3587 | if ($pCellParent !== null) { |
3588 | 3588 | $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($sheet1), false); |
3589 | 3589 | } else { |
@@ -3633,7 +3633,7 @@ discard block |
||
3633 | 3633 | $result = '#VALUE!'; |
3634 | 3634 | } |
3635 | 3635 | } else { |
3636 | - $result = '"'.str_replace('""', '"', self::unwrapResult($operand1, '"').self::unwrapResult($operand2, '"')).'"'; |
|
3636 | + $result = '"' . str_replace('""', '"', self::unwrapResult($operand1, '"') . self::unwrapResult($operand2, '"')) . '"'; |
|
3637 | 3637 | } |
3638 | 3638 | $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); |
3639 | 3639 | $stack->push('Value', $result); |
@@ -3648,7 +3648,7 @@ discard block |
||
3648 | 3648 | $cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]); |
3649 | 3649 | } |
3650 | 3650 | } |
3651 | - $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); |
|
3651 | + $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow); |
|
3652 | 3652 | $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect)); |
3653 | 3653 | $stack->push('Value', $cellIntersect, $cellRef); |
3654 | 3654 | break; |
@@ -3685,7 +3685,7 @@ discard block |
||
3685 | 3685 | } else { |
3686 | 3686 | $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack); |
3687 | 3687 | } |
3688 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { |
|
3688 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) { |
|
3689 | 3689 | $cellRef = null; |
3690 | 3690 | // echo 'Element '.$token.' is a Cell reference<br />'; |
3691 | 3691 | if (isset($matches[8])) { |
@@ -3694,7 +3694,7 @@ discard block |
||
3694 | 3694 | // We can't access the range, so return a REF error |
3695 | 3695 | $cellValue = Calculation\Functions::REF(); |
3696 | 3696 | } else { |
3697 | - $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; |
|
3697 | + $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; |
|
3698 | 3698 | if ($matches[2] > '') { |
3699 | 3699 | $matches[2] = trim($matches[2], "\"'"); |
3700 | 3700 | if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { |
@@ -3728,7 +3728,7 @@ discard block |
||
3728 | 3728 | // We can't access the cell, so return a REF error |
3729 | 3729 | $cellValue = Calculation\Functions::REF(); |
3730 | 3730 | } else { |
3731 | - $cellRef = $matches[6].$matches[7]; |
|
3731 | + $cellRef = $matches[6] . $matches[7]; |
|
3732 | 3732 | if ($matches[2] > '') { |
3733 | 3733 | $matches[2] = trim($matches[2], "\"'"); |
3734 | 3734 | if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { |
@@ -3766,7 +3766,7 @@ discard block |
||
3766 | 3766 | $stack->push('Value', $cellValue, $cellRef); |
3767 | 3767 | |
3768 | 3768 | // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on |
3769 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) { |
|
3769 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) { |
|
3770 | 3770 | // echo 'Token is a function<br />'; |
3771 | 3771 | $functionName = $matches[1]; |
3772 | 3772 | $argCount = $stack->pop(); |
@@ -3823,7 +3823,7 @@ discard block |
||
3823 | 3823 | if ($functionName != 'MKMATRIX') { |
3824 | 3824 | if ($this->_debugLog->getWriteDebugLog()) { |
3825 | 3825 | krsort($argArrayVals); |
3826 | - $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); |
|
3826 | + $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); |
|
3827 | 3827 | } |
3828 | 3828 | } |
3829 | 3829 | // Process each argument in turn, building the return value as an array |
@@ -3878,7 +3878,7 @@ discard block |
||
3878 | 3878 | // echo 'Token is a number, boolean, string, null or an Excel error<br />'; |
3879 | 3879 | $stack->push('Value', $token); |
3880 | 3880 | // if the token is a named range, push the named range name onto the stack |
3881 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) { |
|
3881 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) { |
|
3882 | 3882 | // echo 'Token is a named range<br />'; |
3883 | 3883 | $namedRange = $matches[6]; |
3884 | 3884 | // echo 'Named Range is '.$namedRange.'<br />'; |
@@ -4106,8 +4106,8 @@ discard block |
||
4106 | 4106 | } |
4107 | 4107 | } else { |
4108 | 4108 | if ((Calculation\Functions::getCompatibilityMode() != Calculation\Functions::COMPATIBILITY_OPENOFFICE) && |
4109 | - ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) || |
|
4110 | - (is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) { |
|
4109 | + ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) || |
|
4110 | + (is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0))) { |
|
4111 | 4111 | $result = Calculation\Functions::VALUE(); |
4112 | 4112 | } else { |
4113 | 4113 | // If we're dealing with non-matrix operations, execute the necessary operation |
@@ -4175,7 +4175,7 @@ discard block |
||
4175 | 4175 | public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) |
4176 | 4176 | { |
4177 | 4177 | // Return value |
4178 | - $returnValue = array (); |
|
4178 | + $returnValue = array(); |
|
4179 | 4179 | |
4180 | 4180 | // echo 'extractCellRange('.$pRange.')', PHP_EOL; |
4181 | 4181 | if ($pSheet !== null) { |
@@ -4192,7 +4192,7 @@ discard block |
||
4192 | 4192 | |
4193 | 4193 | // Extract range |
4194 | 4194 | $aReferences = Cell::extractAllCellReferencesInRange($pRange); |
4195 | - $pRange = $pSheetName.'!'.$pRange; |
|
4195 | + $pRange = $pSheetName . '!' . $pRange; |
|
4196 | 4196 | if (!isset($aReferences[1])) { |
4197 | 4197 | // Single cell in range |
4198 | 4198 | sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow); |
@@ -4233,7 +4233,7 @@ discard block |
||
4233 | 4233 | public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) |
4234 | 4234 | { |
4235 | 4235 | // Return value |
4236 | - $returnValue = array (); |
|
4236 | + $returnValue = array(); |
|
4237 | 4237 | |
4238 | 4238 | // echo 'extractNamedRange('.$pRange.')<br />'; |
4239 | 4239 | 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 { |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | |
130 | 130 | $adjustmentMonthsString = (string) $adjustmentMonths; |
131 | 131 | if ($adjustmentMonths > 0) { |
132 | - $adjustmentMonthsString = '+'.$adjustmentMonths; |
|
132 | + $adjustmentMonthsString = '+' . $adjustmentMonths; |
|
133 | 133 | } |
134 | 134 | if ($adjustmentMonths != 0) { |
135 | - $PHPDateObject->modify($adjustmentMonthsString.' months'); |
|
135 | + $PHPDateObject->modify($adjustmentMonthsString . ' months'); |
|
136 | 136 | } |
137 | 137 | $nMonth = (int) $PHPDateObject->format('m'); |
138 | 138 | $nYear = (int) $PHPDateObject->format('Y'); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12); |
141 | 141 | if ($monthDiff != $adjustmentMonths) { |
142 | 142 | $adjustDays = (int) $PHPDateObject->format('d'); |
143 | - $adjustDaysString = '-'.$adjustDays.' days'; |
|
143 | + $adjustDaysString = '-' . $adjustDays . ' days'; |
|
144 | 144 | $PHPDateObject->modify($adjustDaysString); |
145 | 145 | } |
146 | 146 | return $PHPDateObject; |
@@ -302,20 +302,20 @@ discard block |
||
302 | 302 | (!is_numeric($day))) { |
303 | 303 | return Functions::VALUE(); |
304 | 304 | } |
305 | - $year = (integer) $year; |
|
305 | + $year = (integer) $year; |
|
306 | 306 | $month = (integer) $month; |
307 | - $day = (integer) $day; |
|
307 | + $day = (integer) $day; |
|
308 | 308 | |
309 | 309 | $baseYear = \PHPExcel\Shared\Date::getExcelCalendar(); |
310 | 310 | // Validate parameters |
311 | - if ($year < ($baseYear-1900)) { |
|
311 | + if ($year < ($baseYear - 1900)) { |
|
312 | 312 | return Functions::NAN(); |
313 | 313 | } |
314 | - if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { |
|
314 | + if ((($baseYear - 1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { |
|
315 | 315 | return Functions::NAN(); |
316 | 316 | } |
317 | 317 | |
318 | - if (($year < $baseYear) && ($year >= ($baseYear-1900))) { |
|
318 | + if (($year < $baseYear) && ($year >= ($baseYear - 1900))) { |
|
319 | 319 | $year += 1900; |
320 | 320 | } |
321 | 321 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | } |
436 | 436 | return (float) \PHPExcel\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); |
437 | 437 | case Functions::RETURNDATE_PHP_NUMERIC: |
438 | - return (integer) \PHPExcel\Shared\Date::excelToPHP(\PHPExcel\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 |
|
438 | + return (integer) \PHPExcel\Shared\Date::excelToPHP(\PHPExcel\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 |
|
439 | 439 | case Functions::RETURNDATE_PHP_OBJECT: |
440 | 440 | $dayAdjust = 0; |
441 | 441 | if ($hour < 0) { |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | $dayAdjust = floor($hour / 24); |
449 | 449 | $hour = $hour % 24; |
450 | 450 | } |
451 | - $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second); |
|
451 | + $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second); |
|
452 | 452 | if ($dayAdjust != 0) { |
453 | - $phpDateObject->modify($dayAdjust.' days'); |
|
453 | + $phpDateObject->modify($dayAdjust . ' days'); |
|
454 | 454 | } |
455 | 455 | return $phpDateObject; |
456 | 456 | } |
@@ -485,12 +485,12 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public static function DATEVALUE($dateValue = 1) |
487 | 487 | { |
488 | - $dateValueOrig= $dateValue; |
|
488 | + $dateValueOrig = $dateValue; |
|
489 | 489 | $dateValue = trim(Functions::flattenSingleValue($dateValue), '"'); |
490 | 490 | // Strip any ordinals because they're allowed in Excel (English only) |
491 | 491 | $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue); |
492 | 492 | // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany) |
493 | - $dateValue = str_replace(array('/', '.', '-', ' '), array(' ', ' ', ' ', ' '), $dateValue); |
|
493 | + $dateValue = str_replace(array('/', '.', '-', ' '), array(' ', ' ', ' ', ' '), $dateValue); |
|
494 | 494 | |
495 | 495 | $yearFound = false; |
496 | 496 | $t1 = explode(' ', $dateValue); |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | if ($testVal1 < 31 && $testVal2 < 12 && $testVal3 < 12 && strlen($testVal3) == 2) { |
545 | 545 | $testVal3 += 2000; |
546 | 546 | } |
547 | - $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3); |
|
547 | + $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3); |
|
548 | 548 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
549 | - $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3); |
|
549 | + $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3); |
|
550 | 550 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
551 | 551 | return Functions::VALUE(); |
552 | 552 | } |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | case Functions::RETURNDATE_PHP_NUMERIC: |
587 | 587 | return (integer) \PHPExcel\Shared\Date::excelToPHP($excelDateValue); |
588 | 588 | case Functions::RETURNDATE_PHP_OBJECT: |
589 | - return new \DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); |
|
589 | + return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | return Functions::VALUE(); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $timeValue = str_replace(array('/', '.'), array('-', '-'), $timeValue); |
622 | 622 | |
623 | 623 | $arraySplit = preg_split('/[\/:\-\s]/', $timeValue); |
624 | - if ((count($arraySplit) == 2 ||count($arraySplit) == 3) && $arraySplit[0] > 24) { |
|
624 | + if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) { |
|
625 | 625 | $arraySplit[0] = ($arraySplit[0] % 24); |
626 | 626 | $timeValue = implode(':', $arraySplit); |
627 | 627 | } |
@@ -645,9 +645,9 @@ discard block |
||
645 | 645 | case Functions::RETURNDATE_EXCEL: |
646 | 646 | return (float) $excelDateValue; |
647 | 647 | case Functions::RETURNDATE_PHP_NUMERIC: |
648 | - return (integer) $phpDateValue = \PHPExcel\Shared\Date::excelToPHP($excelDateValue+25569) - 3600; |
|
648 | + return (integer) $phpDateValue = \PHPExcel\Shared\Date::excelToPHP($excelDateValue + 25569) - 3600; |
|
649 | 649 | case Functions::RETURNDATE_PHP_OBJECT: |
650 | - return new \DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); |
|
650 | + return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | return Functions::VALUE(); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | case 'MD': |
723 | 723 | if ($endDays < $startDays) { |
724 | 724 | $retVal = $endDays; |
725 | - $PHPEndDateObject->modify('-'.$endDays.' days'); |
|
725 | + $PHPEndDateObject->modify('-' . $endDays . ' days'); |
|
726 | 726 | $adjustDays = $PHPEndDateObject->format('j'); |
727 | 727 | $retVal += ($adjustDays - $startDays); |
728 | 728 | } else { |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | */ |
791 | 791 | public static function DAYS360($startDate = 0, $endDate = 0, $method = false) |
792 | 792 | { |
793 | - $startDate = Functions::flattenSingleValue($startDate); |
|
794 | - $endDate = Functions::flattenSingleValue($endDate); |
|
793 | + $startDate = Functions::flattenSingleValue($startDate); |
|
794 | + $endDate = Functions::flattenSingleValue($endDate); |
|
795 | 795 | |
796 | 796 | if (is_string($startDate = self::getDateValue($startDate))) { |
797 | 797 | return Functions::VALUE(); |
@@ -846,9 +846,9 @@ discard block |
||
846 | 846 | */ |
847 | 847 | public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) |
848 | 848 | { |
849 | - $startDate = Functions::flattenSingleValue($startDate); |
|
850 | - $endDate = Functions::flattenSingleValue($endDate); |
|
851 | - $method = Functions::flattenSingleValue($method); |
|
849 | + $startDate = Functions::flattenSingleValue($startDate); |
|
850 | + $endDate = Functions::flattenSingleValue($endDate); |
|
851 | + $method = Functions::flattenSingleValue($method); |
|
852 | 852 | |
853 | 853 | if (is_string($startDate = self::getDateValue($startDate))) { |
854 | 854 | return Functions::VALUE(); |
@@ -943,8 +943,8 @@ discard block |
||
943 | 943 | public static function NETWORKDAYS($startDate, $endDate) |
944 | 944 | { |
945 | 945 | // Retrieve the mandatory start and end date that are referenced in the function definition |
946 | - $startDate = Functions::flattenSingleValue($startDate); |
|
947 | - $endDate = Functions::flattenSingleValue($endDate); |
|
946 | + $startDate = Functions::flattenSingleValue($startDate); |
|
947 | + $endDate = Functions::flattenSingleValue($endDate); |
|
948 | 948 | // Flush the mandatory start and end date that are referenced in the function definition, and get the optional days |
949 | 949 | $dateArgs = Functions::flattenArray(func_get_args()); |
950 | 950 | array_shift($dateArgs); |
@@ -1030,8 +1030,8 @@ discard block |
||
1030 | 1030 | public static function WORKDAY($startDate, $endDays) |
1031 | 1031 | { |
1032 | 1032 | // Retrieve the mandatory start date and days that are referenced in the function definition |
1033 | - $startDate = Functions::flattenSingleValue($startDate); |
|
1034 | - $endDays = Functions::flattenSingleValue($endDays); |
|
1033 | + $startDate = Functions::flattenSingleValue($startDate); |
|
1034 | + $endDays = Functions::flattenSingleValue($endDays); |
|
1035 | 1035 | // Flush the mandatory start date and days that are referenced in the function definition, and get the optional days |
1036 | 1036 | $dateArgs = Functions::flattenArray(func_get_args()); |
1037 | 1037 | array_shift($dateArgs); |
@@ -1053,7 +1053,7 @@ discard block |
||
1053 | 1053 | |
1054 | 1054 | $startDoW = self::DAYOFWEEK($startDate, 3); |
1055 | 1055 | if (self::DAYOFWEEK($startDate, 3) >= 5) { |
1056 | - $startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW; |
|
1056 | + $startDate += ($decrementing) ? -$startDoW + 4 : 7 - $startDoW; |
|
1057 | 1057 | ($decrementing) ? $endDays++ : $endDays--; |
1058 | 1058 | } |
1059 | 1059 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | // Adjust the calculated end date if it falls over a weekend |
1064 | 1064 | $endDoW = self::DAYOFWEEK($endDate, 3); |
1065 | 1065 | if ($endDoW >= 5) { |
1066 | - $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW; |
|
1066 | + $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW; |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // Test any extra holiday parameters |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | */ |
1135 | 1135 | public static function DAYOFMONTH($dateValue = 1) |
1136 | 1136 | { |
1137 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1137 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1138 | 1138 | |
1139 | 1139 | if ($dateValue === null) { |
1140 | 1140 | $dateValue = 1; |
@@ -1248,8 +1248,8 @@ discard block |
||
1248 | 1248 | */ |
1249 | 1249 | public static function WEEKOFYEAR($dateValue = 1, $method = 1) |
1250 | 1250 | { |
1251 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1252 | - $method = Functions::flattenSingleValue($method); |
|
1251 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1252 | + $method = Functions::flattenSingleValue($method); |
|
1253 | 1253 | |
1254 | 1254 | if (!is_numeric($method)) { |
1255 | 1255 | return Functions::VALUE(); |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | */ |
1295 | 1295 | public static function MONTHOFYEAR($dateValue = 1) |
1296 | 1296 | { |
1297 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1297 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1298 | 1298 | |
1299 | 1299 | if (empty($dateValue)) { |
1300 | 1300 | $dateValue = 1; |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | */ |
1328 | 1328 | public static function YEAR($dateValue = 1) |
1329 | 1329 | { |
1330 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1330 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1331 | 1331 | |
1332 | 1332 | if ($dateValue === null) { |
1333 | 1333 | $dateValue = 1; |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | */ |
1360 | 1360 | public static function HOUROFDAY($timeValue = 0) |
1361 | 1361 | { |
1362 | - $timeValue = Functions::flattenSingleValue($timeValue); |
|
1362 | + $timeValue = Functions::flattenSingleValue($timeValue); |
|
1363 | 1363 | |
1364 | 1364 | if (!is_numeric($timeValue)) { |
1365 | 1365 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | */ |
1401 | 1401 | public static function MINUTEOFHOUR($timeValue = 0) |
1402 | 1402 | { |
1403 | - $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); |
|
1403 | + $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); |
|
1404 | 1404 | |
1405 | 1405 | if (!is_numeric($timeValue)) { |
1406 | 1406 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | */ |
1442 | 1442 | public static function SECONDOFMINUTE($timeValue = 0) |
1443 | 1443 | { |
1444 | - $timeValue = Functions::flattenSingleValue($timeValue); |
|
1444 | + $timeValue = Functions::flattenSingleValue($timeValue); |
|
1445 | 1445 | |
1446 | 1446 | if (!is_numeric($timeValue)) { |
1447 | 1447 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
@@ -1488,8 +1488,8 @@ discard block |
||
1488 | 1488 | */ |
1489 | 1489 | public static function EDATE($dateValue = 1, $adjustmentMonths = 0) |
1490 | 1490 | { |
1491 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1492 | - $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1491 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1492 | + $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1493 | 1493 | |
1494 | 1494 | if (!is_numeric($adjustmentMonths)) { |
1495 | 1495 | return Functions::VALUE(); |
@@ -1534,8 +1534,8 @@ discard block |
||
1534 | 1534 | */ |
1535 | 1535 | public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) |
1536 | 1536 | { |
1537 | - $dateValue = Functions::flattenSingleValue($dateValue); |
|
1538 | - $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1537 | + $dateValue = Functions::flattenSingleValue($dateValue); |
|
1538 | + $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); |
|
1539 | 1539 | |
1540 | 1540 | if (!is_numeric($adjustmentMonths)) { |
1541 | 1541 | return Functions::VALUE(); |
@@ -1547,7 +1547,7 @@ discard block |
||
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | // Execute function |
1550 | - $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths+1); |
|
1550 | + $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths + 1); |
|
1551 | 1551 | $adjustDays = (int) $PHPDateObject->format('d'); |
1552 | 1552 | $adjustDaysString = '-' . $adjustDays . ' days'; |
1553 | 1553 | $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 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | |
1150 | 1150 | if (is_bool($x)) { |
1151 | 1151 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1152 | - $x = (int)$x; |
|
1152 | + $x = (int) $x; |
|
1153 | 1153 | } else { |
1154 | 1154 | return Functions::VALUE(); |
1155 | 1155 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1158 | 1158 | $x = floor($x); |
1159 | 1159 | } |
1160 | - $x = (string)$x; |
|
1160 | + $x = (string) $x; |
|
1161 | 1161 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1162 | 1162 | return Functions::NAN(); |
1163 | 1163 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | // Argument X |
1205 | 1205 | if (is_bool($x)) { |
1206 | 1206 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1207 | - $x = (int)$x; |
|
1207 | + $x = (int) $x; |
|
1208 | 1208 | } else { |
1209 | 1209 | return Functions::VALUE(); |
1210 | 1210 | } |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1213 | 1213 | $x = floor($x); |
1214 | 1214 | } |
1215 | - $x = (string)$x; |
|
1215 | + $x = (string) $x; |
|
1216 | 1216 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1217 | 1217 | return Functions::NAN(); |
1218 | 1218 | } |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | // Two's Complement |
1223 | 1223 | return str_repeat('F', 8) . substr(strtoupper(dechex(bindec(substr($x, -9)))), -2); |
1224 | 1224 | } |
1225 | - $hexVal = (string)strtoupper(dechex(bindec($x))); |
|
1225 | + $hexVal = (string) strtoupper(dechex(bindec($x))); |
|
1226 | 1226 | |
1227 | 1227 | return self::nbrConversionFormat($hexVal, $places); |
1228 | 1228 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | if (is_bool($x)) { |
1261 | 1261 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1262 | - $x = (int)$x; |
|
1262 | + $x = (int) $x; |
|
1263 | 1263 | } else { |
1264 | 1264 | return Functions::VALUE(); |
1265 | 1265 | } |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { |
1268 | 1268 | $x = floor($x); |
1269 | 1269 | } |
1270 | - $x = (string)$x; |
|
1270 | + $x = (string) $x; |
|
1271 | 1271 | if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { |
1272 | 1272 | return Functions::NAN(); |
1273 | 1273 | } |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | // Two's Complement |
1278 | 1278 | return str_repeat('7', 7) . substr(strtoupper(decoct(bindec(substr($x, -9)))), -3); |
1279 | 1279 | } |
1280 | - $octVal = (string)decoct(bindec($x)); |
|
1280 | + $octVal = (string) decoct(bindec($x)); |
|
1281 | 1281 | |
1282 | 1282 | return self::nbrConversionFormat($octVal, $places); |
1283 | 1283 | } |
@@ -1318,16 +1318,16 @@ discard block |
||
1318 | 1318 | |
1319 | 1319 | if (is_bool($x)) { |
1320 | 1320 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1321 | - $x = (int)$x; |
|
1321 | + $x = (int) $x; |
|
1322 | 1322 | } else { |
1323 | 1323 | return Functions::VALUE(); |
1324 | 1324 | } |
1325 | 1325 | } |
1326 | - $x = (string)$x; |
|
1326 | + $x = (string) $x; |
|
1327 | 1327 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1328 | 1328 | return Functions::VALUE(); |
1329 | 1329 | } |
1330 | - $x = (string)floor($x); |
|
1330 | + $x = (string) floor($x); |
|
1331 | 1331 | $r = decbin($x); |
1332 | 1332 | if (strlen($r) == 32) { |
1333 | 1333 | // Two's Complement |
@@ -1375,16 +1375,16 @@ discard block |
||
1375 | 1375 | |
1376 | 1376 | if (is_bool($x)) { |
1377 | 1377 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1378 | - $x = (int)$x; |
|
1378 | + $x = (int) $x; |
|
1379 | 1379 | } else { |
1380 | 1380 | return Functions::VALUE(); |
1381 | 1381 | } |
1382 | 1382 | } |
1383 | - $x = (string)$x; |
|
1383 | + $x = (string) $x; |
|
1384 | 1384 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1385 | 1385 | return Functions::VALUE(); |
1386 | 1386 | } |
1387 | - $x = (string)floor($x); |
|
1387 | + $x = (string) floor($x); |
|
1388 | 1388 | $r = strtoupper(dechex($x)); |
1389 | 1389 | if (strlen($r) == 8) { |
1390 | 1390 | // Two's Complement |
@@ -1431,16 +1431,16 @@ discard block |
||
1431 | 1431 | |
1432 | 1432 | if (is_bool($x)) { |
1433 | 1433 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
1434 | - $x = (int)$x; |
|
1434 | + $x = (int) $x; |
|
1435 | 1435 | } else { |
1436 | 1436 | return Functions::VALUE(); |
1437 | 1437 | } |
1438 | 1438 | } |
1439 | - $x = (string)$x; |
|
1439 | + $x = (string) $x; |
|
1440 | 1440 | if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { |
1441 | 1441 | return Functions::VALUE(); |
1442 | 1442 | } |
1443 | - $x = (string)floor($x); |
|
1443 | + $x = (string) floor($x); |
|
1444 | 1444 | $r = decoct($x); |
1445 | 1445 | if (strlen($r) == 11) { |
1446 | 1446 | // Two's Complement |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | if (is_bool($x)) { |
1488 | 1488 | return Functions::VALUE(); |
1489 | 1489 | } |
1490 | - $x = (string)$x; |
|
1490 | + $x = (string) $x; |
|
1491 | 1491 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1492 | 1492 | return Functions::NAN(); |
1493 | 1493 | } |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | if (is_bool($x)) { |
1526 | 1526 | return Functions::VALUE(); |
1527 | 1527 | } |
1528 | - $x = (string)$x; |
|
1528 | + $x = (string) $x; |
|
1529 | 1529 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1530 | 1530 | return Functions::NAN(); |
1531 | 1531 | } |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | if (is_bool($x)) { |
1584 | 1584 | return Functions::VALUE(); |
1585 | 1585 | } |
1586 | - $x = (string)$x; |
|
1586 | + $x = (string) $x; |
|
1587 | 1587 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
1588 | 1588 | return Functions::NAN(); |
1589 | 1589 | } |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | if (is_bool($x)) { |
1636 | 1636 | return Functions::VALUE(); |
1637 | 1637 | } |
1638 | - $x = (string)$x; |
|
1638 | + $x = (string) $x; |
|
1639 | 1639 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1640 | 1640 | return Functions::NAN(); |
1641 | 1641 | } |
@@ -1671,13 +1671,13 @@ discard block |
||
1671 | 1671 | if (is_bool($x)) { |
1672 | 1672 | return Functions::VALUE(); |
1673 | 1673 | } |
1674 | - $x = (string)$x; |
|
1674 | + $x = (string) $x; |
|
1675 | 1675 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1676 | 1676 | return Functions::NAN(); |
1677 | 1677 | } |
1678 | 1678 | $binX = ''; |
1679 | 1679 | foreach (str_split($x) as $char) { |
1680 | - $binX .= str_pad(decbin((int)$char), 3, '0', STR_PAD_LEFT); |
|
1680 | + $binX .= str_pad(decbin((int) $char), 3, '0', STR_PAD_LEFT); |
|
1681 | 1681 | } |
1682 | 1682 | if (strlen($binX) == 30 && $binX[0] == '1') { |
1683 | 1683 | for ($i = 0; $i < 30; $i++) { |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | if (is_bool($x)) { |
1726 | 1726 | return Functions::VALUE(); |
1727 | 1727 | } |
1728 | - $x = (string)$x; |
|
1728 | + $x = (string) $x; |
|
1729 | 1729 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
1730 | 1730 | return Functions::NAN(); |
1731 | 1731 | } |
@@ -1760,32 +1760,32 @@ discard block |
||
1760 | 1760 | if (((is_numeric($realNumber)) && (is_numeric($imaginary))) && |
1761 | 1761 | (($suffix == 'i') || ($suffix == 'j') || ($suffix == '')) |
1762 | 1762 | ) { |
1763 | - $realNumber = (float)$realNumber; |
|
1764 | - $imaginary = (float)$imaginary; |
|
1763 | + $realNumber = (float) $realNumber; |
|
1764 | + $imaginary = (float) $imaginary; |
|
1765 | 1765 | |
1766 | 1766 | if ($suffix == '') { |
1767 | 1767 | $suffix = 'i'; |
1768 | 1768 | } |
1769 | 1769 | if ($realNumber == 0.0) { |
1770 | 1770 | if ($imaginary == 0.0) { |
1771 | - return (string)'0'; |
|
1771 | + return (string) '0'; |
|
1772 | 1772 | } elseif ($imaginary == 1.0) { |
1773 | - return (string)$suffix; |
|
1773 | + return (string) $suffix; |
|
1774 | 1774 | } elseif ($imaginary == -1.0) { |
1775 | - return (string)'-' . $suffix; |
|
1775 | + return (string) '-' . $suffix; |
|
1776 | 1776 | } |
1777 | - return (string)$imaginary . $suffix; |
|
1777 | + return (string) $imaginary . $suffix; |
|
1778 | 1778 | } elseif ($imaginary == 0.0) { |
1779 | - return (string)$realNumber; |
|
1779 | + return (string) $realNumber; |
|
1780 | 1780 | } elseif ($imaginary == 1.0) { |
1781 | - return (string)$realNumber . '+' . $suffix; |
|
1781 | + return (string) $realNumber . '+' . $suffix; |
|
1782 | 1782 | } elseif ($imaginary == -1.0) { |
1783 | - return (string)$realNumber . '-' . $suffix; |
|
1783 | + return (string) $realNumber . '-' . $suffix; |
|
1784 | 1784 | } |
1785 | 1785 | if ($imaginary > 0) { |
1786 | - $imaginary = (string)'+' . $imaginary; |
|
1786 | + $imaginary = (string) '+' . $imaginary; |
|
1787 | 1787 | } |
1788 | - return (string)$realNumber . $imaginary . $suffix; |
|
1788 | + return (string) $realNumber . $imaginary . $suffix; |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | return Functions::VALUE(); |
@@ -2350,7 +2350,7 @@ discard block |
||
2350 | 2350 | $a = Functions::flattenSingleValue($a); |
2351 | 2351 | $b = Functions::flattenSingleValue($b); |
2352 | 2352 | |
2353 | - return (int)($a == $b); |
|
2353 | + return (int) ($a == $b); |
|
2354 | 2354 | } |
2355 | 2355 | |
2356 | 2356 | |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | $number = Functions::flattenSingleValue($number); |
2375 | 2375 | $step = Functions::flattenSingleValue($step); |
2376 | 2376 | |
2377 | - return (int)($number >= $step); |
|
2377 | + return (int) ($number >= $step); |
|
2378 | 2378 | } |
2379 | 2379 | |
2380 | 2380 |
@@ -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 | */ |
@@ -63,28 +63,28 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($sheetText > '') { |
65 | 65 | if (strpos($sheetText, ' ') !== false) { |
66 | - $sheetText = "'".$sheetText."'"; |
|
66 | + $sheetText = "'" . $sheetText . "'"; |
|
67 | 67 | } |
68 | - $sheetText .='!'; |
|
68 | + $sheetText .= '!'; |
|
69 | 69 | } |
70 | 70 | if ((!is_bool($referenceStyle)) || $referenceStyle) { |
71 | 71 | $rowRelative = $columnRelative = '$'; |
72 | - $column = \PHPExcel\Cell::stringFromColumnIndex($column-1); |
|
72 | + $column = \PHPExcel\Cell::stringFromColumnIndex($column - 1); |
|
73 | 73 | if (($relativity == 2) || ($relativity == 4)) { |
74 | 74 | $columnRelative = ''; |
75 | 75 | } |
76 | 76 | if (($relativity == 3) || ($relativity == 4)) { |
77 | 77 | $rowRelative = ''; |
78 | 78 | } |
79 | - return $sheetText.$columnRelative.$column.$rowRelative.$row; |
|
79 | + return $sheetText . $columnRelative . $column . $rowRelative . $row; |
|
80 | 80 | } else { |
81 | 81 | if (($relativity == 2) || ($relativity == 4)) { |
82 | - $column = '['.$column.']'; |
|
82 | + $column = '[' . $column . ']'; |
|
83 | 83 | } |
84 | 84 | if (($relativity == 3) || ($relativity == 4)) { |
85 | - $row = '['.$row.']'; |
|
85 | + $row = '[' . $row . ']'; |
|
86 | 86 | } |
87 | - return $sheetText.'R'.$row.'C'.$column; |
|
87 | + return $sheetText . 'R' . $row . 'C' . $column; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $args = func_get_args(); |
263 | 263 | $pCell = array_pop($args); |
264 | 264 | |
265 | - $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); |
|
265 | + $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); |
|
266 | 266 | $displayName = (is_null($displayName)) ? '' : Functions::flattenSingleValue($displayName); |
267 | 267 | |
268 | 268 | if ((!is_object($pCell)) || (trim($linkURL) == '')) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public static function INDIRECT($cellAddress = null, \PHPExcel\Cell $pCell = null) |
302 | 302 | { |
303 | - $cellAddress = Functions::flattenSingleValue($cellAddress); |
|
303 | + $cellAddress = Functions::flattenSingleValue($cellAddress); |
|
304 | 304 | if (is_null($cellAddress) || $cellAddress === '') { |
305 | 305 | return Functions::REF(); |
306 | 306 | } |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | list($cellAddress1, $cellAddress2) = explode(':', $cellAddress); |
312 | 312 | } |
313 | 313 | |
314 | - if ((!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || |
|
315 | - ((!is_null($cellAddress2)) && (!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { |
|
316 | - if (!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { |
|
314 | + if ((!preg_match('/^' . \PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) || |
|
315 | + ((!is_null($cellAddress2)) && (!preg_match('/^' . \PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress2, $matches)))) { |
|
316 | + if (!preg_match('/^' . \PHPExcel\Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $cellAddress1, $matches)) { |
|
317 | 317 | return Functions::REF(); |
318 | 318 | } |
319 | 319 | |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | } |
421 | 421 | $endCellColumn = \PHPExcel\Cell::stringFromColumnIndex($endCellColumn); |
422 | 422 | |
423 | - $cellAddress = $startCellColumn.$startCellRow; |
|
423 | + $cellAddress = $startCellColumn . $startCellRow; |
|
424 | 424 | if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) { |
425 | - $cellAddress .= ':'.$endCellColumn.$endCellRow; |
|
425 | + $cellAddress .= ':' . $endCellColumn . $endCellRow; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | if ($sheetName !== null) { |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | { |
498 | 498 | $lookup_array = Functions::flattenArray($lookup_array); |
499 | 499 | $lookup_value = Functions::flattenSingleValue($lookup_value); |
500 | - $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type); |
|
500 | + $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type); |
|
501 | 501 | // MATCH is not case sensitive |
502 | 502 | $lookup_value = strtolower($lookup_value); |
503 | 503 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $lookup_array[$i] = strtolower($lookupArrayValue); |
530 | 530 | } |
531 | 531 | if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) { |
532 | - $lookup_array = array_slice($lookup_array, 0, $i-1); |
|
532 | + $lookup_array = array_slice($lookup_array, 0, $i - 1); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | break; |
558 | 558 | } else { |
559 | 559 | // the previous cell was the match |
560 | - return $keySet[$i-1]+1; |
|
560 | + return $keySet[$i - 1] + 1; |
|
561 | 561 | } |
562 | 562 | } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) { |
563 | 563 | $i = array_search($i, $keySet); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | break; |
568 | 568 | } else { |
569 | 569 | // the previous cell was the match |
570 | - return $keySet[$i-1]+1; |
|
570 | + return $keySet[$i - 1] + 1; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | { |
756 | 756 | $lookup_value = Functions::flattenSingleValue($lookup_value); |
757 | 757 | $index_number = Functions::flattenSingleValue($index_number); |
758 | - $not_exact_match = Functions::flattenSingleValue($not_exact_match); |
|
758 | + $not_exact_match = Functions::flattenSingleValue($not_exact_match); |
|
759 | 759 | |
760 | 760 | // index_number must be greater than or equal to 1 |
761 | 761 | if ($index_number < 1) { |