diff --git a/infra/LocaleGenerator.php b/infra/LocaleGenerator.php index b880f6e61d..e996f42725 100644 --- a/infra/LocaleGenerator.php +++ b/infra/LocaleGenerator.php @@ -86,7 +86,13 @@ public function generateLocales(): void protected function buildConfigFileForLocale(string $column, string $locale): void { $language = $this->localeTranslations->getCell($column . self::ENGLISH_LANGUAGE_NAME_ROW)->getValue(); + if (!is_string($language)) { + throw new Exception('Non-string language value at ' . $column . self::ENGLISH_LANGUAGE_NAME_ROW); + } $localeLanguage = $this->localeTranslations->getCell($column . self::LOCALE_LANGUAGE_NAME_ROW)->getValue(); + if (!is_string($localeLanguage)) { + throw new Exception('Non-string locale language value at ' . $column . self::LOCALE_LANGUAGE_NAME_ROW); + } $configFile = $this->openConfigFile($locale, $language, $localeLanguage); $this->writeConfigArgumentSeparator($configFile, $column); @@ -96,6 +102,9 @@ protected function buildConfigFileForLocale(string $column, string $locale): voi foreach ($this->errorCodeMap as $errorCode => $row) { $translationCell = $this->localeTranslations->getCell($column . $row); $translationValue = $translationCell->getValue(); + if ($translationValue !== null && !is_string($translationValue)) { + throw new Exception('Non-string translation value at ' . $column . $row); + } if (!empty($translationValue)) { $errorCodeTranslation = "{$errorCode} = {$translationValue}" . self::EOL; fwrite($configFile, $errorCodeTranslation); @@ -114,6 +123,9 @@ protected function writeConfigArgumentSeparator($configFile, string $column): vo { $translationCell = $this->localeTranslations->getCell($column . self::ARGUMENT_SEPARATOR_ROW); $localeValue = $translationCell->getValue(); + if ($localeValue !== null && !is_string($localeValue)) { + throw new Exception('Non-string locale value at ' . $column . self::CURRENCY_SYMBOL_ROW); + } if (!empty($localeValue)) { $functionTranslation = "ArgumentSeparator = {$localeValue}" . self::EOL; fwrite($configFile, $functionTranslation); @@ -127,6 +139,9 @@ protected function writeConfigCurrencySymbol($configFile, string $column): void { $translationCell = $this->localeTranslations->getCell($column . self::CURRENCY_SYMBOL_ROW); $localeValue = $translationCell->getValue(); + if ($localeValue !== null && !is_string($localeValue)) { + throw new Exception('Non-string locale value at ' . $column . self::CURRENCY_SYMBOL_ROW); + } if (!empty($localeValue)) { $functionTranslation = "currencySymbol = {$localeValue}" . self::EOL; fwrite($configFile, '##' . self::EOL); @@ -141,13 +156,22 @@ protected function writeConfigCurrencySymbol($configFile, string $column): void protected function buildFunctionsFileForLocale(string $column, string $locale): void { $language = $this->functionNameTranslations->getCell($column . self::ENGLISH_LANGUAGE_NAME_ROW)->getValue(); + if (!is_string($language)) { + throw new Exception('Non-string language value at ' . $column . self::ENGLISH_LANGUAGE_NAME_ROW); + } $localeLanguage = $this->functionNameTranslations->getCell($column . self::LOCALE_LANGUAGE_NAME_ROW) ->getValue(); + if (!is_string($localeLanguage)) { + throw new Exception('Non-string locale language value at ' . $column . self::LOCALE_LANGUAGE_NAME_ROW); + } $functionFile = $this->openFunctionNameFile($locale, $language, $localeLanguage); foreach ($this->functionNameMap as $functionName => $row) { $translationCell = $this->functionNameTranslations->getCell($column . $row); $translationValue = $translationCell->getValue(); + if ($translationValue !== null && !is_string($translationValue)) { + throw new Exception('Non-string translation value at ' . $column . $row); + } if ($this->isFunctionCategoryEntry($translationCell)) { $this->writeFileSectionHeader($functionFile, "{$translationValue} ({$functionName})"); } elseif (!array_key_exists($functionName, $this->phpSpreadsheetFunctions) && substr($functionName, 0, 1) !== '*') { diff --git a/samples/Basic/13_Calculation.php b/samples/Basic/13_Calculation.php index f7ea7aa874..3c215315b9 100644 --- a/samples/Basic/13_Calculation.php +++ b/samples/Basic/13_Calculation.php @@ -157,8 +157,9 @@ $helper->log('Calculated data'); for ($col = 'B'; $col != 'G'; ++$col) { for ($row = 14; $row <= 41; ++$row) { + $formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue(); if ( - (($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) + is_string($formula) && ($formula[0] == '=') ) { $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); diff --git a/samples/Basic/13_CalculationCyclicFormulae.php b/samples/Basic/13_CalculationCyclicFormulae.php index c48e736e42..45a9f5b6a5 100644 --- a/samples/Basic/13_CalculationCyclicFormulae.php +++ b/samples/Basic/13_CalculationCyclicFormulae.php @@ -22,8 +22,9 @@ $helper->log('Calculated data'); for ($row = 1; $row <= 2; ++$row) { for ($col = 'A'; $col != 'C'; ++$col) { + $formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue(); if ( - (($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) + is_string($formula) && ($formula[0] == '=') ) { $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); diff --git a/samples/Basic/31_Document_properties_write.php b/samples/Basic/31_Document_properties_write.php index bdce86dde5..4fdd1cfa61 100644 --- a/samples/Basic/31_Document_properties_write.php +++ b/samples/Basic/31_Document_properties_write.php @@ -56,7 +56,7 @@ $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', (int) $propertyValue); + $formattedValue = is_numeric($propertyValue) ? date('d-M-Y H:i:s', (int) $propertyValue) : '*****INVALID*****'; } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; } else { diff --git a/samples/Basic/31_Document_properties_write_xls.php b/samples/Basic/31_Document_properties_write_xls.php index f3a48f95d2..5c4815519c 100644 --- a/samples/Basic/31_Document_properties_write_xls.php +++ b/samples/Basic/31_Document_properties_write_xls.php @@ -56,7 +56,7 @@ $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', (int) $propertyValue); + $formattedValue = is_numeric($propertyValue) ? date('d-M-Y H:i:s', (int) $propertyValue) : '*****INVALID*****'; } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; } else { diff --git a/samples/Basic/45_Quadratic_equation_solver.php b/samples/Basic/45_Quadratic_equation_solver.php index 8e798da2f3..30aabf60f5 100644 --- a/samples/Basic/45_Quadratic_equation_solver.php +++ b/samples/Basic/45_Quadratic_equation_solver.php @@ -59,8 +59,12 @@ $r1Formula = '=IMDIV(IMSUM(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . ')'; $r2Formula = '=IF(' . $discriminant . '=0,"Only one root",IMDIV(IMSUB(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . '))'; - $helper->log(Calculation::getInstance()->calculateFormula($r1Formula)); - $helper->log(Calculation::getInstance()->calculateFormula($r2Formula)); + /** @var string */ + $output = Calculation::getInstance()->calculateFormula($r1Formula); + $helper->log("$output"); + /** @var string */ + $output = Calculation::getInstance()->calculateFormula($r2Formula); + $helper->log("$output"); $callEndTime = microtime(true); $helper->logEndingNotes(); } diff --git a/samples/Calculations/DateTime/DAYS360.php b/samples/Calculations/DateTime/DAYS360.php index b0e2fdbb13..a9f045f746 100644 --- a/samples/Calculations/DateTime/DAYS360.php +++ b/samples/Calculations/DateTime/DAYS360.php @@ -49,9 +49,11 @@ $worksheet->getCell('E' . $row)->getFormattedValue(), $worksheet->getCell('F' . $row)->getFormattedValue() )); - $helper->log(sprintf( - 'Days: %d (US) %d (European)', - $worksheet->getCell('G' . $row)->getCalculatedValue(), - $worksheet->getCell('H' . $row)->getCalculatedValue() - )); + $helper->log( + 'Days: ' + . $worksheet->getCell('G' . $row)->getCalculatedValue() + . ' (US) ' + . $worksheet->getCell('H' . $row)->getCalculatedValue() + . ' (European)' + ); } diff --git a/samples/Calculations/DateTime/EDATE.php b/samples/Calculations/DateTime/EDATE.php index be6e4d1915..a0efe89806 100644 --- a/samples/Calculations/DateTime/EDATE.php +++ b/samples/Calculations/DateTime/EDATE.php @@ -33,11 +33,16 @@ // Test the formulae for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log(sprintf( - '%s and %d months is %d (%s)', - $worksheet->getCell('B' . $row)->getFormattedValue(), - $worksheet->getCell('C' . $row)->getFormattedValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - $worksheet->getCell('D' . $row)->getFormattedValue() - )); + /** @var null|bool|float|int|string */ + $calc = $worksheet->getCell('D' . $row)->getCalculatedValue(); + $helper->log( + $worksheet->getCell('B' . $row)->getFormattedValue() + . ' and ' + . $worksheet->getCell('C' . $row)->getFormattedValue() + . ' months is ' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('D' . $row)->getFormattedValue() + . ')' + ); } diff --git a/samples/Calculations/DateTime/EOMONTH.php b/samples/Calculations/DateTime/EOMONTH.php index e0b7568a01..27882b97c6 100644 --- a/samples/Calculations/DateTime/EOMONTH.php +++ b/samples/Calculations/DateTime/EOMONTH.php @@ -33,11 +33,14 @@ // Test the formulae for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log(sprintf( - '%s and %d months is %d (%s)', - $worksheet->getCell('B' . $row)->getFormattedValue(), - $worksheet->getCell('C' . $row)->getFormattedValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - $worksheet->getCell('D' . $row)->getFormattedValue() - )); + $helper->log( + $worksheet->getCell('B' . $row)->getFormattedValue() + . ' and ' + . $worksheet->getCell('C' . $row)->getFormattedValue() + . ' months is ' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('D' . $row)->getFormattedValue() + . ')' + ); } diff --git a/samples/Calculations/DateTime/NETWORKDAYS.php b/samples/Calculations/DateTime/NETWORKDAYS.php index 585c04380f..3f0d409a05 100644 --- a/samples/Calculations/DateTime/NETWORKDAYS.php +++ b/samples/Calculations/DateTime/NETWORKDAYS.php @@ -56,11 +56,15 @@ $helper->displayGrid($holidayData); for ($row = 1; $row <= 12; ++$row) { - $helper->log(sprintf( - 'Between %s and %s is %d working days; %d with public holidays', - $worksheet->getCell('A1')->getFormattedValue(), - $worksheet->getCell('B' . $row)->getFormattedValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue() - )); + $helper->log( + 'Between ' + . $worksheet->getCell('A1')->getFormattedValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getFormattedValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ' working days; ' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ' excluding public holidays' + ); } diff --git a/samples/Calculations/DateTime/NOW.php b/samples/Calculations/DateTime/NOW.php index 858a3162b1..e638f647a3 100644 --- a/samples/Calculations/DateTime/NOW.php +++ b/samples/Calculations/DateTime/NOW.php @@ -20,8 +20,10 @@ ->setFormatCode('yyyy-mm-dd hh:mm:ss'); // Test the formulae -$helper->log(sprintf( - 'Today is %f (%s)', - $worksheet->getCell('A1')->getCalculatedValue(), - $worksheet->getCell('A1')->getFormattedValue() -)); +$helper->log( + 'Today is ' + . $worksheet->getCell('A1')->getCalculatedValue() + . ' (' + . $worksheet->getCell('A1')->getFormattedValue() + . ')' +); diff --git a/samples/Calculations/DateTime/TODAY.php b/samples/Calculations/DateTime/TODAY.php index 031149d597..e36fc9eb82 100644 --- a/samples/Calculations/DateTime/TODAY.php +++ b/samples/Calculations/DateTime/TODAY.php @@ -20,8 +20,10 @@ ->setFormatCode('yyyy-mm-dd'); // Test the formulae -$helper->log(sprintf( - 'Today is %d (%s)', - $worksheet->getCell('A1')->getCalculatedValue(), - $worksheet->getCell('A1')->getFormattedValue() -)); +$helper->log( + 'Today is ' + . $worksheet->getCell('A1')->getCalculatedValue() + . ' (' + . $worksheet->getCell('A1')->getFormattedValue() + . ')' +); diff --git a/samples/Calculations/DateTime/WEEKDAY.php b/samples/Calculations/DateTime/WEEKDAY.php index 7d4b4288b2..df4854dc69 100644 --- a/samples/Calculations/DateTime/WEEKDAY.php +++ b/samples/Calculations/DateTime/WEEKDAY.php @@ -47,12 +47,14 @@ // Test the formulae for ($row = 1; $row <= $testDateCount; ++$row) { $helper->log(sprintf('(E%d): %s', $row, $worksheet->getCell('E' . $row)->getFormattedValue())); - $helper->log(sprintf( - 'Weekday is: %d (1-7 = Sun-Sat)', - $worksheet->getCell('F' . $row)->getCalculatedValue() - )); - $helper->log(sprintf( - 'Weekday is: %d (1-7 = Mon-Sun)', - $worksheet->getCell('G' . $row)->getCalculatedValue() - )); + $helper->log( + 'Weekday is: ' + . $worksheet->getCell('F' . $row)->getCalculatedValue() + . ' (1-7 = Sun-Sat)' + ); + $helper->log( + 'Weekday is: ' + . $worksheet->getCell('G' . $row)->getCalculatedValue() + . ' (1-7 = Mon-Sun)' + ); } diff --git a/samples/Calculations/DateTime/YEARFRAC.php b/samples/Calculations/DateTime/YEARFRAC.php index 81b36435d7..4da0ae0121 100644 --- a/samples/Calculations/DateTime/YEARFRAC.php +++ b/samples/Calculations/DateTime/YEARFRAC.php @@ -53,24 +53,29 @@ $worksheet->getCell('E' . $row)->getFormattedValue(), $worksheet->getCell('F' . $row)->getFormattedValue() )); - $helper->log(sprintf( - 'Days: %f - US (NASD) 30/360', - $worksheet->getCell('G' . $row)->getCalculatedValue() - )); - $helper->log(sprintf( - 'Days: %f - Actual', - $worksheet->getCell('H' . $row)->getCalculatedValue() - )); - $helper->log(sprintf( - 'Days: %f - Actual/360', - $worksheet->getCell('I' . $row)->getCalculatedValue() - )); - $helper->log(sprintf( - 'Days: %f - Actual/365', - $worksheet->getCell('J' . $row)->getCalculatedValue() - )); - $helper->log(sprintf( - 'Days: %f - European 30/360', - $worksheet->getCell('K' . $row)->getCalculatedValue() - )); + $helper->log( + 'Days: ' + . $worksheet->getCell('G' . $row)->getCalculatedValue() + . ' - US (NASD) 30/360' + ); + $helper->log( + 'Days: ' + . $worksheet->getCell('H' . $row)->getCalculatedValue() + . ' - Actual' + ); + $helper->log( + 'Days: ' + . $worksheet->getCell('I' . $row)->getCalculatedValue() + . ' - Actual/360' + ); + $helper->log( + 'Days: ' + . $worksheet->getCell('J' . $row)->getCalculatedValue() + . ' - Actual/365' + ); + $helper->log( + 'Days: ' + . $worksheet->getCell('K' . $row)->getCalculatedValue() + . ' - European 30/360' + ); } diff --git a/samples/Calculations/Engineering/BESSELI.php b/samples/Calculations/Engineering/BESSELI.php index bd5d9b7150..d2c3484381 100644 --- a/samples/Calculations/Engineering/BESSELI.php +++ b/samples/Calculations/Engineering/BESSELI.php @@ -18,12 +18,9 @@ for ($n = 0; $n <= 5; ++$n) { for ($x = 0; $x <= 5; $x = $x + 0.25) { Calculation::getInstance($spreadsheet)->flushInstance(); - $worksheet->setCellValue('A1', "=BESSELI({$x}, {$n})"); + $formula = "BESSELI({$x}, {$n})"; + $worksheet->setCellValue('A1', "=$formula"); - $helper->log(sprintf( - '%s = %f', - $worksheet->getCell('A1')->getValue(), - $worksheet->getCell('A1')->getCalculatedValue() - )); + $helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue()); } } diff --git a/samples/Calculations/Engineering/BESSELJ.php b/samples/Calculations/Engineering/BESSELJ.php index 3aa4788682..6a3d9c8ca7 100644 --- a/samples/Calculations/Engineering/BESSELJ.php +++ b/samples/Calculations/Engineering/BESSELJ.php @@ -18,12 +18,9 @@ for ($n = 0; $n <= 5; ++$n) { for ($x = 0; $x <= 5; $x = $x + 0.25) { Calculation::getInstance($spreadsheet)->flushInstance(); - $worksheet->setCellValue('A1', "=BESSELJ({$x}, {$n})"); + $formula = "BESSELJ({$x}, {$n})"; + $worksheet->setCellValue('A1', "=$formula"); - $helper->log(sprintf( - '%s = %f', - $worksheet->getCell('A1')->getValue(), - $worksheet->getCell('A1')->getCalculatedValue() - )); + $helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue()); } } diff --git a/samples/Calculations/Engineering/BESSELK.php b/samples/Calculations/Engineering/BESSELK.php index ee8698e94a..e45e3de770 100644 --- a/samples/Calculations/Engineering/BESSELK.php +++ b/samples/Calculations/Engineering/BESSELK.php @@ -18,12 +18,9 @@ for ($n = 0; $n <= 5; ++$n) { for ($x = 0; $x <= 5; $x = $x + 0.25) { Calculation::getInstance($spreadsheet)->flushInstance(); - $worksheet->setCellValue('A1', "=BESSELK({$x}, {$n})"); + $formula = "BESSELK({$x}, {$n})"; + $worksheet->setCellValue('A1', "=$formula"); - $helper->log(sprintf( - '%s = %f', - $worksheet->getCell('A1')->getValue(), - $worksheet->getCell('A1')->getCalculatedValue() - )); + $helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue()); } } diff --git a/samples/Calculations/Engineering/BESSELY.php b/samples/Calculations/Engineering/BESSELY.php index 750b7204bc..7bf16d26eb 100644 --- a/samples/Calculations/Engineering/BESSELY.php +++ b/samples/Calculations/Engineering/BESSELY.php @@ -18,12 +18,9 @@ for ($n = 0; $n <= 5; ++$n) { for ($x = 0; $x <= 5; $x = $x + 0.25) { Calculation::getInstance($spreadsheet)->flushInstance(); - $worksheet->setCellValue('A1', "=BESSELY({$x}, {$n})"); + $formula = "BESSELY({$x}, {$n})"; + $worksheet->setCellValue('A1', "=$formula"); - $helper->log(sprintf( - '%s = %f', - $worksheet->getCell('A1')->getValue(), - $worksheet->getCell('A1')->getCalculatedValue() - )); + $helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue()); } } diff --git a/samples/Calculations/Engineering/BIN2DEC.php b/samples/Calculations/Engineering/BIN2DEC.php index 0c4c45324c..8f7865ee4d 100644 --- a/samples/Calculations/Engineering/BIN2DEC.php +++ b/samples/Calculations/Engineering/BIN2DEC.php @@ -37,10 +37,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Binary %s is decimal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Binary ' . $worksheet->getCell("A$row")->getValue() + . ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/BIN2HEX.php b/samples/Calculations/Engineering/BIN2HEX.php index 51a1119977..593999a211 100644 --- a/samples/Calculations/Engineering/BIN2HEX.php +++ b/samples/Calculations/Engineering/BIN2HEX.php @@ -37,10 +37,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Binary %s is hexadecimal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Binary ' . $worksheet->getCell("A$row")->getValue() + . ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/BIN2OCT.php b/samples/Calculations/Engineering/BIN2OCT.php index c320d360a4..be01961092 100644 --- a/samples/Calculations/Engineering/BIN2OCT.php +++ b/samples/Calculations/Engineering/BIN2OCT.php @@ -37,10 +37,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Binary %s is octal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Binary ' . $worksheet->getCell("A$row")->getValue() + . ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/BITAND.php b/samples/Calculations/Engineering/BITAND.php index 2a8f7a3cc5..b174045617 100644 --- a/samples/Calculations/Engineering/BITAND.php +++ b/samples/Calculations/Engineering/BITAND.php @@ -36,14 +36,19 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): Bitwise AND of %d (%s) and %d (%s) is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - $worksheet->getCell('E' . $row)->getCalculatedValue(), - $worksheet->getCell('F' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): Bitwise AND of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ') and ' + . $worksheet->getCell('B' . $row)->getValue() + . '(' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ') is ' + . $worksheet->getCell('E' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('F' . $row)->getCalculatedValue() + . ')' + ); } diff --git a/samples/Calculations/Engineering/BITLSHIFT.php b/samples/Calculations/Engineering/BITLSHIFT.php index 872c8098db..57da865f9d 100644 --- a/samples/Calculations/Engineering/BITLSHIFT.php +++ b/samples/Calculations/Engineering/BITLSHIFT.php @@ -38,28 +38,37 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): Bitwise Left Shift of %d (%s) by 1 bit is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - )); - $helper->log(sprintf( - '(E%d): Bitwise Left Shift of %d (%s) by 2 bits is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - $worksheet->getCell('E' . $row)->getCalculatedValue(), - $worksheet->getCell('F' . $row)->getCalculatedValue(), - )); - $helper->log(sprintf( - '(E%d): Bitwise Left Shift of %d (%s) by 3 bits is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - $worksheet->getCell('G' . $row)->getCalculatedValue(), - $worksheet->getCell('H' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): Bitwise Left Shift of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ') by 1 bit is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ')' + ); + $helper->log( + "(E$row): Bitwise Left Shift of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ') by 2 bits is ' + . $worksheet->getCell('E' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('F' . $row)->getCalculatedValue() + . ')' + ); + $helper->log( + "(E$row): Bitwise Left Shift of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ') by 3 bits is ' + . $worksheet->getCell('G' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('H' . $row)->getCalculatedValue() + . ')' + ); } diff --git a/samples/Calculations/Engineering/BITOR.php b/samples/Calculations/Engineering/BITOR.php index 1bf7f71d11..10469be2b7 100644 --- a/samples/Calculations/Engineering/BITOR.php +++ b/samples/Calculations/Engineering/BITOR.php @@ -36,14 +36,19 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): Bitwise OR of %d (%s) and %d (%s) is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - $worksheet->getCell('E' . $row)->getCalculatedValue(), - $worksheet->getCell('F' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): Bitwise OR of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ') and ' + . $worksheet->getCell('B' . $row)->getValue() + . '(' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ') is ' + . $worksheet->getCell('E' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('F' . $row)->getCalculatedValue() + . ')' + ); } diff --git a/samples/Calculations/Engineering/BITRSHIFT.php b/samples/Calculations/Engineering/BITRSHIFT.php index 3e7f3a88d5..ac0415209b 100644 --- a/samples/Calculations/Engineering/BITRSHIFT.php +++ b/samples/Calculations/Engineering/BITRSHIFT.php @@ -36,28 +36,37 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): Bitwise Right Shift of %d (%s) by 1 bit is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - )); - $helper->log(sprintf( - '(E%d): Bitwise Right Shift of %d (%s) by 2 bits is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - $worksheet->getCell('E' . $row)->getCalculatedValue(), - $worksheet->getCell('F' . $row)->getCalculatedValue(), - )); - $helper->log(sprintf( - '(E%d): Bitwise Right Shift of %d (%s) by 3 bits is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - $worksheet->getCell('G' . $row)->getCalculatedValue(), - $worksheet->getCell('H' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): Bitwise Right Shift of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ') by 1 bit is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ')' + ); + $helper->log( + "(E$row): Bitwise Right Shift of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ') by 2 bits is ' + . $worksheet->getCell('E' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('F' . $row)->getCalculatedValue() + . ')' + ); + $helper->log( + "(E$row): Bitwise Right Shift of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ') by 3 bits is ' + . $worksheet->getCell('G' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('H' . $row)->getCalculatedValue() + . ')' + ); } diff --git a/samples/Calculations/Engineering/BITXOR.php b/samples/Calculations/Engineering/BITXOR.php index 482662cd78..fa9f9ede4f 100644 --- a/samples/Calculations/Engineering/BITXOR.php +++ b/samples/Calculations/Engineering/BITXOR.php @@ -36,14 +36,19 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): Bitwise XOR of %d (%s) and %d (%s) is %d (%s)', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - $worksheet->getCell('E' . $row)->getCalculatedValue(), - $worksheet->getCell('F' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): Bitwise XOR of " + . $worksheet->getCell('A' . $row)->getValue() + . ' (' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ') and ' + . $worksheet->getCell('B' . $row)->getValue() + . '(' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ') is ' + . $worksheet->getCell('E' . $row)->getCalculatedValue() + . ' (' + . $worksheet->getCell('F' . $row)->getCalculatedValue() + . ')' + ); } diff --git a/samples/Calculations/Engineering/COMPLEX.php b/samples/Calculations/Engineering/COMPLEX.php index c58a179777..ff356cb5d1 100644 --- a/samples/Calculations/Engineering/COMPLEX.php +++ b/samples/Calculations/Engineering/COMPLEX.php @@ -32,10 +32,10 @@ } for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(A%d): Formula %s result is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('A' . $row)->getCalculatedValue() - )); + $helper->log( + "(A$row): Formula " + . $worksheet->getCell('A' . $row)->getValue() + . ' result is ' + . $worksheet->getCell('A' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/CONVERT.php b/samples/Calculations/Engineering/CONVERT.php index bce56ba507..7b8c889fef 100644 --- a/samples/Calculations/Engineering/CONVERT.php +++ b/samples/Calculations/Engineering/CONVERT.php @@ -16,43 +16,47 @@ // Add some data $conversions = [ - [1, '"lbm"', '"kg"'], - [1, '"gal"', '"l"'], - [24, '"in"', '"ft"'], - [100, '"yd"', '"m"'], - [500, '"mi"', '"km"'], - [7.5, '"min"', '"sec"'], - [5, '"F"', '"C"'], - [32, '"C"', '"K"'], - [100, '"m2"', '"ft2"'], + [1, 'lbm', 'kg'], + [1, 'gal', 'l'], + [24, 'in', 'ft'], + [100, 'yd', 'm'], + [500, 'mi', 'km'], + [7.5, 'min', 'sec'], + [5, 'F', 'C'], + [32, 'C', 'K'], + [100, 'm2', 'ft2'], ]; $testDataCount = count($conversions); $worksheet->fromArray($conversions, null, 'A1'); for ($row = 1; $row <= $testDataCount; ++$row) { - $worksheet->setCellValue('D' . $row, '=CONVERT(' . implode(',', $conversions[$row - 1]) . ')'); + $data = $conversions[$row - 1]; + $worksheet->setCellValue("D$row", "=CONVERT({$data[0]},\"{$data[1]}\",\"{$data[2]}\")"); } $worksheet->setCellValue('H1', '=CONVERT(CONVERT(100,"m","ft"),"m","ft")'); for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(A%d): Unit of Measure Conversion Formula %s - %d %s is %f %s', - $row, - $worksheet->getCell('D' . $row)->getValue(), - $worksheet->getCell('A' . $row)->getValue(), - trim($worksheet->getCell('B' . $row)->getValue(), '"'), - $worksheet->getCell('D' . $row)->getCalculatedValue(), - trim($worksheet->getCell('C' . $row)->getValue(), '"') - )); + $helper->log( + "(A$row): Unit of Measure Conversion Formula " + . $worksheet->getCell('D' . $row)->getValue() + . ' - ' + . $worksheet->getCell('A' . $row)->getValue() + . ' ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('D' . $row)->getCalculatedValue() + . ' ' + . $worksheet->getCell('C' . $row)->getValue() + ); } $helper->log('Old method for area conversions, before MS Excel introduced area Units of Measure'); -$helper->log(sprintf( - '(A%d): Unit of Measure Conversion Formula %s result is %s', - $row, - $worksheet->getCell('H1')->getValue(), - $worksheet->getCell('H1')->getCalculatedValue() -)); +$helper->log( + "(A$row): Unit of Measure Conversion Formula " + . $worksheet->getCell('H1')->getValue() + . ' result is ' + . $worksheet->getCell('H1')->getCalculatedValue() +); diff --git a/samples/Calculations/Engineering/DEC2BIN.php b/samples/Calculations/Engineering/DEC2BIN.php index 2a064c0616..05bcb4289f 100644 --- a/samples/Calculations/Engineering/DEC2BIN.php +++ b/samples/Calculations/Engineering/DEC2BIN.php @@ -38,10 +38,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Decimal %s is binary %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Decimal ' . $worksheet->getCell("A$row")->getValue() + . ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/DEC2HEX.php b/samples/Calculations/Engineering/DEC2HEX.php index 0a19ae544d..9c0368887a 100644 --- a/samples/Calculations/Engineering/DEC2HEX.php +++ b/samples/Calculations/Engineering/DEC2HEX.php @@ -39,10 +39,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Decimal %s is hexadecimal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Decimal ' . $worksheet->getCell("A$row")->getValue() + . ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/DEC2OCT.php b/samples/Calculations/Engineering/DEC2OCT.php index fc11a832bb..f8b467e913 100644 --- a/samples/Calculations/Engineering/DEC2OCT.php +++ b/samples/Calculations/Engineering/DEC2OCT.php @@ -39,10 +39,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Decimal %s is octal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Decimal ' . $worksheet->getCell("A$row")->getValue() + . ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/DELTA.php b/samples/Calculations/Engineering/DELTA.php index cd51b16165..3e1138b1b4 100644 --- a/samples/Calculations/Engineering/DELTA.php +++ b/samples/Calculations/Engineering/DELTA.php @@ -35,12 +35,14 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): Compare values %d and %d - Result is %d - %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - $comparison[$worksheet->getCell('C' . $row)->getCalculatedValue()] - )); + $helper->log( + "(E$row): Compare values " + . $worksheet->getCell('A' . $row)->getValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getValue() + . ' - Result is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + . ' - ' + . $comparison[$worksheet->getCell('C' . $row)->getCalculatedValue()] + ); } diff --git a/samples/Calculations/Engineering/ERF.php b/samples/Calculations/Engineering/ERF.php index e650588893..c555129e5b 100644 --- a/samples/Calculations/Engineering/ERF.php +++ b/samples/Calculations/Engineering/ERF.php @@ -45,23 +45,26 @@ // Test the formulae $helper->log('ERF() With a single argument'); for ($row = 1; $row <= $testDataCount1; ++$row) { - $helper->log(sprintf( - '(C%d): %s The error function integrated between 0 and %f is %f', - $row, - $worksheet->getCell('C' . $row)->getValue(), - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(C$row): " + . $worksheet->getCell('C' . $row)->getValue() + . ' The error function integrated between 0 and ' + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } $helper->log('ERF() With two arguments'); for ($row = $testDataCount1 + 1; $row <= $testDataCount2 + $testDataCount1; ++$row) { - $helper->log(sprintf( - '(C%d): %s The error function integrated between %f and %f is %f', - $row, - $worksheet->getCell('C' . $row)->getValue(), - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(C$row): " + . $worksheet->getCell('C' . $row)->getValue() + . ' The error function integrated between ' + . $worksheet->getCell('A' . $row)->getValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/ERFC.php b/samples/Calculations/Engineering/ERFC.php index 5e7bcc6d08..bfb038fea9 100644 --- a/samples/Calculations/Engineering/ERFC.php +++ b/samples/Calculations/Engineering/ERFC.php @@ -31,11 +31,12 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): %s The complementary error function integrated by %f and infinity is %f', - $row, - $worksheet->getCell('C' . $row)->getValue(), - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): " + . $worksheet->getCell('C' . $row)->getValue() + . ' The complementary error function integrated by ' + . $worksheet->getCell('A' . $row)->getValue() + . ' and infinity is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/GESTEP.php b/samples/Calculations/Engineering/GESTEP.php index 73f0a31cea..fad70fe48a 100644 --- a/samples/Calculations/Engineering/GESTEP.php +++ b/samples/Calculations/Engineering/GESTEP.php @@ -38,16 +38,22 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { + /** @var int */ + $aValue = $worksheet->getCell('A' . $row)->getValue(); + /** @var int */ + $bValue = $worksheet->getCell('B' . $row)->getValue(); + /** @var int */ + $cValue = $worksheet->getCell('C' . $row)->getCalculatedValue(); $helper->log(sprintf( '(E%d): Compare value %d and step %d - Result is %d - %s', $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), + $aValue, + $bValue, + $cValue, sprintf( - $comparison[$worksheet->getCell('C' . $row)->getCalculatedValue()], - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), + $comparison[$cValue], + $aValue, + $bValue, ) )); } diff --git a/samples/Calculations/Engineering/HEX2BIN.php b/samples/Calculations/Engineering/HEX2BIN.php index 2ad0892565..629bdd0235 100644 --- a/samples/Calculations/Engineering/HEX2BIN.php +++ b/samples/Calculations/Engineering/HEX2BIN.php @@ -37,10 +37,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Hexadecimal %s is binary %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Hexadecimal ' . $worksheet->getCell("A$row")->getValue() + . ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/HEX2DEC.php b/samples/Calculations/Engineering/HEX2DEC.php index 745d411054..cb9ec0f496 100644 --- a/samples/Calculations/Engineering/HEX2DEC.php +++ b/samples/Calculations/Engineering/HEX2DEC.php @@ -39,10 +39,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Hexadecimal %s is decimal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Hexadecimal ' . $worksheet->getCell("A$row")->getValue() + . ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/HEX2OCT.php b/samples/Calculations/Engineering/HEX2OCT.php index 3608c1bb3e..86b45675f5 100644 --- a/samples/Calculations/Engineering/HEX2OCT.php +++ b/samples/Calculations/Engineering/HEX2OCT.php @@ -37,10 +37,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Hexadecimal %s is octal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Hexadecimal ' . $worksheet->getCell("A$row")->getValue() + . ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMABS.php b/samples/Calculations/Engineering/IMABS.php index 9c6b843cde..8792472223 100644 --- a/samples/Calculations/Engineering/IMABS.php +++ b/samples/Calculations/Engineering/IMABS.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The absolute value of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The absolute value of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMAGINARY.php b/samples/Calculations/Engineering/IMAGINARY.php index 9913893855..357d84f0c8 100644 --- a/samples/Calculations/Engineering/IMAGINARY.php +++ b/samples/Calculations/Engineering/IMAGINARY.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The imaginary component of %s is %f', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The imaginary component of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMARGUMENT.php b/samples/Calculations/Engineering/IMARGUMENT.php index e559e95133..729e96a599 100644 --- a/samples/Calculations/Engineering/IMARGUMENT.php +++ b/samples/Calculations/Engineering/IMARGUMENT.php @@ -39,10 +39,11 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Theta Argument of %s is %f radians', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Theta Argument of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + . ' radians' + ); } diff --git a/samples/Calculations/Engineering/IMCONJUGATE.php b/samples/Calculations/Engineering/IMCONJUGATE.php index 3b4429ed06..49e506bdb8 100644 --- a/samples/Calculations/Engineering/IMCONJUGATE.php +++ b/samples/Calculations/Engineering/IMCONJUGATE.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Conjugate of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Conjugate value of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMCOS.php b/samples/Calculations/Engineering/IMCOS.php index 5b8f81ea3c..7b2f756af3 100644 --- a/samples/Calculations/Engineering/IMCOS.php +++ b/samples/Calculations/Engineering/IMCOS.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Cosine of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Cosine of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMCOSH.php b/samples/Calculations/Engineering/IMCOSH.php index 9a39376642..18517cda2c 100644 --- a/samples/Calculations/Engineering/IMCOSH.php +++ b/samples/Calculations/Engineering/IMCOSH.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Hyperbolic Cosine of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Hyperbolic Cosine of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMCOT.php b/samples/Calculations/Engineering/IMCOT.php index e3d980cd20..cfb48e0370 100644 --- a/samples/Calculations/Engineering/IMCOT.php +++ b/samples/Calculations/Engineering/IMCOT.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Cotangent of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Cotangent of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMCSC.php b/samples/Calculations/Engineering/IMCSC.php index ab6695d06c..2168ea2d71 100644 --- a/samples/Calculations/Engineering/IMCSC.php +++ b/samples/Calculations/Engineering/IMCSC.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Cosecant of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Cosecant of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMCSCH.php b/samples/Calculations/Engineering/IMCSCH.php index 4513d9e94e..dcee949c15 100644 --- a/samples/Calculations/Engineering/IMCSCH.php +++ b/samples/Calculations/Engineering/IMCSCH.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Hyperbolic Cosecant of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Hyperbolic Cosecant of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMDIV.php b/samples/Calculations/Engineering/IMDIV.php index 9512be573c..1ef348692a 100644 --- a/samples/Calculations/Engineering/IMDIV.php +++ b/samples/Calculations/Engineering/IMDIV.php @@ -32,11 +32,12 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Quotient of %s and %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Quotient of " + . $worksheet->getCell('A' . $row)->getValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMEXP.php b/samples/Calculations/Engineering/IMEXP.php index 7f5837b239..aa96033d38 100644 --- a/samples/Calculations/Engineering/IMEXP.php +++ b/samples/Calculations/Engineering/IMEXP.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Exponential of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Exponential of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMLN.php b/samples/Calculations/Engineering/IMLN.php index 956182573a..f6422bb9cd 100644 --- a/samples/Calculations/Engineering/IMLN.php +++ b/samples/Calculations/Engineering/IMLN.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Natural Logarithm of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Natural Logarithm of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMLOG10.php b/samples/Calculations/Engineering/IMLOG10.php index d501c3deda..586fa1b2ea 100644 --- a/samples/Calculations/Engineering/IMLOG10.php +++ b/samples/Calculations/Engineering/IMLOG10.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Base-10 Logarithm of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Base-10 Logarithm of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMLOG2.php b/samples/Calculations/Engineering/IMLOG2.php index 25986b3986..3fb362e892 100644 --- a/samples/Calculations/Engineering/IMLOG2.php +++ b/samples/Calculations/Engineering/IMLOG2.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Base-2 Logarithm of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Base-2 Logarithm of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMPOWER.php b/samples/Calculations/Engineering/IMPOWER.php index c6674fbe95..d040e3089b 100644 --- a/samples/Calculations/Engineering/IMPOWER.php +++ b/samples/Calculations/Engineering/IMPOWER.php @@ -39,11 +39,12 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): %s raised to the power of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): " + . $worksheet->getCell('A' . $row)->getValue() + . ' raised to the power of ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMPRODUCT.php b/samples/Calculations/Engineering/IMPRODUCT.php index f81bc66684..f21022f8d8 100644 --- a/samples/Calculations/Engineering/IMPRODUCT.php +++ b/samples/Calculations/Engineering/IMPRODUCT.php @@ -32,11 +32,12 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Product of %s and %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Product of " + . $worksheet->getCell('A' . $row)->getValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMREAL.php b/samples/Calculations/Engineering/IMREAL.php index 4e537c0fd7..708a49c4e0 100644 --- a/samples/Calculations/Engineering/IMREAL.php +++ b/samples/Calculations/Engineering/IMREAL.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The real component of %s is %f radians', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The real component of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSEC.php b/samples/Calculations/Engineering/IMSEC.php index e6c524b3ca..d150bbfb07 100644 --- a/samples/Calculations/Engineering/IMSEC.php +++ b/samples/Calculations/Engineering/IMSEC.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Secant of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Secant of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSECH.php b/samples/Calculations/Engineering/IMSECH.php index e07b6e08e4..bced466490 100644 --- a/samples/Calculations/Engineering/IMSECH.php +++ b/samples/Calculations/Engineering/IMSECH.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Hyperbolic Secant of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Hyperbolic Ssecant of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSIN.php b/samples/Calculations/Engineering/IMSIN.php index d3b8c281d9..8786461c0f 100644 --- a/samples/Calculations/Engineering/IMSIN.php +++ b/samples/Calculations/Engineering/IMSIN.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Sine of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Sine of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSINH.php b/samples/Calculations/Engineering/IMSINH.php index ac0a9039be..73b8ea48c7 100644 --- a/samples/Calculations/Engineering/IMSINH.php +++ b/samples/Calculations/Engineering/IMSINH.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Hyperbolic Sine of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Hyperbolic Sine of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSQRT.php b/samples/Calculations/Engineering/IMSQRT.php index c2573c9197..1475836da0 100644 --- a/samples/Calculations/Engineering/IMSQRT.php +++ b/samples/Calculations/Engineering/IMSQRT.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Square Root of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Square Root of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSUB.php b/samples/Calculations/Engineering/IMSUB.php index 90bd27a4f0..a777bfde8f 100644 --- a/samples/Calculations/Engineering/IMSUB.php +++ b/samples/Calculations/Engineering/IMSUB.php @@ -32,11 +32,12 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Difference between %s and %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Difference between " + . $worksheet->getCell('A' . $row)->getValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMSUM.php b/samples/Calculations/Engineering/IMSUM.php index 2a8be32070..464c3d2c2b 100644 --- a/samples/Calculations/Engineering/IMSUM.php +++ b/samples/Calculations/Engineering/IMSUM.php @@ -32,11 +32,12 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Sum of %s and %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getValue(), - $worksheet->getCell('C' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Sum of " + . $worksheet->getCell('A' . $row)->getValue() + . ' and ' + . $worksheet->getCell('B' . $row)->getValue() + . ' is ' + . $worksheet->getCell('C' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/IMTAN.php b/samples/Calculations/Engineering/IMTAN.php index ffaa53b246..492c332934 100644 --- a/samples/Calculations/Engineering/IMTAN.php +++ b/samples/Calculations/Engineering/IMTAN.php @@ -39,10 +39,10 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(E%d): The Tangent of %s is %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(E$row): The Tangent of " + . $worksheet->getCell('A' . $row)->getValue() + . ' is ' + . $worksheet->getCell('B' . $row)->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/OCT2BIN.php b/samples/Calculations/Engineering/OCT2BIN.php index 9c4bbf863d..7a2115bca4 100644 --- a/samples/Calculations/Engineering/OCT2BIN.php +++ b/samples/Calculations/Engineering/OCT2BIN.php @@ -38,10 +38,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Octal %s is binary %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Octal ' . $worksheet->getCell("A$row")->getValue() + . ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/OCT2DEC.php b/samples/Calculations/Engineering/OCT2DEC.php index ea6afb2fb7..c472523e41 100644 --- a/samples/Calculations/Engineering/OCT2DEC.php +++ b/samples/Calculations/Engineering/OCT2DEC.php @@ -40,10 +40,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Octal %s is decimal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Octal ' . $worksheet->getCell("A$row")->getValue() + . ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/Engineering/OCT2HEX.php b/samples/Calculations/Engineering/OCT2HEX.php index 47e9b6e16d..8a55543e60 100644 --- a/samples/Calculations/Engineering/OCT2HEX.php +++ b/samples/Calculations/Engineering/OCT2HEX.php @@ -40,10 +40,9 @@ // Test the formulae for ($row = 1; $row <= $testDataCount; ++$row) { - $helper->log(sprintf( - '(B%d): Octal %s is hexadecimal %s', - $row, - $worksheet->getCell('A' . $row)->getValue(), - $worksheet->getCell('B' . $row)->getCalculatedValue(), - )); + $helper->log( + "(B$row): " + . 'Octal ' . $worksheet->getCell("A$row")->getValue() + . ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValue() + ); } diff --git a/samples/Calculations/LookupRef/ADDRESS.php b/samples/Calculations/LookupRef/ADDRESS.php index 9e01ddb5f3..7975063fb3 100644 --- a/samples/Calculations/LookupRef/ADDRESS.php +++ b/samples/Calculations/LookupRef/ADDRESS.php @@ -18,5 +18,5 @@ for ($row = 1; $row <= 5; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/COLUMN.php b/samples/Calculations/LookupRef/COLUMN.php index e9e5846608..45b591ba2c 100644 --- a/samples/Calculations/LookupRef/COLUMN.php +++ b/samples/Calculations/LookupRef/COLUMN.php @@ -16,8 +16,8 @@ for ($row = 1; $row <= 2; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } $cell = $worksheet->getCell('F1'); -$helper->log("F1: {$cell->getValue()} => {$cell->getCalculatedValue()}"); +$helper->log('F1: ' . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); diff --git a/samples/Calculations/LookupRef/COLUMNS.php b/samples/Calculations/LookupRef/COLUMNS.php index 4d7f8d10e6..b3e81fe0d7 100644 --- a/samples/Calculations/LookupRef/COLUMNS.php +++ b/samples/Calculations/LookupRef/COLUMNS.php @@ -17,5 +17,5 @@ for ($row = 1; $row <= 4; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/INDEX.php b/samples/Calculations/LookupRef/INDEX.php index 9ef0b94562..e0a734518b 100644 --- a/samples/Calculations/LookupRef/INDEX.php +++ b/samples/Calculations/LookupRef/INDEX.php @@ -35,5 +35,5 @@ for ($row = 11; $row <= 16; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/INDIRECT.php b/samples/Calculations/LookupRef/INDIRECT.php index ffbada9ad7..acfd5dd22c 100644 --- a/samples/Calculations/LookupRef/INDIRECT.php +++ b/samples/Calculations/LookupRef/INDIRECT.php @@ -29,5 +29,5 @@ for ($row = 1; $row <= 5; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/OFFSET.php b/samples/Calculations/LookupRef/OFFSET.php index ae613ec525..1757353358 100644 --- a/samples/Calculations/LookupRef/OFFSET.php +++ b/samples/Calculations/LookupRef/OFFSET.php @@ -29,5 +29,5 @@ for ($row = 1; $row <= 4; ++$row) { $cell = $worksheet->getCell("H{$row}"); - $helper->log("H{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("H{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/ROW.php b/samples/Calculations/LookupRef/ROW.php index 560639a516..fc7a500f0e 100644 --- a/samples/Calculations/LookupRef/ROW.php +++ b/samples/Calculations/LookupRef/ROW.php @@ -16,5 +16,5 @@ for ($row = 1; $row <= 3; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/ROWS.php b/samples/Calculations/LookupRef/ROWS.php index 3cdf085bd9..6d1be29f4e 100644 --- a/samples/Calculations/LookupRef/ROWS.php +++ b/samples/Calculations/LookupRef/ROWS.php @@ -16,5 +16,5 @@ for ($row = 1; $row <= 3; ++$row) { $cell = $worksheet->getCell("A{$row}"); - $helper->log("A{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } diff --git a/samples/Calculations/LookupRef/VLOOKUP.php b/samples/Calculations/LookupRef/VLOOKUP.php index 16a911e86e..352790a7c7 100644 --- a/samples/Calculations/LookupRef/VLOOKUP.php +++ b/samples/Calculations/LookupRef/VLOOKUP.php @@ -43,6 +43,6 @@ for ($column = 'H'; $column !== 'K'; ++$column) { for ($row = 4; $row <= 5; ++$row) { $cell = $worksheet->getCell("{$column}{$row}"); - $helper->log("{$column}{$row}: {$cell->getValue()} => {$cell->getCalculatedValue()}"); + $helper->log("{$column}{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue()); } } diff --git a/samples/Chart/33_Chart_create_line_dateaxis.php b/samples/Chart/33_Chart_create_line_dateaxis.php index f93b83042f..00eacbd0e1 100644 --- a/samples/Chart/33_Chart_create_line_dateaxis.php +++ b/samples/Chart/33_Chart_create_line_dateaxis.php @@ -343,6 +343,7 @@ function dateRange(int $nrows, Spreadsheet $wrkbk): array $dataSheet = $wrkbk->getSheetByNameOrThrow('Data'); // start the xaxis at the beginning of the quarter of the first date + /** @var string */ $startDateStr = $dataSheet->getCell('B2')->getValue(); // yyyy-mm-dd date string $startDate = DateTime::createFromFormat('Y-m-d', $startDateStr); // php date obj if ($startDate === false) { @@ -358,6 +359,7 @@ function dateRange(int $nrows, Spreadsheet $wrkbk): array $ExcelQtrStartDateVal = SharedDate::convertIsoDate($qtrStartStr); // end the xaxis at the end of the quarter of the last date + /** @var string */ $lastDateStr = $dataSheet->getCell([2, $nrows + 1])->getValue(); $lastDate = DateTime::createFromFormat('Y-m-d', $lastDateStr); if ($lastDate === false) { diff --git a/samples/ConditionalFormatting/05_Date_Comparisons.php b/samples/ConditionalFormatting/05_Date_Comparisons.php index 0834939d3b..9384a826c4 100644 --- a/samples/ConditionalFormatting/05_Date_Comparisons.php +++ b/samples/ConditionalFormatting/05_Date_Comparisons.php @@ -122,7 +122,9 @@ $dateWizard = $wizardFactory->newRule(Wizard::DATES_OCCURRING); $conditionalStyles = []; - $methodName = trim($spreadsheet->getActiveSheet()->getCell("{$column}1")->getValue(), '()'); + /** @var string */ + $cellContents = $spreadsheet->getActiveSheet()->getCell("{$column}1")->getValue(); + $methodName = trim($cellContents, '()'); $dateWizard->$methodName() ->setStyle($yellowStyle); diff --git a/samples/DefinedNames/AbsoluteNamedRange.php b/samples/DefinedNames/AbsoluteNamedRange.php index 30afc00d65..4b27799b30 100644 --- a/samples/DefinedNames/AbsoluteNamedRange.php +++ b/samples/DefinedNames/AbsoluteNamedRange.php @@ -44,11 +44,17 @@ ->setCellValue("B{$row}", "=SUM(B{$startRow}:B{$endRow})") ->setCellValue("C{$row}", "=SUM(C{$startRow}:C{$endRow})"); +/** @var float */ +$calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B1')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( 'Worked %.2f hours at a rate of %.2f - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), - $worksheet->getCell('B1')->getValue(), - $worksheet->getCell("C{$row}")->getCalculatedValue() + $calc1, + $value, + $calc2 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/NamedFormulaeAndRanges.php b/samples/DefinedNames/NamedFormulaeAndRanges.php index a5ca80e706..8d9dd75a5e 100644 --- a/samples/DefinedNames/NamedFormulaeAndRanges.php +++ b/samples/DefinedNames/NamedFormulaeAndRanges.php @@ -55,11 +55,17 @@ ->setCellValue("B{$row}", '=COLUMN_TOTALS') ->setCellValue("C{$row}", '=COLUMN_TOTALS'); +/** @var float */ +$calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B1')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( 'Worked %.2f hours at a rate of %.2f - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), - $worksheet->getCell('B1')->getValue(), - $worksheet->getCell("C{$row}")->getCalculatedValue() + $calc1, + $value, + $calc2 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/RelativeNamedRange.php b/samples/DefinedNames/RelativeNamedRange.php index fac75a4715..99de212cf8 100644 --- a/samples/DefinedNames/RelativeNamedRange.php +++ b/samples/DefinedNames/RelativeNamedRange.php @@ -47,11 +47,17 @@ ->setCellValue("B{$row}", "=SUM(B{$startRow}:B{$endRow})") ->setCellValue("C{$row}", "=SUM(C{$startRow}:C{$endRow})"); +/** @var float */ +$calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B1')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( 'Worked %.2f hours at a rate of %.2f - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), - $worksheet->getCell('B1')->getValue(), - $worksheet->getCell("C{$row}")->getCalculatedValue() + $calc1, + $value, + $calc2 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/RelativeNamedRange2.php b/samples/DefinedNames/RelativeNamedRange2.php index b3e957fd2e..0814e0aa6b 100644 --- a/samples/DefinedNames/RelativeNamedRange2.php +++ b/samples/DefinedNames/RelativeNamedRange2.php @@ -50,11 +50,17 @@ ->setCellValue("B{$row}", '=SUM(COLUMN_DATA_VALUES)') ->setCellValue("C{$row}", '=SUM(COLUMN_DATA_VALUES)'); +/** @var float */ +$calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B1')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( 'Worked %.2f hours at a rate of %.2f - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), - $worksheet->getCell('B1')->getValue(), - $worksheet->getCell("C{$row}")->getCalculatedValue() + $calc1, + $value, + $calc2 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/RelativeNamedRangeAsFunction.php b/samples/DefinedNames/RelativeNamedRangeAsFunction.php index 333d01ab0b..ebc85aafef 100644 --- a/samples/DefinedNames/RelativeNamedRangeAsFunction.php +++ b/samples/DefinedNames/RelativeNamedRangeAsFunction.php @@ -53,11 +53,17 @@ ->setCellValue("B{$row}", '=SUM(COLUMN_DATA_VALUES)') ->setCellValue("C{$row}", '=SUM(COLUMN_DATA_VALUES)'); +/** @var float */ +$calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B1')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( 'Worked %.2f hours at a rate of %.2f - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), - $worksheet->getCell('B1')->getValue(), - $worksheet->getCell("C{$row}")->getCalculatedValue() + $calc1, + $value, + $calc2 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/ScopedNamedRange.php b/samples/DefinedNames/ScopedNamedRange.php index 88bc62777e..dc6a211faa 100644 --- a/samples/DefinedNames/ScopedNamedRange.php +++ b/samples/DefinedNames/ScopedNamedRange.php @@ -64,15 +64,20 @@ if ($range === null || $range->getWorksheet() === null) { throw new Exception('expected named range not found'); } +/** @var float */ $chargeRateCellValue = $spreadsheet ->getSheetByNameOrThrow($range->getWorksheet()->getTitle()) ->getCell($range->getCellsInRange()[0])->getValue(); +/** @var float */ +$calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); +/** @var float */ +$calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( - 'Worked %.2f hours at a rate of %s - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), + 'Worked %.2f hours at a rate of %.2f - Charge to the client is %.2f', + $calc1, $chargeRateCellValue, - $worksheet->getCell("C{$row}")->getCalculatedValue() + $calc2 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/ScopedNamedRange2.php b/samples/DefinedNames/ScopedNamedRange2.php index 5f0898c91e..9db8d44ea1 100644 --- a/samples/DefinedNames/ScopedNamedRange2.php +++ b/samples/DefinedNames/ScopedNamedRange2.php @@ -76,12 +76,18 @@ ->setCellValue('B1', 4.5); foreach ($spreadsheet->getAllSheets() as $worksheet) { + /** @var float */ + $calc1 = $worksheet->getCell("B{$row}")->getCalculatedValue(); + /** @var float */ + $value = $worksheet->getCell('B1')->getValue(); + /** @var float */ + $calc2 = $worksheet->getCell("C{$row}")->getCalculatedValue(); $helper->log(sprintf( 'Worked %.2f hours for "%s" at a rate of %.2f - Charge to the client is %.2f', - $worksheet->getCell("B{$row}")->getCalculatedValue(), + $calc1, $worksheet->getTitle(), - $worksheet->getCell('B1')->getValue(), - $worksheet->getCell("C{$row}")->getCalculatedValue() + $value, + $calc2 )); } $worksheet = $spreadsheet->setActiveSheetIndex(0); diff --git a/samples/DefinedNames/SimpleNamedFormula.php b/samples/DefinedNames/SimpleNamedFormula.php index ea1f802da1..f0018100e1 100644 --- a/samples/DefinedNames/SimpleNamedFormula.php +++ b/samples/DefinedNames/SimpleNamedFormula.php @@ -32,12 +32,20 @@ ->setCellValue('B4', '=TAX') ->setCellValue('B5', '=PRICE+TAX'); +/** @var float */ +$calc1 = $worksheet->getCell('B1')->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B3')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell('B4')->getCalculatedValue(); +/** @var float */ +$calc3 = $worksheet->getCell('B5')->getCalculatedValue(); $helper->log(sprintf( 'With a Tax Rate of %.2f and a net price of %.2f, Tax is %.2f and the gross price is %.2f', - $worksheet->getCell('B1')->getCalculatedValue(), - $worksheet->getCell('B3')->getValue(), - $worksheet->getCell('B4')->getCalculatedValue(), - $worksheet->getCell('B5')->getCalculatedValue() + $calc1, + $value, + $calc2, + $calc3 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/DefinedNames/SimpleNamedRange.php b/samples/DefinedNames/SimpleNamedRange.php index 7a7cdc94a1..12c0860165 100644 --- a/samples/DefinedNames/SimpleNamedRange.php +++ b/samples/DefinedNames/SimpleNamedRange.php @@ -26,12 +26,20 @@ ->setCellValue('B4', '=PRICE*TAX_RATE') ->setCellValue('B5', '=PRICE*(1+TAX_RATE)'); +/** @var float */ +$calc1 = $worksheet->getCell('B1')->getCalculatedValue(); +/** @var float */ +$value = $worksheet->getCell('B3')->getValue(); +/** @var float */ +$calc2 = $worksheet->getCell('B4')->getCalculatedValue(); +/** @var float */ +$calc3 = $worksheet->getCell('B5')->getCalculatedValue(); $helper->log(sprintf( 'With a Tax Rate of %.2f and a net price of %.2f, Tax is %.2f and the gross price is %.2f', - $worksheet->getCell('B1')->getCalculatedValue(), - $worksheet->getCell('B3')->getValue(), - $worksheet->getCell('B4')->getCalculatedValue(), - $worksheet->getCell('B5')->getCalculatedValue() + $calc1, + $value, + $calc2, + $calc3 )); $helper->write($spreadsheet, __FILE__, ['Xlsx']); diff --git a/samples/Reading_workbook_data/Custom_properties.php b/samples/Reading_workbook_data/Custom_properties.php index 1c222b5005..26f7c33d06 100644 --- a/samples/Reading_workbook_data/Custom_properties.php +++ b/samples/Reading_workbook_data/Custom_properties.php @@ -38,7 +38,7 @@ break; case 'd': // date - $propertyValue = date('l, d<\s\up>S F Y g:i A', $propertyValue); + $propertyValue = is_numeric($propertyValue) ? date('l, d<\s\u\p>S F Y g:i A', (int) $propertyValue) : '*****INVALID*****'; $propertyType = 'date'; break;