Merge pull request #4399 from oleibman/stan2lv902

Phpstan Level 9 - Part 2 of Many
This commit is contained in:
oleibman
2025-03-13 15:39:34 +00:00
committed by GitHub
37 changed files with 107 additions and 470 deletions
-384
View File
@@ -1,389 +1,5 @@
parameters:
ignoreErrors:
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/BESSELI.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/BESSELJ.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/BESSELK.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/BESSELY.php
-
message: '#^Binary operation "\." between ''\(A1\)\: Unit of…''\|''\(A2\)\: Unit of…''\|''\(A3\)\: Unit of…''\|''\(A4\)\: Unit of…''\|''\(A5\)\: Unit of…''\|''\(A6\)\: Unit of…''\|''\(A7\)\: Unit of…''\|''\(A8\)\: Unit of…''\|''\(A9\)\: Unit of…'' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/CONVERT.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 6
path: samples/Engineering/CONVERT.php
-
message: '#^Parameter \#1 \$string of function htmlentities expects string, mixed given\.$#'
identifier: argument.type
count: 1
path: samples/Engineering/Convert-Online.php
-
message: '#^Parameter \#2 \$fromUOM of static method PhpOffice\\PhpSpreadsheet\\Calculation\\Engineering\\ConvertUOM\:\:CONVERT\(\) expects array\|string, mixed given\.$#'
identifier: argument.type
count: 1
path: samples/Engineering/Convert-Online.php
-
message: '#^Parameter \#3 \$toUOM of static method PhpOffice\\PhpSpreadsheet\\Calculation\\Engineering\\ConvertUOM\:\:CONVERT\(\) expects array\|string, mixed given\.$#'
identifier: argument.type
count: 1
path: samples/Engineering/Convert-Online.php
-
message: '#^Binary operation "\." between ''\(E1\)\: Compare…''\|''\(E2\)\: Compare…''\|''\(E3\)\: Compare…'' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/DELTA.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 2
path: samples/Engineering/DELTA.php
-
message: '#^Binary operation "\." between ''\(C1\)\: ''\|''\(C2\)\: ''\|''\(C3\)\: ''\|''\(C4\)\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/ERF.php
-
message: '#^Binary operation "\." between ''\(C5\)\: ''\|''\(C6\)\: ''\|''\(C7\)\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/ERF.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 5
path: samples/Engineering/ERF.php
-
message: '#^Binary operation "\." between ''\(E1\)\: ''\|''\(E2\)\: ''\|''\(E3\)\: ''\|''\(E4\)\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/Engineering/ERFC.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 2
path: samples/Engineering/ERFC.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Binary ''\|''\(B10\)\: Binary ''\|''\(B2\)\: Binary ''\|''\(B3\)\: Binary ''\|''\(B4\)\: Binary ''\|''\(B5\)\: Binary ''\|''\(B6\)\: Binary ''\|''\(B7\)\: Binary ''\|''\(B8\)\: Binary ''\|''\(B9\)\: Binary '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/BIN2DEC.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/BIN2DEC.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Binary ''\|''\(B10\)\: Binary ''\|''\(B2\)\: Binary ''\|''\(B3\)\: Binary ''\|''\(B4\)\: Binary ''\|''\(B5\)\: Binary ''\|''\(B6\)\: Binary ''\|''\(B7\)\: Binary ''\|''\(B8\)\: Binary ''\|''\(B9\)\: Binary '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/BIN2HEX.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/BIN2HEX.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Binary ''\|''\(B10\)\: Binary ''\|''\(B2\)\: Binary ''\|''\(B3\)\: Binary ''\|''\(B4\)\: Binary ''\|''\(B5\)\: Binary ''\|''\(B6\)\: Binary ''\|''\(B7\)\: Binary ''\|''\(B8\)\: Binary ''\|''\(B9\)\: Binary '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/BIN2OCT.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/BIN2OCT.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Decimal ''\|''\(B10\)\: Decimal ''\|''\(B11\)\: Decimal ''\|''\(B2\)\: Decimal ''\|''\(B3\)\: Decimal ''\|''\(B4\)\: Decimal ''\|''\(B5\)\: Decimal ''\|''\(B6\)\: Decimal ''\|''\(B7\)\: Decimal ''\|''\(B8\)\: Decimal ''\|''\(B9\)\: Decimal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/DEC2BIN.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/DEC2BIN.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Decimal ''\|''\(B10\)\: Decimal ''\|''\(B11\)\: Decimal ''\|''\(B12\)\: Decimal ''\|''\(B2\)\: Decimal ''\|''\(B3\)\: Decimal ''\|''\(B4\)\: Decimal ''\|''\(B5\)\: Decimal ''\|''\(B6\)\: Decimal ''\|''\(B7\)\: Decimal ''\|''\(B8\)\: Decimal ''\|''\(B9\)\: Decimal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/DEC2HEX.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/DEC2HEX.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Decimal ''\|''\(B10\)\: Decimal ''\|''\(B11\)\: Decimal ''\|''\(B12\)\: Decimal ''\|''\(B2\)\: Decimal ''\|''\(B3\)\: Decimal ''\|''\(B4\)\: Decimal ''\|''\(B5\)\: Decimal ''\|''\(B6\)\: Decimal ''\|''\(B7\)\: Decimal ''\|''\(B8\)\: Decimal ''\|''\(B9\)\: Decimal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/DEC2OCT.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/DEC2OCT.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Hexadecimal ''\|''\(B10\)\: Hexadecimal ''\|''\(B2\)\: Hexadecimal ''\|''\(B3\)\: Hexadecimal ''\|''\(B4\)\: Hexadecimal ''\|''\(B5\)\: Hexadecimal ''\|''\(B6\)\: Hexadecimal ''\|''\(B7\)\: Hexadecimal ''\|''\(B8\)\: Hexadecimal ''\|''\(B9\)\: Hexadecimal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/HEX2BIN.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/HEX2BIN.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Hexadecimal ''\|''\(B10\)\: Hexadecimal ''\|''\(B11\)\: Hexadecimal ''\|''\(B12\)\: Hexadecimal ''\|''\(B2\)\: Hexadecimal ''\|''\(B3\)\: Hexadecimal ''\|''\(B4\)\: Hexadecimal ''\|''\(B5\)\: Hexadecimal ''\|''\(B6\)\: Hexadecimal ''\|''\(B7\)\: Hexadecimal ''\|''\(B8\)\: Hexadecimal ''\|''\(B9\)\: Hexadecimal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/HEX2DEC.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/HEX2DEC.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Hexadecimal ''\|''\(B10\)\: Hexadecimal ''\|''\(B2\)\: Hexadecimal ''\|''\(B3\)\: Hexadecimal ''\|''\(B4\)\: Hexadecimal ''\|''\(B5\)\: Hexadecimal ''\|''\(B6\)\: Hexadecimal ''\|''\(B7\)\: Hexadecimal ''\|''\(B8\)\: Hexadecimal ''\|''\(B9\)\: Hexadecimal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/HEX2OCT.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/HEX2OCT.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Octal ''\|''\(B10\)\: Octal ''\|''\(B11\)\: Octal ''\|''\(B2\)\: Octal ''\|''\(B3\)\: Octal ''\|''\(B4\)\: Octal ''\|''\(B5\)\: Octal ''\|''\(B6\)\: Octal ''\|''\(B7\)\: Octal ''\|''\(B8\)\: Octal ''\|''\(B9\)\: Octal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/OCT2BIN.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/OCT2BIN.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Octal ''\|''\(B10\)\: Octal ''\|''\(B11\)\: Octal ''\|''\(B12\)\: Octal ''\|''\(B13\)\: Octal ''\|''\(B2\)\: Octal ''\|''\(B3\)\: Octal ''\|''\(B4\)\: Octal ''\|''\(B5\)\: Octal ''\|''\(B6\)\: Octal ''\|''\(B7\)\: Octal ''\|''\(B8\)\: Octal ''\|''\(B9\)\: Octal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/OCT2DEC.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/OCT2DEC.php
-
message: '#^Binary operation "\." between ''\(B1\)\: Octal ''\|''\(B10\)\: Octal ''\|''\(B11\)\: Octal ''\|''\(B12\)\: Octal ''\|''\(B13\)\: Octal ''\|''\(B2\)\: Octal ''\|''\(B3\)\: Octal ''\|''\(B4\)\: Octal ''\|''\(B5\)\: Octal ''\|''\(B6\)\: Octal ''\|''\(B7\)\: Octal ''\|''\(B8\)\: Octal ''\|''\(B9\)\: Octal '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/OCT2HEX.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/HexEtcConversions/OCT2HEX.php
-
message: '#^Binary operation "\." between ''A1\: ''\|''A2\: ''\|''A3\: ''\|''A4\: ''\|''A5\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/ADDRESS.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/ADDRESS.php
-
message: '#^Binary operation "\." between ''A1\: ''\|''A2\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/COLUMN.php
-
message: '#^Binary operation "\." between ''F1\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/COLUMN.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 2
path: samples/LookupRef/COLUMN.php
-
message: '#^Binary operation "\." between ''A1\: ''\|''A2\: ''\|''A3\: ''\|''A4\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/COLUMNS.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/COLUMNS.php
-
message: '#^Binary operation "\." between ''A11\: ''\|''A12\: ''\|''A13\: ''\|''A14\: ''\|''A15\: ''\|''A16\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/INDEX.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/INDEX.php
-
message: '#^Binary operation "\." between ''A1\: ''\|''A2\: ''\|''A3\: ''\|''A4\: ''\|''A5\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/INDIRECT.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/INDIRECT.php
-
message: '#^Binary operation "\." between ''H1\: ''\|''H2\: ''\|''H3\: ''\|''H4\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/OFFSET.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/OFFSET.php
-
message: '#^Binary operation "\." between ''A1\: ''\|''A2\: ''\|''A3\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/ROW.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/ROW.php
-
message: '#^Binary operation "\." between ''A1\: ''\|''A2\: ''\|''A3\: '' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/ROWS.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/ROWS.php
-
message: '#^Binary operation "\." between literal\-string&non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/VLOOKUP.php
-
message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: samples/LookupRef/VLOOKUP.php
-
message: '#^Parameter \#1 \$string of function htmlentities expects string, mixed given\.$#'
identifier: argument.type
count: 2
path: samples/Wizards/NumberFormat/Accounting.php
-
message: '#^Parameter \#1 \$string of function htmlentities expects string, mixed given\.$#'
identifier: argument.type
count: 2
path: samples/Wizards/NumberFormat/Currency.php
-
message: '#^Parameter \#1 \$string of function htmlentities expects string, mixed given\.$#'
identifier: argument.type
count: 2
path: samples/Wizards/NumberFormat/Number.php
-
message: '#^Parameter \#1 \$string of function htmlentities expects string, mixed given\.$#'
identifier: argument.type
count: 2
path: samples/Wizards/NumberFormat/Percentage.php
-
message: '#^Parameter \#1 \$string of function htmlentities expects string, mixed given\.$#'
identifier: argument.type
count: 2
path: samples/Wizards/NumberFormat/Scientific.php
-
message: '#^Parameter \#1 \$str1 of static method PhpOffice\\PhpSpreadsheet\\Calculation\\BinaryComparison\:\:strcmpAllowNull\(\) expects string\|null, mixed given\.$#'
identifier: argument.type
+1 -1
View File
@@ -21,6 +21,6 @@ for ($n = 0; $n <= 5; ++$n) {
$formula = "BESSELI({$x}, {$n})";
$worksheet->setCellValue('A1', "=$formula");
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue());
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValueString());
}
}
+1 -1
View File
@@ -21,6 +21,6 @@ for ($n = 0; $n <= 5; ++$n) {
$formula = "BESSELJ({$x}, {$n})";
$worksheet->setCellValue('A1', "=$formula");
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue());
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValueString());
}
}
+1 -1
View File
@@ -21,6 +21,6 @@ for ($n = 0; $n <= 5; ++$n) {
$formula = "BESSELK({$x}, {$n})";
$worksheet->setCellValue('A1', "=$formula");
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue());
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValueString());
}
}
+1 -1
View File
@@ -21,6 +21,6 @@ for ($n = 0; $n <= 5; ++$n) {
$formula = "BESSELY({$x}, {$n})";
$worksheet->setCellValue('A1', "=$formula");
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValue());
$helper->log("$formula = " . $worksheet->getCell('A1')->getCalculatedValueString());
}
}
+7 -7
View File
@@ -40,15 +40,15 @@ $worksheet->setCellValue('H1', '=CONVERT(CONVERT(100,"m","ft"),"m","ft")');
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(A$row): Unit of Measure Conversion Formula "
. $worksheet->getCell('D' . $row)->getValue()
. $worksheet->getCell('D' . $row)->getValueString()
. ' - '
. $worksheet->getCell('A' . $row)->getValue()
. $worksheet->getCell('A' . $row)->getValueString()
. ' '
. $worksheet->getCell('B' . $row)->getValue()
. $worksheet->getCell('B' . $row)->getValueString()
. ' is '
. $worksheet->getCell('D' . $row)->getCalculatedValue()
. $worksheet->getCell('D' . $row)->getCalculatedValueString()
. ' '
. $worksheet->getCell('C' . $row)->getValue()
. $worksheet->getCell('C' . $row)->getValueString()
);
}
@@ -56,7 +56,7 @@ $helper->log('Old method for area conversions, before MS Excel introduced area U
$helper->log(
"(A$row): Unit of Measure Conversion Formula "
. $worksheet->getCell('H1')->getValue()
. $worksheet->getCell('H1')->getValueString()
. ' result is '
. $worksheet->getCell('H1')->getCalculatedValue()
. $worksheet->getCell('H1')->getCalculatedValueString()
);
+18 -12
View File
@@ -3,6 +3,7 @@
use PhpOffice\PhpSpreadsheet\Calculation\Engineering\ConvertUOM;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
require __DIR__ . '/../Header.php';
@@ -12,9 +13,14 @@ if ($helper->isCli()) {
return;
}
$post = [];
foreach (['category', 'quantity', 'fromUnit', 'toUnit'] as $value) {
if (isset($_POST[$value])) {
$post[$value] = StringHelper::convertToString($_POST[$value]);
}
}
$categories = ConvertUOM::getConversionCategories();
$defaultCategory = $_POST['category'] ?? $categories[0];
$defaultCategory = $post['category'] ?? $categories[0];
$units = [];
foreach ($categories as $category) {
$categoryUnits = ConvertUOM::getConversionCategoryUnitDetails($category)[$category];
@@ -34,7 +40,7 @@ foreach ($categories as $category) {
<div class="col-sm-10">
<select name="category" class="form-select" onchange="this.form.submit()">
<?php foreach ($categories as $category) {
echo "<option value=\"{$category}\" " . ((isset($_POST['category']) && $_POST['category'] === $category) ? 'selected' : '') . ">{$category}</option>", PHP_EOL;
echo "<option value=\"{$category}\" " . ((isset($post['category']) && $post['category'] === $category) ? 'selected' : '') . ">{$category}</option>", PHP_EOL;
} ?>
</select>
</div>
@@ -42,7 +48,7 @@ foreach ($categories as $category) {
<div class="mb-3 row">
<label for="quantity" class="col-sm-2 col-form-label">Quantity</label>
<div class="col-sm-10">
<input name="quantity" type="text" size="8" value="<?php echo (isset($_POST['quantity'])) ? htmlentities($_POST['quantity'], Settings::htmlEntityFlags()) : '1.0'; ?>">
<input name="quantity" type="text" size="8" value="<?php echo (isset($post['quantity'])) ? htmlentities($post['quantity'], Settings::htmlEntityFlags()) : '1.0'; ?>">
</div>
</div>
<div class="mb-3 row">
@@ -50,7 +56,7 @@ foreach ($categories as $category) {
<div class="col-sm-10">
<select name="fromUnit" class="form-select">
<?php foreach ($units[$defaultCategory] as $fromUnitCode => $fromUnitName) {
echo "<option value=\"{$fromUnitCode}\" " . ((isset($_POST['fromUnit']) && $_POST['fromUnit'] === $fromUnitCode) ? 'selected' : '') . ">{$fromUnitName}</option>", PHP_EOL;
echo "<option value=\"{$fromUnitCode}\" " . ((isset($post['fromUnit']) && $post['fromUnit'] === $fromUnitCode) ? 'selected' : '') . ">{$fromUnitName}</option>", PHP_EOL;
} ?>
</select>
</div>
@@ -60,7 +66,7 @@ foreach ($categories as $category) {
<div class="col-sm-10">
<select name="toUnit" class="form-select">
<?php foreach ($units[$defaultCategory] as $toUnitCode => $toUnitName) {
echo "<option value=\"{$toUnitCode}\" " . ((isset($_POST['toUnit']) && $_POST['toUnit'] === $toUnitCode) ? 'selected' : '') . ">{$toUnitName}</option>", PHP_EOL;
echo "<option value=\"{$toUnitCode}\" " . ((isset($post['toUnit']) && $post['toUnit'] === $toUnitCode) ? 'selected' : '') . ">{$toUnitName}</option>", PHP_EOL;
} ?>
</select>
</div>
@@ -74,17 +80,17 @@ foreach ($categories as $category) {
<?php
/** If the user has submitted the form, then we need to calculate the value and display the result */
if (isset($_POST['quantity'], $_POST['fromUnit'], $_POST['toUnit'])) {
$quantity = $_POST['quantity'];
$fromUnit = $_POST['fromUnit'];
$toUnit = $_POST['toUnit'];
if (isset($post['quantity'], $post['fromUnit'], $post['toUnit'])) {
$quantity = $post['quantity'];
$fromUnit = $post['fromUnit'];
$toUnit = $post['toUnit'];
if (!is_numeric($quantity)) {
$helper->log('Quantity is not numeric');
} elseif (isset($units[$_POST['category']][$fromUnit], $units[$_POST['category']][$toUnit])) {
} elseif (isset($units[$post['category']][$fromUnit], $units[$post['category']][$toUnit])) {
/** @var float|string */
$result = ConvertUOM::CONVERT($quantity, $fromUnit, $toUnit);
$helper->log("{$quantity} {$units[$_POST['category']][$fromUnit]} is {$result} {$units[$_POST['category']][$toUnit]}");
$helper->log("{$quantity} {$units[$post['category']][$fromUnit]} is {$result} {$units[$post['category']][$toUnit]}");
} else {
$helper->log('Please enter quantity and select From Unit and To Unit');
}
+4 -4
View File
@@ -37,12 +37,12 @@ $comparison = [
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(E$row): Compare values "
. $worksheet->getCell('A' . $row)->getValue()
. $worksheet->getCell('A' . $row)->getValueString()
. ' and '
. $worksheet->getCell('B' . $row)->getValue()
. $worksheet->getCell('B' . $row)->getValueString()
. ' - Result is '
. $worksheet->getCell('C' . $row)->getCalculatedValue()
. $worksheet->getCell('C' . $row)->getCalculatedValueString()
. ' - '
. $comparison[$worksheet->getCell('C' . $row)->getCalculatedValue()]
. $comparison[$worksheet->getCell('C' . $row)->getCalculatedValueString()]
);
}
+7 -7
View File
@@ -47,11 +47,11 @@ $helper->log('ERF() With a single argument');
for ($row = 1; $row <= $testDataCount1; ++$row) {
$helper->log(
"(C$row): "
. $worksheet->getCell('C' . $row)->getValue()
. $worksheet->getCell('C' . $row)->getValueString()
. ' The error function integrated between 0 and '
. $worksheet->getCell('A' . $row)->getValue()
. $worksheet->getCell('A' . $row)->getValueString()
. ' is '
. $worksheet->getCell('C' . $row)->getCalculatedValue()
. $worksheet->getCell('C' . $row)->getCalculatedValueString()
);
}
@@ -59,12 +59,12 @@ $helper->log('ERF() With two arguments');
for ($row = $testDataCount1 + 1; $row <= $testDataCount2 + $testDataCount1; ++$row) {
$helper->log(
"(C$row): "
. $worksheet->getCell('C' . $row)->getValue()
. $worksheet->getCell('C' . $row)->getValueString()
. ' The error function integrated between '
. $worksheet->getCell('A' . $row)->getValue()
. $worksheet->getCell('A' . $row)->getValueString()
. ' and '
. $worksheet->getCell('B' . $row)->getValue()
. $worksheet->getCell('B' . $row)->getValueString()
. ' is '
. $worksheet->getCell('C' . $row)->getCalculatedValue()
. $worksheet->getCell('C' . $row)->getCalculatedValueString()
);
}
+3 -3
View File
@@ -33,10 +33,10 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(E$row): "
. $worksheet->getCell('C' . $row)->getValue()
. $worksheet->getCell('C' . $row)->getValueString()
. ' The complementary error function integrated by '
. $worksheet->getCell('A' . $row)->getValue()
. $worksheet->getCell('A' . $row)->getValueString()
. ' and infinity is '
. $worksheet->getCell('C' . $row)->getCalculatedValue()
. $worksheet->getCell('C' . $row)->getCalculatedValueString()
);
}
+2 -2
View File
@@ -39,7 +39,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Binary ' . $worksheet->getCell("A$row")->getValue()
. ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Binary ' . $worksheet->getCell("A$row")->getValueString()
. ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -39,7 +39,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Binary ' . $worksheet->getCell("A$row")->getValue()
. ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Binary ' . $worksheet->getCell("A$row")->getValueString()
. ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -39,7 +39,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Binary ' . $worksheet->getCell("A$row")->getValue()
. ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Binary ' . $worksheet->getCell("A$row")->getValueString()
. ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -40,7 +40,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Decimal ' . $worksheet->getCell("A$row")->getValue()
. ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Decimal ' . $worksheet->getCell("A$row")->getValueString()
. ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -41,7 +41,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Decimal ' . $worksheet->getCell("A$row")->getValue()
. ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Decimal ' . $worksheet->getCell("A$row")->getValueString()
. ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -41,7 +41,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Decimal ' . $worksheet->getCell("A$row")->getValue()
. ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Decimal ' . $worksheet->getCell("A$row")->getValueString()
. ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -39,7 +39,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Hexadecimal ' . $worksheet->getCell("A$row")->getValue()
. ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Hexadecimal ' . $worksheet->getCell("A$row")->getValueString()
. ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -41,7 +41,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Hexadecimal ' . $worksheet->getCell("A$row")->getValue()
. ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Hexadecimal ' . $worksheet->getCell("A$row")->getValueString()
. ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -39,7 +39,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Hexadecimal ' . $worksheet->getCell("A$row")->getValue()
. ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Hexadecimal ' . $worksheet->getCell("A$row")->getValueString()
. ' is octal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -40,7 +40,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Octal ' . $worksheet->getCell("A$row")->getValue()
. ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Octal ' . $worksheet->getCell("A$row")->getValueString()
. ' is binary ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -42,7 +42,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Octal ' . $worksheet->getCell("A$row")->getValue()
. ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Octal ' . $worksheet->getCell("A$row")->getValueString()
. ' is decimal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+2 -2
View File
@@ -42,7 +42,7 @@ for ($row = 1; $row <= $testDataCount; ++$row) {
for ($row = 1; $row <= $testDataCount; ++$row) {
$helper->log(
"(B$row): "
. 'Octal ' . $worksheet->getCell("A$row")->getValue()
. ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValue()
. 'Octal ' . $worksheet->getCell("A$row")->getValueString()
. ' is hexadecimal ' . $worksheet->getCell("B$row")->getCalculatedValueString()
);
}
+1 -1
View File
@@ -18,5 +18,5 @@ $worksheet->getCell('A5')->setValue('=ADDRESS(2,3,1,FALSE,"EXCEL SHEET")');
for ($row = 1; $row <= 5; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+2 -2
View File
@@ -21,8 +21,8 @@ $worksheet->getCell('F1')->setValue('=COLUMN()');
for ($row = 1; $row <= 2; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
$cell = $worksheet->getCell('F1');
$helper->log('F1: ' . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log('F1: ' . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
+1 -1
View File
@@ -17,5 +17,5 @@ $worksheet->getCell('A4')->setValue('=COLUMNS(1:1)');
for ($row = 1; $row <= 4; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+1 -1
View File
@@ -35,5 +35,5 @@ $worksheet->getCell('A16')->setValue('=SUM(INDEX(C1:D5, 5, 0))');
for ($row = 11; $row <= 16; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+1 -1
View File
@@ -29,5 +29,5 @@ $worksheet->getCell('A5')->setValue('=INDIRECT(NAMED_RANGE_FOR_CELL_D4)');
for ($row = 1; $row <= 5; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+1 -1
View File
@@ -29,5 +29,5 @@ $worksheet->getCell('H4')->setValue('=SUM(OFFSET(E3, 1, -3, 7))');
for ($row = 1; $row <= 4; ++$row) {
$cell = $worksheet->getCell("H{$row}");
$helper->log("H{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("H{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+1 -1
View File
@@ -16,5 +16,5 @@ $worksheet->getCell('A3')->setValue('=ROW()');
for ($row = 1; $row <= 3; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+1 -1
View File
@@ -16,5 +16,5 @@ $worksheet->getCell('A3')->setValue('=ROWS(C1:E4 D3:G5)');
for ($row = 1; $row <= 3; ++$row) {
$cell = $worksheet->getCell("A{$row}");
$helper->log("A{$row}: " . $cell->getValue() . ' => ' . $cell->getCalculatedValue());
$helper->log("A{$row}: " . $cell->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
+1 -1
View File
@@ -43,6 +43,6 @@ $worksheet->getCell('J5')->setValue('=VLOOKUP(J3, B3:E9, 4, FALSE)');
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->getValueString() . ' => ' . $cell->getCalculatedValueString());
}
}
+3 -3
View File
@@ -2,7 +2,7 @@
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;
@@ -29,7 +29,7 @@ $currencies = [
<div class="mb-3 row">
<label for="number" class="col-sm-2 col-form-label">Sample Number Value</label>
<div class="col-sm-10">
<input name="number" type="text" size="8" value="<?php echo (isset($_POST['number'])) ? htmlentities($_POST['number'], Settings::htmlEntityFlags()) : '1234.5678'; ?>">
<input name="number" type="text" size="8" value="<?php echo StringHelper::convertPostToString('number', '1234.5678'); ?>">
</div>
</div>
<div class="mb-3 row">
@@ -48,7 +48,7 @@ $currencies = [
<div class="mb-3 row">
<label for="decimals" class="col-sm-2 col-form-label">Decimal Places</label>
<div class="col-sm-10">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo (isset($_POST['decimals'])) ? htmlentities($_POST['decimals'], Settings::htmlEntityFlags()) : '2'; ?>">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo StringHelper::convertPostToString('decimals', '2'); ?>">
</div>
</div>
<div class="mb-3 row">
+3 -3
View File
@@ -2,7 +2,7 @@
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard\CurrencyNegative;
@@ -44,7 +44,7 @@ $currencies = [
<div class="mb-3 row">
<label for="number" class="col-sm-2 col-form-label">Sample Number Value</label>
<div class="col-sm-10">
<input name="number" type="text" size="8" value="<?php echo (isset($_POST['number'])) ? htmlentities($_POST['number'], Settings::htmlEntityFlags()) : '1234.5678'; ?>">
<input name="number" type="text" size="8" value="<?php echo StringHelper::convertPostToString('number', '1234.5678'); ?>">
</div>
</div>
<div class="mb-3 row">
@@ -63,7 +63,7 @@ $currencies = [
<div class="mb-3 row">
<label for="decimals" class="col-sm-2 col-form-label">Decimal Places</label>
<div class="col-sm-10">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo (isset($_POST['decimals'])) ? htmlentities($_POST['decimals'], Settings::htmlEntityFlags()) : '2'; ?>">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo StringHelper::convertPostToString('decimals', '2'); ?>">
</div>
</div>
<div class="mb-3 row">
+3 -3
View File
@@ -2,7 +2,7 @@
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;
@@ -19,7 +19,7 @@ if ($helper->isCli()) {
<div class="mb-3 row">
<label for="number" class="col-sm-2 col-form-label">Sample Number Value</label>
<div class="col-sm-10">
<input name="number" type="text" size="8" value="<?php echo (isset($_POST['number'])) ? htmlentities($_POST['number'], Settings::htmlEntityFlags()) : '1234.5678'; ?>">
<input name="number" type="text" size="8" value="<?php echo StringHelper::convertPostToString('number', '1234.5678'); ?>">
</div>
</div>
<div class="mb-3 row">
@@ -28,7 +28,7 @@ if ($helper->isCli()) {
<div class="mb-3 row">
<label for="decimals" class="col-sm-2 col-form-label">Decimal Places</label>
<div class="col-sm-10">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo (isset($_POST['decimals'])) ? htmlentities($_POST['decimals'], Settings::htmlEntityFlags()) : '2'; ?>">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo StringHelper::convertPostToString('decimals', '2'); ?>">
</div>
</div>
<div class="mb-3 row">
+3 -3
View File
@@ -2,7 +2,7 @@
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;
@@ -19,7 +19,7 @@ if ($helper->isCli()) {
<div class="mb-3 row">
<label for="number" class="col-sm-2 col-form-label">Sample Number Value</label>
<div class="col-sm-10">
<input name="number" type="text" size="8" value="<?php echo (isset($_POST['number'])) ? htmlentities($_POST['number'], Settings::htmlEntityFlags()) : '1234.5678'; ?>">
<input name="number" type="text" size="8" value="<?php echo StringHelper::convertPostToString('number', '1234.5678'); ?>">
</div>
</div>
<div class="mb-3 row">
@@ -28,7 +28,7 @@ if ($helper->isCli()) {
<div class="mb-3 row">
<label for="decimals" class="col-sm-2 col-form-label">Decimal Places</label>
<div class="col-sm-10">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo (isset($_POST['decimals'])) ? htmlentities($_POST['decimals'], Settings::htmlEntityFlags()) : '2'; ?>">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo StringHelper::convertPostToString('decimals', '2'); ?>">
</div>
</div>
<div class="mb-3 row">
+3 -3
View File
@@ -2,7 +2,7 @@
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;
@@ -19,7 +19,7 @@ if ($helper->isCli()) {
<div class="mb-3 row">
<label for="number" class="col-sm-2 col-form-label">Sample Number Value</label>
<div class="col-sm-10">
<input name="number" type="text" size="8" value="<?php echo (isset($_POST['number'])) ? htmlentities($_POST['number'], Settings::htmlEntityFlags()) : '1234.5678'; ?>">
<input name="number" type="text" size="8" value="<?php echo StringHelper::convertPostToString('number', '1234.5678'); ?>">
</div>
</div>
<div class="mb-3 row">
@@ -28,7 +28,7 @@ if ($helper->isCli()) {
<div class="mb-3 row">
<label for="decimals" class="col-sm-2 col-form-label">Decimal Places</label>
<div class="col-sm-10">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo (isset($_POST['decimals'])) ? htmlentities($_POST['decimals'], Settings::htmlEntityFlags()) : '2'; ?>">
<input name="decimals" type="number" size="2" min="0" max="14" value="<?php echo StringHelper::convertPostToString('decimals', '2'); ?>">
</div>
</div>
<div class="mb-3 row">
@@ -659,4 +659,19 @@ class StringHelper
return $default;
}
/**
* Assist with POST items when samples are run in browser.
* Never run as part of unit tests, which are command line.
*
* @codeCoverageIgnore
*/
public static function convertPostToString(string $index, string $default = ''): string
{
if (isset($_POST[$index])) {
return htmlentities(self::convertToString($_POST[$index], false, $default));
}
return $default;
}
}