mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-14 03:56:40 +00:00
Minor Tweak
This commit is contained in:
@@ -132,21 +132,11 @@ class ArrayArgumentHelper
|
||||
return $this->columns[$argument] === 1;
|
||||
}
|
||||
|
||||
public function rowCountMixed(mixed $argument): int
|
||||
{
|
||||
return is_int($argument) ? $this->rowCount($argument) : throw new Exception('arg should be int');
|
||||
}
|
||||
|
||||
public function rowCount(int $argument): int
|
||||
{
|
||||
return $this->rows[$argument];
|
||||
}
|
||||
|
||||
public function columnCountMixed(mixed $argument): int
|
||||
{
|
||||
return is_int($argument) ? $this->columnCount($argument) : throw new Exception('arg should be int');
|
||||
}
|
||||
|
||||
public function columnCount(int $argument): int
|
||||
{
|
||||
return $this->columns[$argument];
|
||||
|
||||
@@ -70,14 +70,16 @@ class ArrayArgumentProcessor
|
||||
/** @var mixed[][] $matrixValues1 */
|
||||
$matrixValues1 = $arguments[$matrix1];
|
||||
|
||||
$rows = min(array_map(self::$arrayArgumentHelper->rowCountMixed(...), [$matrix1, $matrix2]));
|
||||
$columns = min(array_map(self::$arrayArgumentHelper->columnCountMixed(...), [$matrix1, $matrix2]));
|
||||
/** @var non-empty-array<int> */
|
||||
$matrix12 = [$matrix1, $matrix2];
|
||||
$rows = min(array_map(self::$arrayArgumentHelper->rowCount(...), $matrix12));
|
||||
$columns = min(array_map(self::$arrayArgumentHelper->columnCount(...), $matrix12));
|
||||
|
||||
if ($rows === 1) {
|
||||
$rows = max(array_map(self::$arrayArgumentHelper->rowCountMixed(...), [$matrix1, $matrix2]));
|
||||
$rows = max(array_map(self::$arrayArgumentHelper->rowCount(...), $matrix12));
|
||||
}
|
||||
if ($columns === 1) {
|
||||
$columns = max(array_map(self::$arrayArgumentHelper->columnCountMixed(...), [$matrix1, $matrix2]));
|
||||
$columns = max(array_map(self::$arrayArgumentHelper->columnCount(...), $matrix12));
|
||||
}
|
||||
|
||||
$result = [];
|
||||
|
||||
Reference in New Issue
Block a user