maj nulib-base

This commit is contained in:
Jephté Clain 2025-10-08 14:10:58 +04:00
parent bed69e6081
commit 45ad56b201
2 changed files with 12 additions and 3 deletions

9
.idea/php.xml generated
View File

@ -54,12 +54,21 @@
<path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" /> <path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" />
<path value="$PROJECT_DIR$/vendor/myclabs/php-enum" /> <path value="$PROJECT_DIR$/vendor/myclabs/php-enum" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" /> <path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/yaml" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/nulib/base" />
</include_path> </include_path>
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4" /> <component name="PhpProjectSharedConfiguration" php_language_level="7.4" />
<component name="PhpStanOptionsConfiguration"> <component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>
<component name="PhpUnit">
<phpunit_settings>
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
</phpunit_settings>
</component>
<component name="PsalmOptionsConfiguration"> <component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>

View File

@ -1,7 +1,7 @@
<?php <?php
namespace nulib\ext\phpss; namespace nulib\ext\phpss;
use nulib\ValueException; use nulib\exceptions;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
@ -13,14 +13,14 @@ class wsutils {
} elseif (is_numeric($wsname)) { } elseif (is_numeric($wsname)) {
$sheetCount = $ss->getSheetCount(); $sheetCount = $ss->getSheetCount();
if ($wsname < 1 || $wsname > $sheetCount) { if ($wsname < 1 || $wsname > $sheetCount) {
throw ValueException::invalid_value($wsname, "sheet index"); throw exceptions::invalid_value($wsname, "sheet index");
} }
$ws = $ss->getSheet($wsname - 1); $ws = $ss->getSheet($wsname - 1);
} else { } else {
$ws = $ss->getSheetByName($wsname); $ws = $ss->getSheetByName($wsname);
if ($ws === null) { if ($ws === null) {
if ($create) $ws = $ss->createSheet()->setTitle($wsname); if ($create) $ws = $ss->createSheet()->setTitle($wsname);
else throw ValueException::invalid_value($wsname, "sheet name"); else throw exceptions::invalid_value($wsname, "sheet name");
} }
} }
return $ws; return $ws;