PluginProbe
TablePress – Tables in WordPress made easy / 3.2
TablePress – Tables in WordPress made easy v3.2
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 2.4.4 All 44 releases
← All changes | libraries/excel-reader.class.php +95 -107 2.0.43.2 View file →
@@ -2,8 +2,9 @@
2 2 /**
3 3 * Excel 97/2003 Reader Class
4 4 *
5 5 * Based on PHP Excel Reader 2.21.
6 + *
6 7 * @link https://code.google.com/archive/p/php-excel-reader/
7 8 *
8 9 * @package TablePress
9 10 * @subpackage Import
@@ -56,35 +57,31 @@
56 57 /**
57 58 * [$data description]
58 59 *
59 60 * @since 1.0.0
60 - * @var string
61 61 */
62 - protected $data = '';
62 + protected string $data = '';
63 63
64 64 /**
65 65 * [$error description]
66 66 *
67 67 * @since 1.0.0
68 - * @var int
69 68 */
70 - public $error;
69 + public int $error;
71 70
72 71 /**
73 72 * [$bigBlockChain description]
74 73 *
75 74 * @since 1.0.0
76 - * @var array
77 75 */
78 - protected $bigBlockChain = array();
76 + protected array $bigBlockChain = array();
79 77
80 78 /**
81 79 * [$smallBlockChain description]
82 80 *
83 81 * @since 1.0.0
84 - * @var array
85 82 */
86 - protected $smallBlockChain = array();
83 + protected array $smallBlockChain = array();
87 84
88 85 /**
89 86 * [$entry description]
90 87 *
@@ -139,9 +136,9 @@
139 136 if ( ! $this->data ) {
140 137 $this->error = 1;
141 138 return false;
142 139 }
143 - if ( IDENTIFIER_OLE !== substr( $this->data, 0, 8 ) ) {
140 + if ( str_starts_with( $this->data, IDENTIFIER_OLE ) ) {
144 141 $this->error = 2;
145 142 return false;
146 143 }
147 144 $numBigBlockDepotBlocks = $this->_GetInt4d( $this->data, NUM_BIG_BLOCK_DEPOT_BLOCKS_POS );
@@ -185,9 +182,9 @@
185 182 $pos = ( $bigBlockDepotBlocks[ $i ] + 1 ) * BIG_BLOCK_SIZE;
186 183 for ( $j = 0; $j < BIG_BLOCK_SIZE / 4; $j++ ) {
187 184 $this->bigBlockChain[ $index ] = $this->_GetInt4d( $this->data, $pos );
188 185 $pos += 4;
189 - $index++;
186 + ++$index;
190 187 }
191 188 }
192 189
193 190 // readSmallBlockDepot();
@@ -199,9 +196,9 @@
199 196 $pos = ( $sbdBlock + 1 ) * BIG_BLOCK_SIZE;
200 197 for ( $j = 0; $j < BIG_BLOCK_SIZE / 4; $j++ ) {
201 198 $this->smallBlockChain[ $index ] = $this->_GetInt4d( $this->data, $pos );
202 199 $pos += 4;
203 - $index++;
200 + ++$index;
204 201 }
205 202 $sbdBlock = $this->bigBlockChain[ $sbdBlock ];
206 203 }
207 204
@@ -216,11 +213,11 @@
216 213 *
217 214 * @since 1.0.0
218 215 *
219 216 * @param [type] $bl [description]
220 - * @return [type] [description]
217 + * @return string [description]
221 218 */
222 - protected function _readData( $bl ) {
219 + protected function _readData( $bl ): string {
223 220 $block = $bl;
224 221 $data = '';
225 222 while ( -2 !== $block ) {
226 223 $pos = ( $block + 1 ) * BIG_BLOCK_SIZE;
@@ -286,9 +283,9 @@
286 283 return $streamData;
287 284 } else {
288 285 $numBlocks = $this->props[ $this->wrkbook ]['size'] / BIG_BLOCK_SIZE;
289 286 if ( 0 !== $this->props[ $this->wrkbook ]['size'] % BIG_BLOCK_SIZE ) {
290 - $numBlocks++;
287 + ++$numBlocks;
291 288 }
292 289
293 290 if ( 0 === $numBlocks ) {
294 291 return '';
@@ -310,11 +307,11 @@
310 307 * @since 1.0.0
311 308 *
312 309 * @param [type] $data [description]
313 310 * @param [type] $pos [description]
314 - * @return [type] [description]
311 + * @return int [description]
315 312 */
316 - protected function _GetInt4d( $data, $pos ) {
313 + protected function _GetInt4d( $data, $pos ): int {
317 314 $value = ord( $data[ $pos ] ) | ( ord( $data[ $pos + 1 ] ) << 8 ) | ( ord( $data[ $pos + 2 ] ) << 16 ) | ( ord( $data[ $pos + 3 ] ) << 24 );
318 315 if ( $value >= 4294967294 ) {
319 316 $value = -2;
320 317 }
@@ -369,10 +366,10 @@
369 366 define( 'SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH', 0x99 );
370 367 define( 'SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT', '%s' );
371 368
372 369 /**
373 -* Main Class
374 -*/
370 + * Main Class
371 + */
375 372 class Spreadsheet_Excel_Reader {
376 373
377 374 /*
378 375 * The following four public constants were added to make data retrieval easier.
@@ -381,35 +378,31 @@
381 378 /**
382 379 * [$colnames description]
383 380 *
384 381 * @since 1.0.0
385 - * @var array
386 382 */
387 - public $colnames = array();
383 + public array $colnames = array();
388 384
389 385 /**
390 386 * [$colindexes description]
391 387 *
392 388 * @since 1.0.0
393 - * @var array
394 389 */
395 - public $colindexes = array();
390 + public array $colindexes = array();
396 391
397 392 /**
398 393 * [$standardColWidth description]
399 394 *
400 395 * @since 1.0.0
401 - * @var int
402 396 */
403 - public $standardColWidth = 0;
397 + public int $standardColWidth = 0;
404 398
405 399 /**
406 400 * [$defaultColWidth description]
407 401 *
408 402 * @since 1.0.0
409 - * @var int
410 403 */
411 - public $defaultColWidth = 0;
404 + public int $defaultColWidth = 0;
412 405
413 406 /**
414 407 * [$store_extended_info description]
415 408 *
@@ -447,11 +440,11 @@
447 440 *
448 441 * @since 1.0.0
449 442 *
450 443 * @param [type] $d [description]
451 - * @return [type] [description]
444 + * @return string [description]
452 445 */
453 - protected function myHex( $d ) {
446 + protected function myHex( $d ): string {
454 447 if ( $d < 16 ) {
455 448 return '0' . dechex( $d );
456 449 }
457 450 return dechex( $d );
@@ -464,11 +457,11 @@
464 457 *
465 458 * @param [type] $data [description]
466 459 * @param [type] $pos [description]
467 460 * @param [type] $length [description]
468 - * @return [type] [description]
461 + * @return string [description]
469 462 */
470 - protected function dumpHexData( $data, $pos, $length ) {
463 + protected function dumpHexData( $data, $pos, $length ): string {
471 464 $info = '';
472 465 for ( $i = 0; $i <= $length; $i++ ) {
473 466 if ( 0 !== $i ) {
474 467 $info .= ' ';
@@ -588,11 +581,11 @@
588 581 *
589 582 * @param [type] $row [description]
590 583 * @param [type] $col [description]
591 584 * @param int $sheet Optional. [description]
592 - * @return [type] [description]
585 + * @return int [description]
593 586 */
594 - public function rowspan( $row, $col, $sheet = 0 ) {
587 + public function rowspan( $row, $col, $sheet = 0 ): int {
595 588 $value = $this->info( $row, $col, 'rowspan', $sheet );
596 589 if ( '' === $value ) {
597 590 return 1;
598 591 } else {
@@ -608,11 +601,11 @@
608 601 *
609 602 * @param [type] $row [description]
610 603 * @param [type] $col [description]
611 604 * @param int $sheet Optional. [description]
612 - * @return [type] [description]
605 + * @return int [description]
613 606 */
614 - public function colspan( $row, $col, $sheet = 0 ) {
607 + public function colspan( $row, $col, $sheet = 0 ): int {
615 608 $value = $this->info( $row, $col, 'colspan', $sheet );
616 609 if ( '' === $value ) {
617 610 return 1;
618 611 } else {
@@ -683,11 +676,11 @@
683 676 * @since 1.0.0
684 677 *
685 678 * @param [type] $col [description]
686 679 * @param int $sheet Optional. [description]
687 - * @return [type] [description]
680 + * @return bool [description]
688 681 */
689 - public function colhidden( $col, $sheet = 0 ) {
682 + public function colhidden( $col, $sheet = 0 ): bool {
690 683 return (bool) $this->colInfo[ $sheet ][ $col ]['hidden'];
691 684 }
692 685
693 686 /**
@@ -709,11 +702,11 @@
709 702 * @since 1.0.0
710 703 *
711 704 * @param [type] $row [description]
712 705 * @param int $sheet Optional. [description]
713 - * @return [type] [description]
706 + * @return bool [description]
714 707 */
715 - public function rowhidden( $row, $sheet = 0 ) {
708 + public function rowhidden( $row, $sheet = 0 ): bool {
716 709 return (bool) $this->rowInfo[ $sheet ][ $row ]['hidden'];
717 710 }
718 711
719 712 // GET THE CSS FOR FORMATTING
@@ -726,11 +719,11 @@
726 719 *
727 720 * @param [type] $row [description]
728 721 * @param [type] $col [description]
729 722 * @param int $sheet Optional. [description]
730 - * @return [type] [description]
723 + * @return string [description]
731 724 */
732 - public function style( $row, $col, $sheet = 0 ) {
725 + public function style( $row, $col, $sheet = 0 ): string {
733 726 $css = '';
734 727 $font = $this->font( $row, $col, $sheet );
735 728 if ( '' !== $font ) {
736 729 $css .= "font-family:{$font};";
@@ -1204,11 +1197,11 @@
1204 1197 * @param bool $row_numbers Optional. [description]
1205 1198 * @param bool $col_letters Optional. [description]
1206 1199 * @param int $sheet Optional. [description]
1207 1200 * @param string $table_class Optional. [description]
1208 - * @return [type] [description]
1201 + * @return string [description]
1209 1202 */
1210 - public function dump( $row_numbers = false, $col_letters = false, $sheet = 0, $table_class = 'excel' ) {
1203 + public function dump( $row_numbers = false, $col_letters = false, $sheet = 0, $table_class = 'excel' ): string {
1211 1204 $out = "<table class=\"$table_class\" cellspacing=0>";
1212 1205 if ( $col_letters ) {
1213 1206 $out .= "<thead>\n\t<tr>";
1214 1207 if ( $row_numbers ) {
@@ -1274,33 +1267,32 @@
1274 1267
1275 1268 // --------------
1276 1269 // END PUBLIC API
1277 1270
1278 - protected $boundsheets = array();
1279 - protected $formatRecords = array();
1280 - protected $fontRecords = array();
1281 - protected $xfRecords = array();
1282 - protected $colInfo = array();
1283 - protected $rowInfo = array();
1271 + protected array $boundsheets = array();
1272 + protected array $formatRecords = array();
1273 + protected array $fontRecords = array();
1274 + protected array $xfRecords = array();
1275 + protected array $colInfo = array();
1276 + protected array $rowInfo = array();
1284 1277
1285 - protected $sst = array();
1286 - protected $sheets = array();
1278 + protected array $sst = array();
1279 + protected array $sheets = array();
1287 1280
1288 1281 protected $data;
1289 1282 protected $_ole;
1290 - protected $_defaultEncoding = 'UTF-8';
1291 - protected $_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT;
1292 - protected $_columnsFormat = array();
1293 - protected $_rowoffset = 1;
1294 - protected $_coloffset = 1;
1283 + protected string $_defaultEncoding = 'UTF-8';
1284 + protected string $_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT;
1285 + protected array $_columnsFormat = array();
1286 + protected int $_rowoffset = 1;
1287 + protected int $_coloffset = 1;
1295 1288
1296 1289 /**
1297 1290 * List of default date formats used by Excel
1298 1291 *
1299 1292 * @since 1.0.0
1300 - * @var array
1301 1293 */
1302 - protected $dateFormats = array(
1294 + protected array $dateFormats = array(
1303 1295 0xe => 'm/d/Y',
1304 1296 0xf => 'M-d-Y',
1305 1297 0x10 => 'd-M',
1306 1298 0x11 => 'M-Y',
@@ -1317,11 +1309,10 @@
1317 1309 /**
1318 1310 * Default number formats used by Excel
1319 1311 *
1320 1312 * @since 1.0.0
1321 - * @var array
1322 1313 */
1323 - protected $numberFormats = array(
1314 + protected array $numberFormats = array(
1324 1315 0x1 => '0',
1325 1316 0x2 => '0.00',
1326 1317 0x3 => '#,##0',
1327 1318 0x4 => '#,##0.00',
@@ -1346,11 +1337,10 @@
1346 1337 /**
1347 1338 * [$colors description]
1348 1339 *
1349 1340 * @since 1.0.0
1350 - * @var array
1351 1341 */
1352 - protected $colors = array(
1342 + protected array $colors = array(
1353 1343 0x00 => '#000000',
1354 1344 0x01 => '#FFFFFF',
1355 1345 0x02 => '#FF0000',
1356 1346 0x03 => '#00FF00',
@@ -1428,11 +1418,10 @@
1428 1418 /**
1429 1419 * [$lineStyles description]
1430 1420 *
1431 1421 * @since 1.0.0
1432 - * @var array
1433 1422 */
1434 - protected $lineStyles = array(
1423 + protected array $lineStyles = array(
1435 1424 0x00 => '',
1436 1425 0x01 => 'Thin',
1437 1426 0x02 => 'Medium',
1438 1427 0x03 => 'Dashed',
@@ -1451,11 +1440,10 @@
1451 1440 /**
1452 1441 * [$lineStylesCss description]
1453 1442 *
1454 1443 * @since 1.0.0
1455 - * @var array
1456 1444 */
1457 - protected $lineStylesCss = array(
1445 + protected array $lineStylesCss = array(
1458 1446 'Thin' => '1px solid',
1459 1447 'Medium' => '2px solid',
1460 1448 'Dashed' => '1px dashed',
1461 1449 'Dotted' => '1px dotted',
@@ -1476,14 +1464,14 @@
1476 1464 * @since 1.0.0
1477 1465 *
1478 1466 * @param [type] $data [description]
1479 1467 * @param [type] $start [description]
1480 - * @return [type] [description]
1468 + * @return string [description]
1481 1469 */
1482 - protected function read16bitstring( $data, $start ) {
1470 + protected function read16bitstring( $data, $start ): string {
1483 1471 $len = 0;
1484 1472 while ( ord( $data[ $start + $len ] ) + ord( $data[ $start + $len + 1 ] ) > 0 ) {
1485 - $len++;
1473 + ++$len;
1486 1474 }
1487 1475 return substr( $data, $start, $len );
1488 1476 }
1489 1477
@@ -1495,11 +1483,11 @@
1495 1483 *
1496 1484 * @param [type] $format [description]
1497 1485 * @param [type] $num [description]
1498 1486 * @param [type] $f [description]
1499 - * @return [type] [description]
1487 + * @return array<string, mixed> [description]
1500 1488 */
1501 - protected function _format_value( $format, $num, $f ) {
1489 + protected function _format_value( $format, $num, $f ): array {
1502 1490 // 49 = TEXT format
1503 1491 // https://code.google.com/archive/p/php-excel-reader/issues/7
1504 1492 if ( ( ! $f && '%s' === $format ) || ( 49 === (int) $f ) || ( 'GENERAL' === $format ) ) {
1505 1493 return array(
@@ -1556,10 +1544,10 @@
1556 1544
1557 1545 // Handle the number itself.
1558 1546 $number_regex = '/(\d+)(\.?)(\d*)/';
1559 1547 if ( preg_match( $number_regex, $pattern, $matches ) ) {
1560 - //$left = $matches[1];
1561 - //$dec = $matches[2];
1548 + // $left = $matches[1];
1549 + // $dec = $matches[2];
1562 1550 $right = $matches[3];
1563 1551 if ( $has_commas ) {
1564 1552 $formatted = number_format( $num, strlen( $right ) );
1565 1553 } else {
@@ -1607,9 +1595,9 @@
1607 1595 * @since 1.0.0
1608 1596 *
1609 1597 * @param [type] $encoding [description]
1610 1598 */
1611 - public function setOutputEncoding( $encoding ) {
1599 + public function setOutputEncoding( $encoding ): void {
1612 1600 $this->_defaultEncoding = $encoding;
1613 1601 }
1614 1602
1615 1603 /**
@@ -1621,9 +1609,9 @@
1621 1609 * @since 1.0.0
1622 1610 *
1623 1611 * @param string $encoder Optional. [description]
1624 1612 */
1625 - public function setUTFEncoder( $encoder = 'iconv' ) {
1613 + public function setUTFEncoder( $encoder = 'iconv' ): void {
1626 1614 $this->_encoderFunction = '';
1627 1615 if ( 'iconv' === $encoder ) {
1628 1616 $this->_encoderFunction = function_exists( 'iconv' ) ? 'iconv' : '';
1629 1617 } elseif ( 'mb' === $encoder ) {
@@ -1637,9 +1625,9 @@
1637 1625 * @since 1.0.0
1638 1626 *
1639 1627 * @param [type] $iOffset [description]
1640 1628 */
1641 - public function setRowColOffset( $iOffset ) {
1629 + public function setRowColOffset( $iOffset ): void {
1642 1630 $this->_rowoffset = $iOffset;
1643 1631 $this->_coloffset = $iOffset;
1644 1632 }
1645 1633
@@ -1649,9 +1637,9 @@
1649 1637 * @since 1.0.0
1650 1638 *
1651 1639 * @param [type] $sFormat [description]
1652 1640 */
1653 - public function setDefaultFormat( $sFormat ) {
1641 + public function setDefaultFormat( $sFormat ): void {
1654 1642 $this->_defaultFormat = $sFormat;
1655 1643 }
1656 1644
1657 1645 /**
@@ -1661,9 +1649,9 @@
1661 1649 *
1662 1650 * @param [type] $column [description]
1663 1651 * @param [type] $sFormat [description]
1664 1652 */
1665 - public function setColumnFormat( $column, $sFormat ) {
1653 + public function setColumnFormat( $column, $sFormat ): void {
1666 1654 $this->_columnsFormat[ $column ] = $sFormat;
1667 1655 }
1668 1656
1669 1657 /**
@@ -1672,9 +1660,9 @@
1672 1660 * @since 1.0.0
1673 1661 *
1674 1662 * @param string $data [description]
1675 1663 */
1676 - public function read( $data ) {
1664 + public function read( $data ): void {
1677 1665 $res = $this->_ole->read( $data );
1678 1666
1679 1667 // oops, something goes wrong (Darko Miljanovic)
1680 1668 if ( false === $res ) {
@@ -1700,9 +1688,9 @@
1700 1688 protected function _parse() {
1701 1689 $pos = 0;
1702 1690 $data = $this->data;
1703 1691
1704 - //$code = $this->v( $data, $pos );
1692 + // $code = $this->v( $data, $pos );
1705 1693 $length = $this->v( $data, $pos + 2 );
1706 1694 $version = $this->v( $data, $pos + 4 );
1707 1695 $substreamType = $this->v( $data, $pos + 6 );
1708 1696 if ( SPREADSHEET_EXCEL_READER_BIFF8 !== $version && SPREADSHEET_EXCEL_READER_BIFF7 !== $version ) {
@@ -1738,9 +1726,9 @@
1738 1726 }
1739 1727 $numChars = ord( $data[ $spos ] ) | ( ord( $data[ $spos + 1 ] ) << 8 );
1740 1728 $spos += 2;
1741 1729 $optionFlags = ord( $data[ $spos ] );
1742 - $spos++;
1730 + ++$spos;
1743 1731 $asciiEncoding = ( 0 === ( $optionFlags & 0x01 ) );
1744 1732 $extendedString = ( 0 !== ( $optionFlags & 0x04 ) );
1745 1733
1746 1734 // See if string contains formatting information.
@@ -1985,10 +1973,10 @@
1985 1973 $this->nineteenFour = ( 1 === ord( $data[ $pos + 4 ] ) );
1986 1974 break;
1987 1975 case SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET:
1988 1976 $rec_offset = $this->_GetInt4d( $data, $pos + 4 );
1989 - //$rec_typeFlag = ord( $data[ $pos + 8 ] );
1990 - //$rec_visibilityFlag = ord( $data[ $pos + 9 ] );
1977 + // $rec_typeFlag = ord( $data[ $pos + 8 ] );
1978 + // $rec_visibilityFlag = ord( $data[ $pos + 9 ] );
1991 1979 $rec_length = ord( $data[ $pos + 10 ] );
1992 1980
1993 1981 if ( SPREADSHEET_EXCEL_READER_BIFF8 === $version ) {
1994 1982 $chartype = ord( $data[ $pos + 11 ] );
@@ -2163,10 +2151,10 @@
2163 2151 break;
2164 2152 case SPREADSHEET_EXCEL_READER_TYPE_BOOLERR:
2165 2153 $row = ord( $data[ $spos ] ) | ord( $data[ $spos + 1 ] ) << 8;
2166 2154 $column = ord( $data[ $spos + 2 ] ) | ord( $data[ $spos + 3 ] ) << 8;
2167 - $string = ord( $data[ $spos + 6 ] );
2168 - $this->addcell( $row, $column, $string );
2155 + $a_string = ord( $data[ $spos + 6 ] );
2156 + $this->addcell( $row, $column, $a_string );
2169 2157 break;
2170 2158 case SPREADSHEET_EXCEL_READER_TYPE_STRING:
2171 2159 // https://code.google.com/archive/p/php-excel-reader/issues/4
2172 2160 if ( SPREADSHEET_EXCEL_READER_BIFF8 === $version ) {
@@ -2174,9 +2162,9 @@
2174 2162 $xpos = $spos;
2175 2163 $numChars = ord( $data[ $xpos ] ) | ( ord( $data[ $xpos + 1 ] ) << 8 );
2176 2164 $xpos += 2;
2177 2165 $optionFlags = ord( $data[ $xpos ] );
2178 - $xpos++;
2166 + ++$xpos;
2179 2167 $asciiEncoding = ( 0 === ( $optionFlags & 0x01 ) );
2180 2168 $extendedString = ( 0 !== ( $optionFlags & 0x04 ) );
2181 2169 // See if string contains formatting information
2182 2170 $richString = ( 0 !== ( $optionFlags & 0x08 ) );
@@ -2311,9 +2299,9 @@
2311 2299 *
2312 2300 * @param [type] $spos [description]
2313 2301 * @return bool [description]
2314 2302 */
2315 - protected function isDate( $spos ) {
2303 + protected function isDate( $spos ): bool {
2316 2304 $xfindex = ord( $this->data[ $spos + 4 ] ) | ord( $this->data[ $spos + 5 ] ) << 8;
2317 2305 return ( 'date' === $this->xfRecords[ $xfindex ]['type'] );
2318 2306 }
2319 2307 /**
@@ -2321,11 +2309,11 @@
2321 2309 *
2322 2310 * @since 1.0.0
2323 2311 *
2324 2312 * @param int $ts Optional. Timestamp. Defaults to current Unix timestamp.
2325 - * @return array [description]
2313 + * @return array<string, string> [description]
2326 2314 */
2327 - protected function gmgetdate( $ts = null ) {
2315 + protected function gmgetdate( $ts = null ): array {
2328 2316 $k = array( 'seconds', 'minutes', 'hours', 'mday', 'wday', 'mon', 'year', 'yday', 'weekday', 'month', 0 );
2329 2317 return array_combine( $k, explode( ':', gmdate( 's:i:G:j:w:n:Y:z:l:F:U', is_null( $ts ) ? time() : $ts ) ) );
2330 2318 }
2331 2319
@@ -2336,11 +2324,11 @@
2336 2324 *
2337 2325 * @param [type] $spos [description]
2338 2326 * @param [type] $numValue [description]
2339 2327 * @param [type] $column [description]
2340 - * @return [type] [description]
2328 + * @return array<string, mixed> [description]
2341 2329 */
2342 - protected function _getCellDetails( $spos, $numValue, $column ) {
2330 + protected function _getCellDetails( $spos, $numValue, $column ): array {
2343 2331 $xfindex = ord( $this->data[ $spos + 4 ] ) | ord( $this->data[ $spos + 5 ] ) << 8;
2344 2332 $xfrecord = $this->xfRecords[ $xfindex ];
2345 2333 $type = $xfrecord['type'];
2346 2334
@@ -2366,15 +2354,15 @@
2366 2354
2367 2355 $totalseconds = floor( SPREADSHEET_EXCEL_READER_MSINADAY * $fractionalDay );
2368 2356 $secs = $totalseconds % 60;
2369 2357 $totalseconds -= $secs;
2370 - $hours = (int) floor( $totalseconds / ( 60 * 60 ) );
2371 - $mins = (int) floor( $totalseconds / 60 ) % 60;
2372 - $string = date( $format, mktime( $hours, $mins, $secs, $dateinfo['mon'], $dateinfo['mday'], $dateinfo['year'] ) );
2358 + $hours = intdiv( $totalseconds, 60 * 60 );
2359 + $mins = intdiv( $totalseconds, 60 ) % 60;
2360 + $a_string = date( $format, mktime( $hours, $mins, $secs, $dateinfo['mon'], $dateinfo['mday'], $dateinfo['year'] ) );
2373 2361 } elseif ( 'number' === $type ) {
2374 2362 $rectype = 'number';
2375 2363 $formatted = $this->_format_value( $format, $numValue, $formatIndex );
2376 - $string = $formatted['string'];
2364 + $a_string = $formatted['string'];
2377 2365 $formatColor = $formatted['formatColor'];
2378 2366 $raw = $numValue;
2379 2367 } else {
2380 2368 if ( '' === $format ) {
@@ -2381,9 +2369,9 @@
2381 2369 $format = $this->_defaultFormat;
2382 2370 }
2383 2371 $rectype = 'unknown';
2384 2372 $formatted = $this->_format_value( $format, $numValue, $formatIndex );
2385 - $string = $formatted['string'];
2373 + $a_string = $formatted['string'];
2386 2374 $formatColor = $formatted['formatColor'];
2387 2375 $raw = $numValue;
2388 2376 }
2389 2377
@@ -2430,12 +2418,12 @@
2430 2418 * [addcell description]
2431 2419 *
2432 2420 * @since 1.0.0
2433 2421 *
2434 - * @param [type] $row [description]
2435 - * @param [type] $col [description]
2436 - * @param [type] $string [description]
2437 - * @param array $info Optional. [description]
2422 + * @param [type] $row [description]
2423 + * @param [type] $col [description]
2424 + * @param [type] $a_string [description]
2425 + * @param array<string, mixed> $info Optional. [description]
2438 2426 * @return [type] [description]
2439 2427 */
2440 2428 protected function addcell( $row, $col, $string, $info = null ) {
2441 2429 $this->sheets[ $this->sn ]['maxrow'] = max( $this->sheets[ $this->sn ]['maxrow'], $row + $this->_rowoffset );
@@ -2483,19 +2471,19 @@
2483 2471 * [_encodeUTF16 description]
2484 2472 *
2485 2473 * @since 1.0.0
2486 2474 *
2487 - * @param [type] $string [description]
2475 + * @param [type] $a_string [description]
2488 2476 * @return [type] [description]
2489 2477 */
2490 - protected function _encodeUTF16( $string ) {
2478 + protected function _encodeUTF16( $a_string ) {
2491 2479 if ( $this->_defaultEncoding ) {
2492 2480 switch ( $this->_encoderFunction ) {
2493 2481 case 'iconv':
2494 - $string = iconv( 'UTF-16LE', $this->_defaultEncoding, $string );
2482 + $a_string = iconv( 'UTF-16LE', $this->_defaultEncoding, $a_string );
2495 2483 break;
2496 2484 case 'mb_convert_encoding':
2497 - $string = mb_convert_encoding( $string, $this->_defaultEncoding, 'UTF-16LE' );
2485 + $a_string = mb_convert_encoding( $string, $this->_defaultEncoding, 'UTF-16LE' );
2498 2486 break;
2499 2487 }
2500 2488 }
2501 2489 return $string;
@@ -2507,11 +2495,11 @@
2507 2495 * @since 1.0.0
2508 2496 *
2509 2497 * @param [type] $data [description]
2510 2498 * @param [type] $pos [description]
2511 - * @return [type] [description]
2499 + * @return int [description]
2512 2500 */
2513 - protected function _GetInt4d( $data, $pos ) {
2501 + protected function _GetInt4d( $data, $pos ): int {
2514 2502 $value = ord( $data[ $pos ] ) | ( ord( $data[ $pos + 1 ] ) << 8 ) | ( ord( $data[ $pos + 2 ] ) << 16 ) | ( ord( $data[ $pos + 3 ] ) << 24 );
2515 2503 if ( $value >= 4294967294 ) {
2516 2504 $value = -2;
2517 2505 }
@@ -2524,11 +2512,11 @@
2524 2512 * @since 1.0.0
2525 2513 *
2526 2514 * @param [type] $data [description]
2527 2515 * @param [type] $pos [description]
2528 - * @return [type] [description]
2516 + * @return int [description]
2529 2517 */
2530 - protected function v( $data, $pos ) {
2518 + protected function v( $data, $pos ): int {
2531 2519 return ord( $data[ $pos ] ) | ord( $data[ $pos + 1 ] ) << 8;
2532 2520 }
2533 2521
2534 2522 } // class Spreadsheet_Excel_Reader