PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Calculation / LookupRef / Vstack.php

Vstack.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/LookupRef/Vstack.php

44 lines 925 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
6
7 class Vstack
8 {
9 /**
10 * Excel function VSTACK.
11 *
12 * @return mixed[]
13 * @param mixed ...$inputData
14 */
15 public static function vstack(...$inputData)
16 {
17 $returnMatrix = [];
18
19 $columns = 0;
20 foreach ($inputData as $matrix) {
21 if (!is_array($matrix)) {
22 $count = 1;
23 } else {
24 $count = count(reset($matrix)); //* @phpstan-ignore argument.type (reset can theoretically return mixed not array)
25 }
26 $columns = max($columns, $count);
27 }
28
29 foreach ($inputData as $matrix) {
30 if (!is_array($matrix)) {
31 $matrix = [$matrix];
32 }
33 foreach ($matrix as $row) {
34 if (!is_array($row)) {
35 $row = [$row];
36 }
37 $returnMatrix[] = array_values(array_pad($row, $columns, ExcelError::NA()));
38 }
39 }
40
41 return $returnMatrix;
42 }
43 }
44