Simplify validation of columnId/rowId values when creating a CellAddress object
This commit is contained in:
parent
fde77306ff
commit
b4fc92ec7e
|
|
@ -47,16 +47,10 @@ class CellAddress
|
||||||
*/
|
*/
|
||||||
private static function validateColumnAndRow($columnId, $rowId): void
|
private static function validateColumnAndRow($columnId, $rowId): void
|
||||||
{
|
{
|
||||||
$array = [$columnId, $rowId];
|
if (!is_numeric($columnId) || $columnId <= 0 || !is_numeric($rowId) || $rowId <= 0) {
|
||||||
array_walk(
|
|
||||||
$array,
|
|
||||||
function ($value): void {
|
|
||||||
if (!is_numeric($value) || $value <= 0) {
|
|
||||||
throw new Exception('Row and Column Ids must be positive integer values');
|
throw new Exception('Row and Column Ids must be positive integer values');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $columnId
|
* @param mixed $columnId
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue