@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | define('POLYMORPHIC_ARGUMENT_EXCEPTION', -1); |
25 | 25 | $error['EN'][POLYMORPHIC_ARGUMENT_EXCEPTION] = "Invalid argument pattern for polymorphic function."; |
26 | -$error['FR'][POLYMORPHIC_ARGUMENT_EXCEPTION] = "Modèle inadmissible d'argument pour la fonction polymorphe.". |
|
26 | +$error['FR'][POLYMORPHIC_ARGUMENT_EXCEPTION] = "Modèle inadmissible d'argument pour la fonction polymorphe." . |
|
27 | 27 | $error['DE'][POLYMORPHIC_ARGUMENT_EXCEPTION] = "Unzulässiges Argumentmuster für polymorphe Funktion."; |
28 | 28 | |
29 | 29 | define('ARGUMENT_TYPE_EXCEPTION', -2); |
@@ -293,7 +293,7 @@ |
||
293 | 293 | $calcEngine = \PHPExcel\Calculation::getInstance($worksheet->getParent()); |
294 | 294 | $newDataValues = \PHPExcel\Calculation::unwrapResult( |
295 | 295 | $calcEngine->_calculateFormulaValue( |
296 | - '='.$this->dataSource, |
|
296 | + '=' . $this->dataSource, |
|
297 | 297 | null, |
298 | 298 | $worksheet->getCell('A1') |
299 | 299 | ) |
@@ -196,7 +196,7 @@ |
||
196 | 196 | foreach ($this->getCellList() as $coord) { |
197 | 197 | sscanf($coord, '%[A-Z]%d', $c, $r); |
198 | 198 | $row[$r] = $r; |
199 | - $col[$c] = strlen($c).$c; |
|
199 | + $col[$c] = strlen($c) . $c; |
|
200 | 200 | } |
201 | 201 | if (!empty($row)) { |
202 | 202 | // Determine highest column and row |
@@ -2085,7 +2085,6 @@ discard block |
||
2085 | 2085 | /** |
2086 | 2086 | * Unset an instance of this class. |
2087 | 2087 | * |
2088 | - * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset |
|
2089 | 2088 | */ |
2090 | 2089 | public function __destruct() |
2091 | 2090 | { |
@@ -2339,6 +2338,10 @@ discard block |
||
2339 | 2338 | return false; |
2340 | 2339 | } |
2341 | 2340 | |
2341 | + /** |
|
2342 | + * @param string $fromSeparator |
|
2343 | + * @param string $toSeparator |
|
2344 | + */ |
|
2342 | 2345 | public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces) |
2343 | 2346 | { |
2344 | 2347 | $strlen = mb_strlen($formula); |
@@ -2679,6 +2682,9 @@ discard block |
||
2679 | 2682 | return $result; |
2680 | 2683 | } |
2681 | 2684 | |
2685 | + /** |
|
2686 | + * @param string $cellReference |
|
2687 | + */ |
|
2682 | 2688 | public function getValueFromCache($cellReference, &$cellValue) |
2683 | 2689 | { |
2684 | 2690 | // Is calculation cacheing enabled? |
@@ -2821,7 +2827,7 @@ discard block |
||
2821 | 2827 | * |
2822 | 2828 | * @param mixed &$matrix matrix operand |
2823 | 2829 | * |
2824 | - * @return int[] An array comprising the number of rows, and number of columns |
|
2830 | + * @return integer[] An array comprising the number of rows, and number of columns |
|
2825 | 2831 | */ |
2826 | 2832 | private static function getMatrixDimensions(&$matrix) |
2827 | 2833 | { |
@@ -3007,6 +3013,9 @@ discard block |
||
3007 | 3013 | } |
3008 | 3014 | } |
3009 | 3015 | |
3016 | + /** |
|
3017 | + * @param string $formula |
|
3018 | + */ |
|
3010 | 3019 | private function convertMatrixReferences($formula) |
3011 | 3020 | { |
3012 | 3021 | static $matrixReplaceFrom = ['{', ';', '}']; |
@@ -3095,6 +3104,10 @@ discard block |
||
3095 | 3104 | ]; |
3096 | 3105 | |
3097 | 3106 | // Convert infix to postfix notation |
3107 | + |
|
3108 | + /** |
|
3109 | + * @param string $formula |
|
3110 | + */ |
|
3098 | 3111 | private function _parseFormula($formula, Cell $pCell = null) |
3099 | 3112 | { |
3100 | 3113 | if (($formula = $this->convertMatrixReferences(trim($formula))) === false) { |
@@ -3832,6 +3845,9 @@ discard block |
||
3832 | 3845 | return true; |
3833 | 3846 | } |
3834 | 3847 | |
3848 | + /** |
|
3849 | + * @param string|null $cellID |
|
3850 | + */ |
|
3835 | 3851 | private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays = false) |
3836 | 3852 | { |
3837 | 3853 | // If we're dealing with matrix operations, we want a matrix result |
@@ -3972,6 +3988,7 @@ discard block |
||
3972 | 3988 | |
3973 | 3989 | /** |
3974 | 3990 | * @param string $matrixFunction |
3991 | + * @param string|null $cellID |
|
3975 | 3992 | */ |
3976 | 3993 | private function executeNumericBinaryOperation($cellID, $operand1, $operand2, $operation, $matrixFunction, &$stack) |
3977 | 3994 | { |
@@ -2049,8 +2049,8 @@ discard block |
||
2049 | 2049 | |
2050 | 2050 | private static function loadLocales() |
2051 | 2051 | { |
2052 | - $localeFileDirectory = PHPSPREADSHEET_ROOT.'PhpSpreadsheet/locale/'; |
|
2053 | - foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) { |
|
2052 | + $localeFileDirectory = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet/locale/'; |
|
2053 | + foreach (glob($localeFileDirectory . '/*', GLOB_ONLYDIR) as $filename) { |
|
2054 | 2054 | $filename = substr($filename, strlen($localeFileDirectory) + 1); |
2055 | 2055 | if ($filename != 'en') { |
2056 | 2056 | self::$validLocaleLanguages[] = $filename; |
@@ -2279,10 +2279,10 @@ discard block |
||
2279 | 2279 | // Default is English, if user isn't requesting english, then read the necessary data from the locale files |
2280 | 2280 | if ($locale != 'en_us') { |
2281 | 2281 | // Search for a file with a list of function names for locale |
2282 | - $functionNamesFile = PHPSPREADSHEET_ROOT.'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'functions'; |
|
2282 | + $functionNamesFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions'; |
|
2283 | 2283 | if (!file_exists($functionNamesFile)) { |
2284 | 2284 | // If there isn't a locale specific function file, look for a language specific function file |
2285 | - $functionNamesFile = PHPSPREADSHEET_ROOT.'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'functions'; |
|
2285 | + $functionNamesFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . 'functions'; |
|
2286 | 2286 | if (!file_exists($functionNamesFile)) { |
2287 | 2287 | return false; |
2288 | 2288 | } |
@@ -2308,9 +2308,9 @@ discard block |
||
2308 | 2308 | self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE']; |
2309 | 2309 | } |
2310 | 2310 | |
2311 | - $configFile = PHPSPREADSHEET_ROOT.'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config'; |
|
2311 | + $configFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config'; |
|
2312 | 2312 | if (!file_exists($configFile)) { |
2313 | - $configFile = PHPSPREADSHEET_ROOT.'PhpSpreadsheet'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.$language.DIRECTORY_SEPARATOR.'config'; |
|
2313 | + $configFile = PHPSPREADSHEET_ROOT . 'PhpSpreadsheet' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . 'config'; |
|
2314 | 2314 | } |
2315 | 2315 | if (file_exists($configFile)) { |
2316 | 2316 | $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
@@ -2353,7 +2353,7 @@ discard block |
||
2353 | 2353 | break; |
2354 | 2354 | case $fromSeparator: |
2355 | 2355 | if (!$inBraces) { |
2356 | - $formula = mb_substr($formula, 0, $i).$toSeparator.mb_substr($formula, $i + 1); |
|
2356 | + $formula = mb_substr($formula, 0, $i) . $toSeparator . mb_substr($formula, $i + 1); |
|
2357 | 2357 | } |
2358 | 2358 | } |
2359 | 2359 | } |
@@ -2404,20 +2404,20 @@ discard block |
||
2404 | 2404 | if (self::$functionReplaceFromExcel === null) { |
2405 | 2405 | self::$functionReplaceFromExcel = []; |
2406 | 2406 | foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { |
2407 | - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui'; |
|
2407 | + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName) . '([\s]*\()/Ui'; |
|
2408 | 2408 | } |
2409 | 2409 | foreach (array_keys(self::$localeBoolean) as $excelBoolean) { |
2410 | - self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; |
|
2410 | + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean) . '([^\w\.])/Ui'; |
|
2411 | 2411 | } |
2412 | 2412 | } |
2413 | 2413 | |
2414 | 2414 | if (self::$functionReplaceToLocale === null) { |
2415 | 2415 | self::$functionReplaceToLocale = []; |
2416 | 2416 | foreach (array_values(self::$localeFunctions) as $localeFunctionName) { |
2417 | - self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2'; |
|
2417 | + self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2'; |
|
2418 | 2418 | } |
2419 | 2419 | foreach (array_values(self::$localeBoolean) as $localeBoolean) { |
2420 | - self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2'; |
|
2420 | + self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2'; |
|
2421 | 2421 | } |
2422 | 2422 | } |
2423 | 2423 | |
@@ -2432,20 +2432,20 @@ discard block |
||
2432 | 2432 | if (self::$functionReplaceFromLocale === null) { |
2433 | 2433 | self::$functionReplaceFromLocale = []; |
2434 | 2434 | foreach (array_values(self::$localeFunctions) as $localeFunctionName) { |
2435 | - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui'; |
|
2435 | + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName) . '([\s]*\()/Ui'; |
|
2436 | 2436 | } |
2437 | 2437 | foreach (array_values(self::$localeBoolean) as $excelBoolean) { |
2438 | - self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui'; |
|
2438 | + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean) . '([^\w\.])/Ui'; |
|
2439 | 2439 | } |
2440 | 2440 | } |
2441 | 2441 | |
2442 | 2442 | if (self::$functionReplaceToExcel === null) { |
2443 | 2443 | self::$functionReplaceToExcel = []; |
2444 | 2444 | foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { |
2445 | - self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2'; |
|
2445 | + self::$functionReplaceToExcel[] = '$1' . trim($excelFunctionName) . '$2'; |
|
2446 | 2446 | } |
2447 | 2447 | foreach (array_keys(self::$localeBoolean) as $excelBoolean) { |
2448 | - self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2'; |
|
2448 | + self::$functionReplaceToExcel[] = '$1' . trim($excelBoolean) . '$2'; |
|
2449 | 2449 | } |
2450 | 2450 | } |
2451 | 2451 | |
@@ -2479,12 +2479,12 @@ discard block |
||
2479 | 2479 | { |
2480 | 2480 | if (is_string($value)) { |
2481 | 2481 | // Error values cannot be "wrapped" |
2482 | - if (preg_match('/^'.self::CALCULATION_REGEXP_ERROR.'$/i', $value, $match)) { |
|
2482 | + if (preg_match('/^' . self::CALCULATION_REGEXP_ERROR . '$/i', $value, $match)) { |
|
2483 | 2483 | // Return Excel errors "as is" |
2484 | 2484 | return $value; |
2485 | 2485 | } |
2486 | 2486 | // Return strings wrapped in quotes |
2487 | - return '"'.$value.'"'; |
|
2487 | + return '"' . $value . '"'; |
|
2488 | 2488 | // Convert numeric errors to NaN error |
2489 | 2489 | } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { |
2490 | 2490 | return Calculation\Functions::NAN(); |
@@ -2733,7 +2733,7 @@ discard block |
||
2733 | 2733 | |
2734 | 2734 | $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; |
2735 | 2735 | $wsTitle = ($pCellParent !== null) ? $pCellParent->getTitle() : "\x00Wrk"; |
2736 | - $wsCellReference = $wsTitle.'!'.$cellID; |
|
2736 | + $wsCellReference = $wsTitle . '!' . $cellID; |
|
2737 | 2737 | |
2738 | 2738 | if (($cellID !== null) && ($this->getValueFromCache($wsCellReference, $cellValue))) { |
2739 | 2739 | return $cellValue; |
@@ -2957,9 +2957,9 @@ discard block |
||
2957 | 2957 | } |
2958 | 2958 | } |
2959 | 2959 | |
2960 | - return '{ '.implode($rpad, $returnMatrix).' }'; |
|
2960 | + return '{ ' . implode($rpad, $returnMatrix) . ' }'; |
|
2961 | 2961 | } elseif (is_string($value) && (trim($value, '"') == $value)) { |
2962 | - return '"'.$value.'"'; |
|
2962 | + return '"' . $value . '"'; |
|
2963 | 2963 | } elseif (is_bool($value)) { |
2964 | 2964 | return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; |
2965 | 2965 | } |
@@ -2997,13 +2997,13 @@ discard block |
||
2997 | 2997 | if ($value == '') { |
2998 | 2998 | return 'an empty string'; |
2999 | 2999 | } elseif ($value{0} == '#') { |
3000 | - return 'a '.$value.' error'; |
|
3000 | + return 'a ' . $value . ' error'; |
|
3001 | 3001 | } else { |
3002 | 3002 | $typeString = 'a string'; |
3003 | 3003 | } |
3004 | 3004 | } |
3005 | 3005 | |
3006 | - return $typeString.' with a value of '.$this->showValue($value); |
|
3006 | + return $typeString . ' with a value of ' . $this->showValue($value); |
|
3007 | 3007 | } |
3008 | 3008 | } |
3009 | 3009 | |
@@ -3105,13 +3105,13 @@ discard block |
||
3105 | 3105 | // so we store the parent worksheet so that we can re-attach it when necessary |
3106 | 3106 | $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; |
3107 | 3107 | |
3108 | - $regexpMatchString = '/^('.self::CALCULATION_REGEXP_FUNCTION. |
|
3109 | - '|'.self::CALCULATION_REGEXP_CELLREF. |
|
3110 | - '|'.self::CALCULATION_REGEXP_NUMBER. |
|
3111 | - '|'.self::CALCULATION_REGEXP_STRING. |
|
3112 | - '|'.self::CALCULATION_REGEXP_OPENBRACE. |
|
3113 | - '|'.self::CALCULATION_REGEXP_NAMEDRANGE. |
|
3114 | - '|'.self::CALCULATION_REGEXP_ERROR. |
|
3108 | + $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_FUNCTION . |
|
3109 | + '|' . self::CALCULATION_REGEXP_CELLREF . |
|
3110 | + '|' . self::CALCULATION_REGEXP_NUMBER . |
|
3111 | + '|' . self::CALCULATION_REGEXP_STRING . |
|
3112 | + '|' . self::CALCULATION_REGEXP_OPENBRACE . |
|
3113 | + '|' . self::CALCULATION_REGEXP_NAMEDRANGE . |
|
3114 | + '|' . self::CALCULATION_REGEXP_ERROR . |
|
3115 | 3115 | ')/si'; |
3116 | 3116 | |
3117 | 3117 | // Start with initialisation |
@@ -3163,7 +3163,7 @@ discard block |
||
3163 | 3163 | } |
3164 | 3164 | } |
3165 | 3165 | $d = $stack->last(2); |
3166 | - if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3166 | + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3167 | 3167 | $functionName = $matches[1]; // Get the function name |
3168 | 3168 | $d = $stack->pop(); |
3169 | 3169 | $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) |
@@ -3184,7 +3184,7 @@ discard block |
||
3184 | 3184 | if ($expectedArgumentCount < 0) { |
3185 | 3185 | if ($argumentCount > abs($expectedArgumentCount)) { |
3186 | 3186 | $argumentCountError = true; |
3187 | - $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount); |
|
3187 | + $expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount); |
|
3188 | 3188 | } |
3189 | 3189 | } else { |
3190 | 3190 | if ($argumentCount != $expectedArgumentCount) { |
@@ -3198,25 +3198,25 @@ discard block |
||
3198 | 3198 | case '+': |
3199 | 3199 | if ($argumentCount < $argMatch[1]) { |
3200 | 3200 | $argumentCountError = true; |
3201 | - $expectedArgumentCountString = $argMatch[1].' or more '; |
|
3201 | + $expectedArgumentCountString = $argMatch[1] . ' or more '; |
|
3202 | 3202 | } |
3203 | 3203 | break; |
3204 | 3204 | case '-': |
3205 | 3205 | if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { |
3206 | 3206 | $argumentCountError = true; |
3207 | - $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3]; |
|
3207 | + $expectedArgumentCountString = 'between ' . $argMatch[1] . ' and ' . $argMatch[3]; |
|
3208 | 3208 | } |
3209 | 3209 | break; |
3210 | 3210 | case ',': |
3211 | 3211 | if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { |
3212 | 3212 | $argumentCountError = true; |
3213 | - $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3]; |
|
3213 | + $expectedArgumentCountString = 'either ' . $argMatch[1] . ' or ' . $argMatch[3]; |
|
3214 | 3214 | } |
3215 | 3215 | break; |
3216 | 3216 | } |
3217 | 3217 | } |
3218 | 3218 | if ($argumentCountError) { |
3219 | - return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, ".$expectedArgumentCountString.' expected'); |
|
3219 | + return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, " . $expectedArgumentCountString . ' expected'); |
|
3220 | 3220 | } |
3221 | 3221 | } |
3222 | 3222 | ++$index; |
@@ -3235,7 +3235,7 @@ discard block |
||
3235 | 3235 | } |
3236 | 3236 | // make sure there was a function |
3237 | 3237 | $d = $stack->last(2); |
3238 | - if (!preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { |
|
3238 | + if (!preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { |
|
3239 | 3239 | return $this->raiseFormulaError('Formula Error: Unexpected ,'); |
3240 | 3240 | } |
3241 | 3241 | $d = $stack->pop(); |
@@ -3253,23 +3253,23 @@ discard block |
||
3253 | 3253 | $val = $match[1]; |
3254 | 3254 | $length = strlen($val); |
3255 | 3255 | |
3256 | - if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) { |
|
3256 | + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $val, $matches)) { |
|
3257 | 3257 | $val = preg_replace('/\s/u', '', $val); |
3258 | 3258 | if (isset(self::$phpSpreadsheetFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function |
3259 | 3259 | $stack->push('Function', strtoupper($val)); |
3260 | 3260 | $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index + $length), $amatch); |
3261 | 3261 | if ($ax) { |
3262 | - $stack->push('Operand Count for Function '.strtoupper($val).')', 0); |
|
3262 | + $stack->push('Operand Count for Function ' . strtoupper($val) . ')', 0); |
|
3263 | 3263 | $expectingOperator = true; |
3264 | 3264 | } else { |
3265 | - $stack->push('Operand Count for Function '.strtoupper($val).')', 1); |
|
3265 | + $stack->push('Operand Count for Function ' . strtoupper($val) . ')', 1); |
|
3266 | 3266 | $expectingOperator = false; |
3267 | 3267 | } |
3268 | 3268 | $stack->push('Brace', '('); |
3269 | 3269 | } else { // it's a var w/ implicit multiplication |
3270 | 3270 | $output[] = ['type' => 'Value', 'value' => $matches[1], 'reference' => null]; |
3271 | 3271 | } |
3272 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) { |
|
3272 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $val, $matches)) { |
|
3273 | 3273 | // Watch for this case-change when modifying to allow cell references in different worksheets... |
3274 | 3274 | // Should only be applied to the actual cell column, not the worksheet name |
3275 | 3275 | |
@@ -3281,9 +3281,9 @@ discard block |
||
3281 | 3281 | // Otherwise, we 'inherit' the worksheet reference from the start cell reference |
3282 | 3282 | // The start of the cell range reference should be the last entry in $output |
3283 | 3283 | $startCellRef = $output[count($output) - 1]['value']; |
3284 | - preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $startCellRef, $startMatches); |
|
3284 | + preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $startCellRef, $startMatches); |
|
3285 | 3285 | if ($startMatches[2] > '') { |
3286 | - $val = $startMatches[2].'!'.$val; |
|
3286 | + $val = $startMatches[2] . '!' . $val; |
|
3287 | 3287 | } |
3288 | 3288 | } else { |
3289 | 3289 | return $this->raiseFormulaError('3D Range references are not yet supported'); |
@@ -3314,14 +3314,14 @@ discard block |
||
3314 | 3314 | ($startRowColRef <= 1048576) && ($val <= 1048576)) { |
3315 | 3315 | // Row range |
3316 | 3316 | $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 |
3317 | - $output[count($output) - 1]['value'] = $rangeWS1.'A'.$startRowColRef; |
|
3318 | - $val = $rangeWS2.$endRowColRef.$val; |
|
3317 | + $output[count($output) - 1]['value'] = $rangeWS1 . 'A' . $startRowColRef; |
|
3318 | + $val = $rangeWS2 . $endRowColRef . $val; |
|
3319 | 3319 | } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) && |
3320 | 3320 | (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) { |
3321 | 3321 | // Column range |
3322 | 3322 | $endRowColRef = ($pCellParent !== null) ? $pCellParent->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 |
3323 | - $output[count($output) - 1]['value'] = $rangeWS1.strtoupper($startRowColRef).'1'; |
|
3324 | - $val = $rangeWS2.$val.$endRowColRef; |
|
3323 | + $output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1'; |
|
3324 | + $val = $rangeWS2 . $val . $endRowColRef; |
|
3325 | 3325 | } |
3326 | 3326 | } |
3327 | 3327 | |
@@ -3383,7 +3383,7 @@ discard block |
||
3383 | 3383 | } |
3384 | 3384 | // If we're expecting an operator, but only have a space between the previous and next operands (and both are |
3385 | 3385 | // Cell References) then we have an INTERSECTION operator |
3386 | - if (($expectingOperator) && (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'.*/Ui', substr($formula, $index), $match)) && |
|
3386 | + if (($expectingOperator) && (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) && |
|
3387 | 3387 | ($output[count($output) - 1]['type'] == 'Cell Reference')) { |
3388 | 3388 | while ($stack->count() > 0 && |
3389 | 3389 | ($o2 = $stack->last()) && |
@@ -3416,7 +3416,7 @@ discard block |
||
3416 | 3416 | $cKeys = array_keys(array_keys($operand[$rowKey])); |
3417 | 3417 | $colKey = array_shift($cKeys); |
3418 | 3418 | if (ctype_upper($colKey)) { |
3419 | - $operandData['reference'] = $colKey.$rowKey; |
|
3419 | + $operandData['reference'] = $colKey . $rowKey; |
|
3420 | 3420 | } |
3421 | 3421 | } |
3422 | 3422 | |
@@ -3490,20 +3490,20 @@ discard block |
||
3490 | 3490 | if ($sheet1 == $sheet2) { |
3491 | 3491 | if ($operand1Data['reference'] === null) { |
3492 | 3492 | if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) { |
3493 | - $operand1Data['reference'] = $pCell->getColumn().$operand1Data['value']; |
|
3493 | + $operand1Data['reference'] = $pCell->getColumn() . $operand1Data['value']; |
|
3494 | 3494 | } elseif (trim($operand1Data['reference']) == '') { |
3495 | 3495 | $operand1Data['reference'] = $pCell->getCoordinate(); |
3496 | 3496 | } else { |
3497 | - $operand1Data['reference'] = $operand1Data['value'].$pCell->getRow(); |
|
3497 | + $operand1Data['reference'] = $operand1Data['value'] . $pCell->getRow(); |
|
3498 | 3498 | } |
3499 | 3499 | } |
3500 | 3500 | if ($operand2Data['reference'] === null) { |
3501 | 3501 | if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) { |
3502 | - $operand2Data['reference'] = $pCell->getColumn().$operand2Data['value']; |
|
3502 | + $operand2Data['reference'] = $pCell->getColumn() . $operand2Data['value']; |
|
3503 | 3503 | } elseif (trim($operand2Data['reference']) == '') { |
3504 | 3504 | $operand2Data['reference'] = $pCell->getCoordinate(); |
3505 | 3505 | } else { |
3506 | - $operand2Data['reference'] = $operand2Data['value'].$pCell->getRow(); |
|
3506 | + $operand2Data['reference'] = $operand2Data['value'] . $pCell->getRow(); |
|
3507 | 3507 | } |
3508 | 3508 | } |
3509 | 3509 | |
@@ -3514,7 +3514,7 @@ discard block |
||
3514 | 3514 | $oCol[] = Cell::columnIndexFromString($oCR[0]) - 1; |
3515 | 3515 | $oRow[] = $oCR[1]; |
3516 | 3516 | } |
3517 | - $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); |
|
3517 | + $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow); |
|
3518 | 3518 | if ($pCellParent !== null) { |
3519 | 3519 | $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($sheet1), false); |
3520 | 3520 | } else { |
@@ -3564,7 +3564,7 @@ discard block |
||
3564 | 3564 | $result = '#VALUE!'; |
3565 | 3565 | } |
3566 | 3566 | } else { |
3567 | - $result = '"'.str_replace('""', '"', self::unwrapResult($operand1, '"').self::unwrapResult($operand2, '"')).'"'; |
|
3567 | + $result = '"' . str_replace('""', '"', self::unwrapResult($operand1, '"') . self::unwrapResult($operand2, '"')) . '"'; |
|
3568 | 3568 | } |
3569 | 3569 | $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); |
3570 | 3570 | $stack->push('Value', $result); |
@@ -3579,7 +3579,7 @@ discard block |
||
3579 | 3579 | $cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]); |
3580 | 3580 | } |
3581 | 3581 | } |
3582 | - $cellRef = Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.Cell::stringFromColumnIndex(max($oCol)).max($oRow); |
|
3582 | + $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow); |
|
3583 | 3583 | $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect)); |
3584 | 3584 | $stack->push('Value', $cellIntersect, $cellRef); |
3585 | 3585 | break; |
@@ -3613,14 +3613,14 @@ discard block |
||
3613 | 3613 | } else { |
3614 | 3614 | $this->executeNumericBinaryOperation($cellID, $multiplier, $arg, '*', 'arrayTimesEquals', $stack); |
3615 | 3615 | } |
3616 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) { |
|
3616 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) { |
|
3617 | 3617 | $cellRef = null; |
3618 | 3618 | if (isset($matches[8])) { |
3619 | 3619 | if ($pCell === null) { |
3620 | 3620 | // We can't access the range, so return a REF error |
3621 | 3621 | $cellValue = Calculation\Functions::REF(); |
3622 | 3622 | } else { |
3623 | - $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; |
|
3623 | + $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; |
|
3624 | 3624 | if ($matches[2] > '') { |
3625 | 3625 | $matches[2] = trim($matches[2], "\"'"); |
3626 | 3626 | if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { |
@@ -3650,7 +3650,7 @@ discard block |
||
3650 | 3650 | // We can't access the cell, so return a REF error |
3651 | 3651 | $cellValue = Calculation\Functions::REF(); |
3652 | 3652 | } else { |
3653 | - $cellRef = $matches[6].$matches[7]; |
|
3653 | + $cellRef = $matches[6] . $matches[7]; |
|
3654 | 3654 | if ($matches[2] > '') { |
3655 | 3655 | $matches[2] = trim($matches[2], "\"'"); |
3656 | 3656 | if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { |
@@ -3685,7 +3685,7 @@ discard block |
||
3685 | 3685 | $stack->push('Value', $cellValue, $cellRef); |
3686 | 3686 | |
3687 | 3687 | // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on |
3688 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $token, $matches)) { |
|
3688 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) { |
|
3689 | 3689 | $functionName = $matches[1]; |
3690 | 3690 | $argCount = $stack->pop(); |
3691 | 3691 | $argCount = $argCount['value']; |
@@ -3738,7 +3738,7 @@ discard block |
||
3738 | 3738 | if ($functionName != 'MKMATRIX') { |
3739 | 3739 | if ($this->_debugLog->getWriteDebugLog()) { |
3740 | 3740 | krsort($argArrayVals); |
3741 | - $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); |
|
3741 | + $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Calculation\Functions::flattenArray($argArrayVals)), ' )'); |
|
3742 | 3742 | } |
3743 | 3743 | } |
3744 | 3744 | |
@@ -3769,7 +3769,7 @@ discard block |
||
3769 | 3769 | } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) { |
3770 | 3770 | $stack->push('Value', $token); |
3771 | 3771 | // if the token is a named range, push the named range name onto the stack |
3772 | - } elseif (preg_match('/^'.self::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $token, $matches)) { |
|
3772 | + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) { |
|
3773 | 3773 | $namedRange = $matches[6]; |
3774 | 3774 | $this->_debugLog->writeDebugLog('Evaluating Named Range ', $namedRange); |
3775 | 3775 | $cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false); |
@@ -4084,7 +4084,7 @@ discard block |
||
4084 | 4084 | |
4085 | 4085 | // Extract range |
4086 | 4086 | $aReferences = Cell::extractAllCellReferencesInRange($pRange); |
4087 | - $pRange = $pSheetName.'!'.$pRange; |
|
4087 | + $pRange = $pSheetName . '!' . $pRange; |
|
4088 | 4088 | if (!isset($aReferences[1])) { |
4089 | 4089 | // Single cell in range |
4090 | 4090 | sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow); |
@@ -4143,9 +4143,9 @@ discard block |
||
4143 | 4143 | $splitRange = Cell::splitRange($pRange); |
4144 | 4144 | // Convert row and column references |
4145 | 4145 | if (ctype_alpha($splitRange[0][0])) { |
4146 | - $pRange = $splitRange[0][0].'1:'.$splitRange[0][1].$namedRange->getWorksheet()->getHighestRow(); |
|
4146 | + $pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow(); |
|
4147 | 4147 | } elseif (ctype_digit($splitRange[0][0])) { |
4148 | - $pRange = 'A'.$splitRange[0][0].':'.$namedRange->getWorksheet()->getHighestColumn().$splitRange[0][1]; |
|
4148 | + $pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1]; |
|
4149 | 4149 | } |
4150 | 4150 | } else { |
4151 | 4151 | return Calculation\Functions::REF(); |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @category Date/Time Functions |
475 | 475 | * |
476 | - * @param string $dateValue Text that represents a date in a Microsoft Excel date format. |
|
476 | + * @param integer $dateValue Text that represents a date in a Microsoft Excel date format. |
|
477 | 477 | * For example, "1/30/2008" or "30-Jan-2008" are text strings within |
478 | 478 | * quotation marks that represent dates. Using the default date |
479 | 479 | * system in Excel for Windows, date_text must represent a date from |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | /** |
661 | 661 | * DATEDIF. |
662 | 662 | * |
663 | - * @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
663 | + * @param integer $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
664 | 664 | * or a standard date string |
665 | - * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
665 | + * @param integer $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object |
|
666 | 666 | * or a standard date string |
667 | 667 | * @param string $unit |
668 | 668 | * |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * |
787 | 787 | * @category Date/Time Functions |
788 | 788 | * |
789 | - * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
789 | + * @param integer $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
790 | 790 | * PHP DateTime object, or a standard date string |
791 | - * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
791 | + * @param integer $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
792 | 792 | * PHP DateTime object, or a standard date string |
793 | 793 | * @param bool $method US or European Method |
794 | 794 | * FALSE or omitted: U.S. (NASD) method. If the starting date is |
@@ -847,9 +847,9 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @category Date/Time Functions |
849 | 849 | * |
850 | - * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
850 | + * @param integer $startDate Excel date serial value (float), PHP date timestamp (integer), |
|
851 | 851 | * PHP DateTime object, or a standard date string |
852 | - * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
852 | + * @param integer $endDate Excel date serial value (float), PHP date timestamp (integer), |
|
853 | 853 | * PHP DateTime object, or a standard date string |
854 | 854 | * @param int $method Method used for the calculation |
855 | 855 | * 0 or omitted US (NASD) 30/360 |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | * Excel Function: |
1139 | 1139 | * DAY(dateValue) |
1140 | 1140 | * |
1141 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1141 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1142 | 1142 | * PHP DateTime object, or a standard date string |
1143 | 1143 | * |
1144 | 1144 | * @return int Day of the month |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | * Excel Function: |
1250 | 1250 | * WEEKNUM(dateValue[,style]) |
1251 | 1251 | * |
1252 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1252 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1253 | 1253 | * PHP DateTime object, or a standard date string |
1254 | 1254 | * @param int $method Week begins on Sunday or Monday |
1255 | 1255 | * 1 or omitted Week begins on Sunday. |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | * Excel Function: |
1303 | 1303 | * MONTH(dateValue) |
1304 | 1304 | * |
1305 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1305 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1306 | 1306 | * PHP DateTime object, or a standard date string |
1307 | 1307 | * |
1308 | 1308 | * @return int Month of the year |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | * Excel Function: |
1336 | 1336 | * YEAR(dateValue) |
1337 | 1337 | * |
1338 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1338 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1339 | 1339 | * PHP DateTime object, or a standard date string |
1340 | 1340 | * |
1341 | 1341 | * @return int Year |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | * Excel Function: |
1368 | 1368 | * HOUR(timeValue) |
1369 | 1369 | * |
1370 | - * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1370 | + * @param integer $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1371 | 1371 | * PHP DateTime object, or a standard time string |
1372 | 1372 | * |
1373 | 1373 | * @return int Hour |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | * Excel Function: |
1409 | 1409 | * MINUTE(timeValue) |
1410 | 1410 | * |
1411 | - * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1411 | + * @param integer $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1412 | 1412 | * PHP DateTime object, or a standard time string |
1413 | 1413 | * |
1414 | 1414 | * @return int Minute |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | * Excel Function: |
1450 | 1450 | * SECOND(timeValue) |
1451 | 1451 | * |
1452 | - * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1452 | + * @param integer $timeValue Excel date serial value (float), PHP date timestamp (integer), |
|
1453 | 1453 | * PHP DateTime object, or a standard time string |
1454 | 1454 | * |
1455 | 1455 | * @return int Second |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | * Excel Function: |
1493 | 1493 | * EDATE(dateValue,adjustmentMonths) |
1494 | 1494 | * |
1495 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1495 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1496 | 1496 | * PHP DateTime object, or a standard date string |
1497 | 1497 | * @param int $adjustmentMonths The number of months before or after start_date. |
1498 | 1498 | * A positive value for months yields a future date; |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | * Excel Function: |
1539 | 1539 | * EOMONTH(dateValue,adjustmentMonths) |
1540 | 1540 | * |
1541 | - * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1541 | + * @param integer $dateValue Excel date serial value (float), PHP date timestamp (integer), |
|
1542 | 1542 | * PHP DateTime object, or a standard date string |
1543 | 1543 | * @param int $adjustmentMonths The number of months before or after start_date. |
1544 | 1544 | * A positive value for months yields a future date; |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | |
131 | 131 | $adjustmentMonthsString = (string) $adjustmentMonths; |
132 | 132 | if ($adjustmentMonths > 0) { |
133 | - $adjustmentMonthsString = '+'.$adjustmentMonths; |
|
133 | + $adjustmentMonthsString = '+' . $adjustmentMonths; |
|
134 | 134 | } |
135 | 135 | if ($adjustmentMonths != 0) { |
136 | - $PHPDateObject->modify($adjustmentMonthsString.' months'); |
|
136 | + $PHPDateObject->modify($adjustmentMonthsString . ' months'); |
|
137 | 137 | } |
138 | 138 | $nMonth = (int) $PHPDateObject->format('m'); |
139 | 139 | $nYear = (int) $PHPDateObject->format('Y'); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12); |
142 | 142 | if ($monthDiff != $adjustmentMonths) { |
143 | 143 | $adjustDays = (int) $PHPDateObject->format('d'); |
144 | - $adjustDaysString = '-'.$adjustDays.' days'; |
|
144 | + $adjustDaysString = '-' . $adjustDays . ' days'; |
|
145 | 145 | $PHPDateObject->modify($adjustDaysString); |
146 | 146 | } |
147 | 147 | |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | $dayAdjust = floor($hour / 24); |
450 | 450 | $hour = $hour % 24; |
451 | 451 | } |
452 | - $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second); |
|
452 | + $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second); |
|
453 | 453 | if ($dayAdjust != 0) { |
454 | - $phpDateObject->modify($dayAdjust.' days'); |
|
454 | + $phpDateObject->modify($dayAdjust . ' days'); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | return $phpDateObject; |
@@ -546,9 +546,9 @@ discard block |
||
546 | 546 | if ($testVal1 < 31 && $testVal2 < 12 && $testVal3 < 12 && strlen($testVal3) == 2) { |
547 | 547 | $testVal3 += 2000; |
548 | 548 | } |
549 | - $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3); |
|
549 | + $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3); |
|
550 | 550 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
551 | - $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3); |
|
551 | + $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3); |
|
552 | 552 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
553 | 553 | return Functions::VALUE(); |
554 | 554 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | case Functions::RETURNDATE_PHP_NUMERIC: |
589 | 589 | return (int) \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue); |
590 | 590 | case Functions::RETURNDATE_PHP_OBJECT: |
591 | - return new \DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); |
|
591 | + return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | case Functions::RETURNDATE_PHP_NUMERIC: |
651 | 651 | return (int) $phpDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600; |
652 | 652 | case Functions::RETURNDATE_PHP_OBJECT: |
653 | - return new \DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); |
|
653 | + return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); |
|
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | case 'MD': |
727 | 727 | if ($endDays < $startDays) { |
728 | 728 | $retVal = $endDays; |
729 | - $PHPEndDateObject->modify('-'.$endDays.' days'); |
|
729 | + $PHPEndDateObject->modify('-' . $endDays . ' days'); |
|
730 | 730 | $adjustDays = $PHPEndDateObject->format('j'); |
731 | 731 | $retVal += ($adjustDays - $startDays); |
732 | 732 | } else { |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | // Execute function |
1281 | 1281 | $PHPDateObject = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($dateValue); |
1282 | 1282 | $dayOfYear = $PHPDateObject->format('z'); |
1283 | - $PHPDateObject->modify('-'.$dayOfYear.' days'); |
|
1283 | + $PHPDateObject->modify('-' . $dayOfYear . ' days'); |
|
1284 | 1284 | $firstDayOfFirstWeek = $PHPDateObject->format('w'); |
1285 | 1285 | $daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7; |
1286 | 1286 | $interval = $dayOfYear - $daysInFirstWeek; |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | // Execute function |
1565 | 1565 | $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths + 1); |
1566 | 1566 | $adjustDays = (int) $PHPDateObject->format('d'); |
1567 | - $adjustDaysString = '-'.$adjustDays.' days'; |
|
1567 | + $adjustDaysString = '-' . $adjustDays . ' days'; |
|
1568 | 1568 | $PHPDateObject->modify($adjustDaysString); |
1569 | 1569 | |
1570 | 1570 | switch (Functions::getReturnDateType()) { |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | * |
1856 | 1856 | * @param string $complexNumber The complex number for which you want the real coefficient |
1857 | 1857 | * |
1858 | - * @return float |
|
1858 | + * @return string |
|
1859 | 1859 | */ |
1860 | 1860 | public static function IMREAL($complexNumber) |
1861 | 1861 | { |
@@ -2289,7 +2289,6 @@ discard block |
||
2289 | 2289 | * Excel Function: |
2290 | 2290 | * IMSUM(complexNumber[,complexNumber[,...]]) |
2291 | 2291 | * |
2292 | - * @param string $complexNumber,... Series of complex numbers to add |
|
2293 | 2292 | * |
2294 | 2293 | * @return string |
2295 | 2294 | */ |
@@ -2329,7 +2328,6 @@ discard block |
||
2329 | 2328 | * Excel Function: |
2330 | 2329 | * IMPRODUCT(complexNumber[,complexNumber[,...]]) |
2331 | 2330 | * |
2332 | - * @param string $complexNumber,... Series of complex numbers to multiply |
|
2333 | 2331 | * |
2334 | 2332 | * @return string |
2335 | 2333 | */ |
@@ -2373,7 +2371,7 @@ discard block |
||
2373 | 2371 | * DELTA(a[,b]) |
2374 | 2372 | * |
2375 | 2373 | * @param float $a The first number |
2376 | - * @param float $b The second number. If omitted, b is assumed to be zero |
|
2374 | + * @param integer $b The second number. If omitted, b is assumed to be zero |
|
2377 | 2375 | * |
2378 | 2376 | * @return int |
2379 | 2377 | */ |
@@ -2396,7 +2394,7 @@ discard block |
||
2396 | 2394 | * functions you calculate the count of values that exceed a threshold. |
2397 | 2395 | * |
2398 | 2396 | * @param float $number The value to test against step |
2399 | - * @param float $step The threshold value. |
|
2397 | + * @param integer $step The threshold value. |
|
2400 | 2398 | * If you omit a value for step, GESTEP uses zero |
2401 | 2399 | * |
2402 | 2400 | * @return int |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $imaginary = substr($workString, strlen($realNumber)); |
776 | 776 | |
777 | 777 | if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) { |
778 | - $imaginary = $realNumber.'1'; |
|
778 | + $imaginary = $realNumber . '1'; |
|
779 | 779 | $realNumber = '0'; |
780 | 780 | } elseif ($imaginary == '') { |
781 | 781 | $imaginary = $realNumber; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | $complexNumber = substr($complexNumber, 1); |
809 | 809 | } |
810 | 810 | if ($complexNumber{0} == '.') { |
811 | - $complexNumber = '0'.$complexNumber; |
|
811 | + $complexNumber = '0' . $complexNumber; |
|
812 | 812 | } |
813 | 813 | if ($complexNumber{0} == '+') { |
814 | 814 | $complexNumber = substr($complexNumber, 1); |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | // Two's Complement |
1178 | 1178 | $x = substr($x, -9); |
1179 | 1179 | |
1180 | - return '-'.(512 - bindec($x)); |
|
1180 | + return '-' . (512 - bindec($x)); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | return bindec($x); |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | return Functions::NAN(); |
1233 | 1233 | } elseif (strlen($x) == 10) { |
1234 | 1234 | // Two's Complement |
1235 | - return str_repeat('F', 8).substr(strtoupper(dechex(bindec(substr($x, -9)))), -2); |
|
1235 | + return str_repeat('F', 8) . substr(strtoupper(dechex(bindec(substr($x, -9)))), -2); |
|
1236 | 1236 | } |
1237 | 1237 | $hexVal = (string) strtoupper(dechex(bindec($x))); |
1238 | 1238 | |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | return Functions::NAN(); |
1288 | 1288 | } elseif (strlen($x) == 10) { |
1289 | 1289 | // Two's Complement |
1290 | - return str_repeat('7', 7).substr(strtoupper(decoct(bindec(substr($x, -9)))), -3); |
|
1290 | + return str_repeat('7', 7) . substr(strtoupper(decoct(bindec(substr($x, -9)))), -3); |
|
1291 | 1291 | } |
1292 | 1292 | $octVal = (string) decoct(bindec($x)); |
1293 | 1293 | |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | $r = strtoupper(dechex($x)); |
1405 | 1405 | if (strlen($r) == 8) { |
1406 | 1406 | // Two's Complement |
1407 | - $r = 'FF'.$r; |
|
1407 | + $r = 'FF' . $r; |
|
1408 | 1408 | } |
1409 | 1409 | |
1410 | 1410 | return self::nbrConversionFormat($r, $places); |
@@ -1798,22 +1798,22 @@ discard block |
||
1798 | 1798 | } elseif ($imaginary == 1.0) { |
1799 | 1799 | return (string) $suffix; |
1800 | 1800 | } elseif ($imaginary == -1.0) { |
1801 | - return (string) '-'.$suffix; |
|
1801 | + return (string) '-' . $suffix; |
|
1802 | 1802 | } |
1803 | 1803 | |
1804 | - return (string) $imaginary.$suffix; |
|
1804 | + return (string) $imaginary . $suffix; |
|
1805 | 1805 | } elseif ($imaginary == 0.0) { |
1806 | 1806 | return (string) $realNumber; |
1807 | 1807 | } elseif ($imaginary == 1.0) { |
1808 | - return (string) $realNumber.'+'.$suffix; |
|
1808 | + return (string) $realNumber . '+' . $suffix; |
|
1809 | 1809 | } elseif ($imaginary == -1.0) { |
1810 | - return (string) $realNumber.'-'.$suffix; |
|
1810 | + return (string) $realNumber . '-' . $suffix; |
|
1811 | 1811 | } |
1812 | 1812 | if ($imaginary > 0) { |
1813 | - $imaginary = (string) '+'.$imaginary; |
|
1813 | + $imaginary = (string) '+' . $imaginary; |
|
1814 | 1814 | } |
1815 | 1815 | |
1816 | - return (string) $realNumber.$imaginary.$suffix; |
|
1816 | + return (string) $realNumber . $imaginary . $suffix; |
|
1817 | 1817 | } |
1818 | 1818 | |
1819 | 1819 | return Functions::VALUE(); |
@@ -2238,9 +2238,9 @@ discard block |
||
2238 | 2238 | $i = $d2 / $d3; |
2239 | 2239 | |
2240 | 2240 | if ($i > 0.0) { |
2241 | - return self::cleanComplex($r.'+'.$i.$parsedComplexDivisor['suffix']); |
|
2241 | + return self::cleanComplex($r . '+' . $i . $parsedComplexDivisor['suffix']); |
|
2242 | 2242 | } elseif ($i < 0.0) { |
2243 | - return self::cleanComplex($r.$i.$parsedComplexDivisor['suffix']); |
|
2243 | + return self::cleanComplex($r . $i . $parsedComplexDivisor['suffix']); |
|
2244 | 2244 | } else { |
2245 | 2245 | return $r; |
2246 | 2246 | } |
@@ -62,6 +62,10 @@ discard block |
||
62 | 62 | return $testDate->format('d') == 1; |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param integer $frequency |
|
67 | + * @param boolean $next |
|
68 | + */ |
|
65 | 69 | private static function couponFirstPeriodDate($settlement, $maturity, $frequency, $next) |
66 | 70 | { |
67 | 71 | $months = 12 / $frequency; |
@@ -83,6 +87,9 @@ discard block |
||
83 | 87 | return \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($result); |
84 | 88 | } |
85 | 89 | |
90 | + /** |
|
91 | + * @param integer $frequency |
|
92 | + */ |
|
86 | 93 | private static function isValidFrequency($frequency) |
87 | 94 | { |
88 | 95 | if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) { |
@@ -161,7 +168,7 @@ discard block |
||
161 | 168 | * The security settlement date is the date after the issue date |
162 | 169 | * when the security is traded to the buyer |
163 | 170 | * @param float $rate The security's annual coupon rate |
164 | - * @param float $par The security's par value. |
|
171 | + * @param integer $par The security's par value. |
|
165 | 172 | * If you omit par, ACCRINT uses $1,000 |
166 | 173 | * @param int $frequency the number of coupon payments per year. |
167 | 174 | * Valid frequency values are: |
@@ -435,6 +442,7 @@ discard block |
||
435 | 442 | * 2 Actual/360 |
436 | 443 | * 3 Actual/365 |
437 | 444 | * 4 European 30/360 |
445 | + * @param integer $frequency |
|
438 | 446 | * |
439 | 447 | * @return float |
440 | 448 | */ |
@@ -571,6 +579,7 @@ discard block |
||
571 | 579 | * 2 Actual/360 |
572 | 580 | * 3 Actual/365 |
573 | 581 | * 4 European 30/360 |
582 | + * @param integer $frequency |
|
574 | 583 | * |
575 | 584 | * @return float |
576 | 585 | */ |
@@ -688,6 +697,7 @@ discard block |
||
688 | 697 | * 2 Actual/360 |
689 | 698 | * 3 Actual/365 |
690 | 699 | * 4 European 30/360 |
700 | + * @param integer $frequency |
|
691 | 701 | * |
692 | 702 | * @return int |
693 | 703 | */ |
@@ -1159,7 +1169,7 @@ discard block |
||
1159 | 1169 | * |
1160 | 1170 | * @category Financial Functions |
1161 | 1171 | * |
1162 | - * @param float $nominal_rate Nominal interest rate |
|
1172 | + * @param integer $nominal_rate Nominal interest rate |
|
1163 | 1173 | * @param int $npery Number of compounding payments per year |
1164 | 1174 | * |
1165 | 1175 | * @return float |
@@ -1187,12 +1197,12 @@ discard block |
||
1187 | 1197 | * |
1188 | 1198 | * @category Financial Functions |
1189 | 1199 | * |
1190 | - * @param float $rate The interest rate per period |
|
1200 | + * @param integer $rate The interest rate per period |
|
1191 | 1201 | * @param int $nper Total number of payment periods in an annuity |
1192 | - * @param float $pmt The payment made each period: it cannot change over the |
|
1202 | + * @param integer $pmt The payment made each period: it cannot change over the |
|
1193 | 1203 | * life of the annuity. Typically, pmt contains principal |
1194 | 1204 | * and interest but no other fees or taxes |
1195 | - * @param float $pv Present Value, or the lump-sum amount that a series of |
|
1205 | + * @param integer $pv Present Value, or the lump-sum amount that a series of |
|
1196 | 1206 | * future payments is worth right now |
1197 | 1207 | * @param int $type A number 0 or 1 and indicates when payments are due: |
1198 | 1208 | * 0 or omitted At the end of the period. |
@@ -1310,7 +1320,7 @@ discard block |
||
1310 | 1320 | * @param int $per Period for which we want to find the interest |
1311 | 1321 | * @param int $nper Number of periods |
1312 | 1322 | * @param float $pv Present Value |
1313 | - * @param float $fv Future Value |
|
1323 | + * @param integer $fv Future Value |
|
1314 | 1324 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1315 | 1325 | * |
1316 | 1326 | * @return float |
@@ -1505,7 +1515,7 @@ discard block |
||
1505 | 1515 | * |
1506 | 1516 | * Returns the nominal interest rate given the effective rate and the number of compounding payments per year. |
1507 | 1517 | * |
1508 | - * @param float $effect_rate Effective interest rate |
|
1518 | + * @param integer $effect_rate Effective interest rate |
|
1509 | 1519 | * @param int $npery Number of compounding payments per year |
1510 | 1520 | * |
1511 | 1521 | * @return float |
@@ -1529,10 +1539,10 @@ discard block |
||
1529 | 1539 | * |
1530 | 1540 | * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate. |
1531 | 1541 | * |
1532 | - * @param float $rate Interest rate per period |
|
1542 | + * @param integer $rate Interest rate per period |
|
1533 | 1543 | * @param int $pmt Periodic payment (annuity) |
1534 | - * @param float $pv Present Value |
|
1535 | - * @param float $fv Future Value |
|
1544 | + * @param integer $pv Present Value |
|
1545 | + * @param integer $fv Future Value |
|
1536 | 1546 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1537 | 1547 | * |
1538 | 1548 | * @return float |
@@ -1598,10 +1608,10 @@ discard block |
||
1598 | 1608 | * |
1599 | 1609 | * Returns the constant payment (annuity) for a cash flow with a constant interest rate. |
1600 | 1610 | * |
1601 | - * @param float $rate Interest rate per period |
|
1611 | + * @param integer $rate Interest rate per period |
|
1602 | 1612 | * @param int $nper Number of periods |
1603 | - * @param float $pv Present Value |
|
1604 | - * @param float $fv Future Value |
|
1613 | + * @param integer $pv Present Value |
|
1614 | + * @param integer $fv Future Value |
|
1605 | 1615 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1606 | 1616 | * |
1607 | 1617 | * @return float |
@@ -1636,7 +1646,7 @@ discard block |
||
1636 | 1646 | * @param int $per Period for which we want to find the interest |
1637 | 1647 | * @param int $nper Number of periods |
1638 | 1648 | * @param float $pv Present Value |
1639 | - * @param float $fv Future Value |
|
1649 | + * @param integer $fv Future Value |
|
1640 | 1650 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1641 | 1651 | * |
1642 | 1652 | * @return float |
@@ -1821,10 +1831,10 @@ discard block |
||
1821 | 1831 | * |
1822 | 1832 | * Returns the Present Value of a cash flow with constant payments and interest rate (annuities). |
1823 | 1833 | * |
1824 | - * @param float $rate Interest rate per period |
|
1834 | + * @param integer $rate Interest rate per period |
|
1825 | 1835 | * @param int $nper Number of periods |
1826 | - * @param float $pmt Periodic payment (annuity) |
|
1827 | - * @param float $fv Future Value |
|
1836 | + * @param integer $pmt Periodic payment (annuity) |
|
1837 | + * @param integer $fv Future Value |
|
1828 | 1838 | * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period |
1829 | 1839 | * |
1830 | 1840 | * @return float |
@@ -70,10 +70,10 @@ |
||
70 | 70 | $eom = self::isLastDayOfMonth($result); |
71 | 71 | |
72 | 72 | while ($settlement < \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($result)) { |
73 | - $result->modify('-'.$months.' months'); |
|
73 | + $result->modify('-' . $months . ' months'); |
|
74 | 74 | } |
75 | 75 | if ($next) { |
76 | - $result->modify('+'.$months.' months'); |
|
76 | + $result->modify('+' . $months . ' months'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if ($eom) { |
@@ -119,7 +119,7 @@ |
||
119 | 119 | * |
120 | 120 | * @throws Exception |
121 | 121 | * |
122 | - * @return string |
|
122 | + * @return FormulaToken |
|
123 | 123 | */ |
124 | 124 | public function getToken($pId = 0) |
125 | 125 | { |
@@ -80,7 +80,6 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @category Logical Functions |
82 | 82 | * |
83 | - * @param mixed $arg,... Data values |
|
84 | 83 | * |
85 | 84 | * @return string|bool The logical AND of the arguments |
86 | 85 | */ |
@@ -137,7 +136,6 @@ discard block |
||
137 | 136 | * |
138 | 137 | * @category Logical Functions |
139 | 138 | * |
140 | - * @param mixed $arg,... Data values |
|
141 | 139 | * |
142 | 140 | * @return string|bool The logical OR of the arguments |
143 | 141 | */ |
@@ -241,8 +239,8 @@ discard block |
||
241 | 239 | * |
242 | 240 | * @category Logical Functions |
243 | 241 | * |
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 | * |
248 | 246 | * @return mixed The value of returnIfTrue or returnIfFalse determined by condition |