Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef; 4 5 use PhpOffice\PhpSpreadsheet\Calculation\Exception; 6 use PhpOffice\PhpSpreadsheet\Calculation\Functions; 7 8 abstract class LookupBase 9 { 10 protected static function validateIndexLookup($lookup_array, $index_number) 11 { 12 // index_number must be a number greater than or equal to 1 13 if (!is_numeric($index_number) || $index_number < 1) { 14 throw new Exception(Functions::VALUE()); 15 } 16 17 // index_number must be less than or equal to the number of columns in lookup_array 18 if ((!is_array($lookup_array)) || (empty($lookup_array))) { 19 throw new Exception(Functions::REF()); 20 } 21 22 return (int) $index_number; 23 } 24 25 protected static function checkMatch( 26 bool $bothNumeric, 27 bool $bothNotNumeric, 28 $notExactMatch, 29 int $rowKey, 30 string $cellDataLower, 31 string $lookupLower, 32 ?int $rowNumber 33 ): ?int { 34 // remember the last key, but only if datatypes match 35 if ($bothNumeric || $bothNotNumeric) { 36 // Spreadsheets software returns first exact match, 37 // we have sorted and we might have broken key orders 38 // we want the first one (by its initial index) 39 if ($notExactMatch) { 40 $rowNumber = $rowKey; 41 } elseif (($cellDataLower == $lookupLower) && (($rowNumber === null) || ($rowKey < $rowNumber))) { 42 $rowNumber = $rowKey; 43 } 44 } 45 46 return $rowNumber; 47 } 48 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body