@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | $activeMethods = []; |
155 | 155 | foreach (self::$storageMethods as $storageMethod) { |
156 | - $cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\'.$storageMethod; |
|
156 | + $cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $storageMethod; |
|
157 | 157 | if (call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) { |
158 | 158 | $activeMethods[] = $storageMethod; |
159 | 159 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | |
180 | - $cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\'.$method; |
|
180 | + $cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $method; |
|
181 | 181 | if (!call_user_func([$cacheStorageClass, 'cacheMethodIsAvailable'])) { |
182 | 182 | return false; |
183 | 183 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | if (self::$cacheStorageMethod === null) { |
193 | - self::$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\'.$method; |
|
193 | + self::$cacheStorageClass = '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorage\\' . $method; |
|
194 | 194 | self::$cacheStorageMethod = $method; |
195 | 195 | } |
196 | 196 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function columnSort($a, $b) |
79 | 79 | { |
80 | - return strcasecmp(strlen($a).$a, strlen($b).$b); |
|
80 | + return strcasecmp(strlen($a) . $a, strlen($b) . $b); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function columnReverseSort($a, $b) |
93 | 93 | { |
94 | - return 1 - strcasecmp(strlen($a).$a, strlen($b).$b); |
|
94 | + return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | sscanf($b, '%[A-Z]%d', $bc, $br); |
110 | 110 | |
111 | 111 | if ($ar == $br) { |
112 | - return strcasecmp(strlen($ac).$ac, strlen($bc).$bc); |
|
112 | + return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return ($ar < $br) ? -1 : 1; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | sscanf($b, '%[A-Z]%d', $bc, $br); |
131 | 131 | |
132 | 132 | if ($ar == $br) { |
133 | - return 1 - strcasecmp(strlen($ac).$ac, strlen($bc).$bc); |
|
133 | + return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return ($ar < $br) ? 1 : -1; |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); |
336 | 336 | if (!empty($aColumnDimensions)) { |
337 | 337 | foreach ($aColumnDimensions as $objColumnDimension) { |
338 | - $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex().'1', $pBefore, $pNumCols, $pNumRows); |
|
338 | + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); |
|
339 | 339 | list($newReference) = Cell::coordinateFromString($newReference); |
340 | 340 | if ($objColumnDimension->getColumnIndex() != $newReference) { |
341 | 341 | $objColumnDimension->setColumnIndex($newReference); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); |
361 | 361 | if (!empty($aRowDimensions)) { |
362 | 362 | foreach ($aRowDimensions as $objRowDimension) { |
363 | - $newReference = $this->updateCellReference('A'.$objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); |
|
363 | + $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); |
|
364 | 364 | list(, $newReference) = Cell::coordinateFromString($newReference); |
365 | 365 | if ($objRowDimension->getRowIndex() != $newReference) { |
366 | 366 | $objRowDimension->setRowIndex($newReference); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) { |
409 | 409 | for ($i = 1; $i <= $highestRow - 1; ++$i) { |
410 | 410 | for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) { |
411 | - $coordinate = Cell::stringFromColumnIndex($j).$i; |
|
411 | + $coordinate = Cell::stringFromColumnIndex($j) . $i; |
|
412 | 412 | $pSheet->removeConditionalStyles($coordinate); |
413 | 413 | if ($pSheet->cellExists($coordinate)) { |
414 | 414 | $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { |
423 | 423 | for ($i = $beforeColumnIndex - 1; $i <= Cell::columnIndexFromString($highestColumn) - 1; ++$i) { |
424 | 424 | for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { |
425 | - $coordinate = Cell::stringFromColumnIndex($i).$j; |
|
425 | + $coordinate = Cell::stringFromColumnIndex($i) . $j; |
|
426 | 426 | $pSheet->removeConditionalStyles($coordinate); |
427 | 427 | if ($pSheet->cellExists($coordinate)) { |
428 | 428 | $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | // New coordinates |
449 | - $newCoordinates = Cell::stringFromColumnIndex($cellIndex - 1 + $pNumCols).($cell->getRow() + $pNumRows); |
|
449 | + $newCoordinates = Cell::stringFromColumnIndex($cellIndex - 1 + $pNumCols) . ($cell->getRow() + $pNumRows); |
|
450 | 450 | |
451 | 451 | // Should the cell be updated? Move value and cellXf index from one cell to another. |
452 | 452 | if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) { |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) { |
483 | 483 | for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { |
484 | 484 | // Style |
485 | - $coordinate = Cell::stringFromColumnIndex($beforeColumnIndex - 2).$i; |
|
485 | + $coordinate = Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i; |
|
486 | 486 | if ($pSheet->cellExists($coordinate)) { |
487 | 487 | $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); |
488 | 488 | $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | foreach ($conditionalStyles as $conditionalStyle) { |
495 | 495 | $cloned[] = clone $conditionalStyle; |
496 | 496 | } |
497 | - $pSheet->setConditionalStyles(Cell::stringFromColumnIndex($j).$i, $cloned); |
|
497 | + $pSheet->setConditionalStyles(Cell::stringFromColumnIndex($j) . $i, $cloned); |
|
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
@@ -504,19 +504,19 @@ discard block |
||
504 | 504 | if ($pNumRows > 0 && $beforeRow - 1 > 0) { |
505 | 505 | for ($i = $beforeColumnIndex - 1; $i <= Cell::columnIndexFromString($highestColumn) - 1; ++$i) { |
506 | 506 | // Style |
507 | - $coordinate = Cell::stringFromColumnIndex($i).($beforeRow - 1); |
|
507 | + $coordinate = Cell::stringFromColumnIndex($i) . ($beforeRow - 1); |
|
508 | 508 | if ($pSheet->cellExists($coordinate)) { |
509 | 509 | $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); |
510 | 510 | $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? |
511 | 511 | $pSheet->getConditionalStyles($coordinate) : false; |
512 | 512 | for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) { |
513 | - $pSheet->getCell(Cell::stringFromColumnIndex($i).$j)->setXfIndex($xfIndex); |
|
513 | + $pSheet->getCell(Cell::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); |
|
514 | 514 | if ($conditionalStyles) { |
515 | 515 | $cloned = []; |
516 | 516 | foreach ($conditionalStyles as $conditionalStyle) { |
517 | 517 | $cloned[] = clone $conditionalStyle; |
518 | 518 | } |
519 | - $pSheet->setConditionalStyles(Cell::stringFromColumnIndex($i).$j, $cloned); |
|
519 | + $pSheet->setConditionalStyles(Cell::stringFromColumnIndex($i) . $j, $cloned); |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | } |
@@ -661,102 +661,102 @@ discard block |
||
661 | 661 | $adjustCount = 0; |
662 | 662 | $newCellTokens = $cellTokens = []; |
663 | 663 | // Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5) |
664 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
664 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
665 | 665 | if ($matchCount > 0) { |
666 | 666 | foreach ($matches as $match) { |
667 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
668 | - $fromString .= $match[3].':'.$match[4]; |
|
669 | - $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
670 | - $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
667 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
668 | + $fromString .= $match[3] . ':' . $match[4]; |
|
669 | + $modified3 = substr($this->updateCellReference('$A' . $match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
670 | + $modified4 = substr($this->updateCellReference('$A' . $match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
671 | 671 | |
672 | - if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
|
672 | + if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { |
|
673 | 673 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
674 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
675 | - $toString .= $modified3.':'.$modified4; |
|
674 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
675 | + $toString .= $modified3 . ':' . $modified4; |
|
676 | 676 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
677 | 677 | $column = 100000; |
678 | 678 | $row = 10000000 + trim($match[3], '$'); |
679 | - $cellIndex = $column.$row; |
|
679 | + $cellIndex = $column . $row; |
|
680 | 680 | |
681 | 681 | $newCellTokens[$cellIndex] = preg_quote($toString); |
682 | - $cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString).'(?!\d)/i'; |
|
682 | + $cellTokens[$cellIndex] = '/(?<!\d\$\!)' . preg_quote($fromString) . '(?!\d)/i'; |
|
683 | 683 | ++$adjustCount; |
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
687 | 687 | } |
688 | 688 | // Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E) |
689 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
689 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_COLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
690 | 690 | if ($matchCount > 0) { |
691 | 691 | foreach ($matches as $match) { |
692 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
693 | - $fromString .= $match[3].':'.$match[4]; |
|
694 | - $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
695 | - $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
692 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
693 | + $fromString .= $match[3] . ':' . $match[4]; |
|
694 | + $modified3 = substr($this->updateCellReference($match[3] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
695 | + $modified4 = substr($this->updateCellReference($match[4] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
696 | 696 | |
697 | - if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
|
697 | + if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { |
|
698 | 698 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
699 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
700 | - $toString .= $modified3.':'.$modified4; |
|
699 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
700 | + $toString .= $modified3 . ':' . $modified4; |
|
701 | 701 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
702 | 702 | $column = Cell::columnIndexFromString(trim($match[3], '$')) + 100000; |
703 | 703 | $row = 10000000; |
704 | - $cellIndex = $column.$row; |
|
704 | + $cellIndex = $column . $row; |
|
705 | 705 | |
706 | 706 | $newCellTokens[$cellIndex] = preg_quote($toString); |
707 | - $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?![A-Z])/i'; |
|
707 | + $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?![A-Z])/i'; |
|
708 | 708 | ++$adjustCount; |
709 | 709 | } |
710 | 710 | } |
711 | 711 | } |
712 | 712 | } |
713 | 713 | // Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5) |
714 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
714 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
715 | 715 | if ($matchCount > 0) { |
716 | 716 | foreach ($matches as $match) { |
717 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
718 | - $fromString .= $match[3].':'.$match[4]; |
|
717 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
718 | + $fromString .= $match[3] . ':' . $match[4]; |
|
719 | 719 | $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
720 | 720 | $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows); |
721 | 721 | |
722 | - if ($match[3].$match[4] !== $modified3.$modified4) { |
|
722 | + if ($match[3] . $match[4] !== $modified3 . $modified4) { |
|
723 | 723 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
724 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
725 | - $toString .= $modified3.':'.$modified4; |
|
724 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
725 | + $toString .= $modified3 . ':' . $modified4; |
|
726 | 726 | list($column, $row) = Cell::coordinateFromString($match[3]); |
727 | 727 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
728 | 728 | $column = Cell::columnIndexFromString(trim($column, '$')) + 100000; |
729 | 729 | $row = trim($row, '$') + 10000000; |
730 | - $cellIndex = $column.$row; |
|
730 | + $cellIndex = $column . $row; |
|
731 | 731 | |
732 | 732 | $newCellTokens[$cellIndex] = preg_quote($toString); |
733 | - $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString).'(?!\d)/i'; |
|
733 | + $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)' . preg_quote($fromString) . '(?!\d)/i'; |
|
734 | 734 | ++$adjustCount; |
735 | 735 | } |
736 | 736 | } |
737 | 737 | } |
738 | 738 | } |
739 | 739 | // Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5) |
740 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
740 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLREF . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
741 | 741 | |
742 | 742 | if ($matchCount > 0) { |
743 | 743 | foreach ($matches as $match) { |
744 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
744 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
745 | 745 | $fromString .= $match[3]; |
746 | 746 | |
747 | 747 | $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
748 | 748 | if ($match[3] !== $modified3) { |
749 | 749 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
750 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
750 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
751 | 751 | $toString .= $modified3; |
752 | 752 | list($column, $row) = Cell::coordinateFromString($match[3]); |
753 | 753 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
754 | 754 | $column = Cell::columnIndexFromString(trim($column, '$')) + 100000; |
755 | 755 | $row = trim($row, '$') + 10000000; |
756 | - $cellIndex = $row.$column; |
|
756 | + $cellIndex = $row . $column; |
|
757 | 757 | |
758 | 758 | $newCellTokens[$cellIndex] = preg_quote($toString); |
759 | - $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?!\d)/i'; |
|
759 | + $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?!\d)/i'; |
|
760 | 760 | ++$adjustCount; |
761 | 761 | } |
762 | 762 | } |
@@ -829,8 +829,8 @@ discard block |
||
829 | 829 | if (($cell !== null) && ($cell->getDataType() == DataType::TYPE_FORMULA)) { |
830 | 830 | $formula = $cell->getValue(); |
831 | 831 | if (strpos($formula, $oldName) !== false) { |
832 | - $formula = str_replace("'".$oldName."'!", "'".$newName."'!", $formula); |
|
833 | - $formula = str_replace($oldName.'!', $newName.'!', $formula); |
|
832 | + $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); |
|
833 | + $formula = str_replace($oldName . '!', $newName . '!', $formula); |
|
834 | 834 | $cell->setValueExplicit($formula, DataType::TYPE_FORMULA); |
835 | 835 | } |
836 | 836 | } |
@@ -860,10 +860,10 @@ discard block |
||
860 | 860 | $jc = count($range[$i]); |
861 | 861 | for ($j = 0; $j < $jc; ++$j) { |
862 | 862 | if (ctype_alpha($range[$i][$j])) { |
863 | - $r = Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); |
|
863 | + $r = Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j] . '1', $pBefore, $pNumCols, $pNumRows)); |
|
864 | 864 | $range[$i][$j] = $r[0]; |
865 | 865 | } elseif (ctype_digit($range[$i][$j])) { |
866 | - $r = Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
|
866 | + $r = Cell::coordinateFromString($this->updateSingleCellReference('A' . $range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
|
867 | 867 | $range[$i][$j] = $r[1]; |
868 | 868 | } else { |
869 | 869 | $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | |
916 | 916 | // Return new reference |
917 | - return $newColumn.$newRow; |
|
917 | + return $newColumn . $newRow; |
|
918 | 918 | } else { |
919 | 919 | throw new Exception('Only single cell references may be passed to this method.'); |
920 | 920 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $this->value = DataType::checkErrorCode($pValue); |
260 | 260 | break; |
261 | 261 | default: |
262 | - throw new Exception('Invalid datatype: '.$pDataType); |
|
262 | + throw new Exception('Invalid datatype: ' . $pDataType); |
|
263 | 263 | break; |
264 | 264 | } |
265 | 265 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | $result = '#N/A'; |
301 | 301 | throw new Exception( |
302 | - $this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage() |
|
302 | + $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage() |
|
303 | 303 | ); |
304 | 304 | } |
305 | 305 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | throw new Exception('Cell coordinate can not be zero-length string'); |
615 | 615 | } |
616 | 616 | |
617 | - throw new Exception('Invalid cell coordinate '.$pCoordinateString); |
|
617 | + throw new Exception('Invalid cell coordinate ' . $pCoordinateString); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | /** |
@@ -642,12 +642,12 @@ discard block |
||
642 | 642 | |
643 | 643 | // Create absolute coordinate |
644 | 644 | if (ctype_digit($pCoordinateString)) { |
645 | - return $worksheet.'$'.$pCoordinateString; |
|
645 | + return $worksheet . '$' . $pCoordinateString; |
|
646 | 646 | } elseif (ctype_alpha($pCoordinateString)) { |
647 | - return $worksheet.'$'.strtoupper($pCoordinateString); |
|
647 | + return $worksheet . '$' . strtoupper($pCoordinateString); |
|
648 | 648 | } |
649 | 649 | |
650 | - return $worksheet.self::absoluteCoordinate($pCoordinateString); |
|
650 | + return $worksheet . self::absoluteCoordinate($pCoordinateString); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | throw new Exception('Cell coordinate string can not be a range of cells'); |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | $column = ltrim($column, '$'); |
681 | 681 | $row = ltrim($row, '$'); |
682 | 682 | |
683 | - return $worksheet.'$'.$column.'$'.$row; |
|
683 | + return $worksheet . '$' . $column . '$' . $row; |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | throw new Exception('Cell coordinate string can not be a range of cells'); |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | return $_indexCache[$pString]; |
862 | 862 | } |
863 | 863 | } |
864 | - throw new Exception('Column string index can not be '.((isset($pString{0})) ? 'longer than 3 characters' : 'empty')); |
|
864 | + throw new Exception('Column string index can not be ' . ((isset($pString{0})) ? 'longer than 3 characters' : 'empty')); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | /** |
@@ -883,11 +883,11 @@ discard block |
||
883 | 883 | if ($pColumnIndex < 26) { |
884 | 884 | $_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex); |
885 | 885 | } elseif ($pColumnIndex < 702) { |
886 | - $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)). |
|
886 | + $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) . |
|
887 | 887 | chr(65 + $pColumnIndex % 26); |
888 | 888 | } else { |
889 | - $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)). |
|
890 | - chr(65 + ((($pColumnIndex - 26) % 676) / 26)). |
|
889 | + $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) . |
|
890 | + chr(65 + ((($pColumnIndex - 26) % 676) / 26)) . |
|
891 | 891 | chr(65 + $pColumnIndex % 26); |
892 | 892 | } |
893 | 893 | } |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | // Loop cells |
939 | 939 | while ($currentCol != $endCol) { |
940 | 940 | while ($currentRow <= $endRow) { |
941 | - $returnValue[] = $currentCol.$currentRow; |
|
941 | + $returnValue[] = $currentCol . $currentRow; |
|
942 | 942 | ++$currentRow; |
943 | 943 | } |
944 | 944 | ++$currentCol; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | public function getHashCode() |
87 | 87 | { |
88 | 88 | return md5( |
89 | - $this->text. |
|
89 | + $this->text . |
|
90 | 90 | __CLASS__ |
91 | 91 | ); |
92 | 92 | } |
@@ -79,8 +79,8 @@ |
||
79 | 79 | public function getHashCode() |
80 | 80 | { |
81 | 81 | return md5( |
82 | - $this->getText(). |
|
83 | - $this->font->getHashCode(). |
|
82 | + $this->getText() . |
|
83 | + $this->font->getHashCode() . |
|
84 | 84 | __CLASS__ |
85 | 85 | ); |
86 | 86 | } |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | $to = array_values($this->getMapping()); |
250 | 250 | |
251 | 251 | foreach ($patterns as $pattern) { |
252 | - foreach (glob($path.$pattern) as $file) { |
|
252 | + foreach (glob($path . $pattern) as $file) { |
|
253 | 253 | $original = file_get_contents($file); |
254 | 254 | $converted = str_replace($from, $to, $original); |
255 | 255 | |
256 | 256 | if ($original !== $converted) { |
257 | - echo $file." converted\n"; |
|
257 | + echo $file . " converted\n"; |
|
258 | 258 | file_put_contents($file, $converted); |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | 263 | // Do the recursion in subdirectory |
264 | - foreach (glob($path.'/*', GLOB_ONLYDIR) as $subpath) { |
|
265 | - if (strpos($subpath, $path.'/') === 0) { |
|
264 | + foreach (glob($path . '/*', GLOB_ONLYDIR) as $subpath) { |
|
265 | + if (strpos($subpath, $path . '/') === 0) { |
|
266 | 266 | $this->recursiveReplace($subpath); |
267 | 267 | } |
268 | 268 | } |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | public function migrate() |
272 | 272 | { |
273 | 273 | $path = realpath(getcwd()); |
274 | - echo 'This will search and replace recursively in '.$path.PHP_EOL; |
|
275 | - echo 'You MUST backup your files first, or you risk losing data.'.PHP_EOL; |
|
274 | + echo 'This will search and replace recursively in ' . $path . PHP_EOL; |
|
275 | + echo 'You MUST backup your files first, or you risk losing data.' . PHP_EOL; |
|
276 | 276 | echo 'Are you sure ? (y/n)'; |
277 | 277 | |
278 | 278 | $confirm = fread(STDIN, 1); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getPageHeading() |
56 | 56 | { |
57 | - return $this->isIndex() ? '' : '<h1>'.str_replace('_', ' ', $this->getScriptFilename()).'</h1>'; |
|
57 | + return $this->isIndex() ? '' : '<h1>' . str_replace('_', ' ', $this->getScriptFilename()) . '</h1>'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | // Populate samples |
68 | 68 | $files = []; |
69 | - foreach (glob(realpath(__DIR__.'/../../../samples').'/*.php') as $file) { |
|
69 | + foreach (glob(realpath(__DIR__ . '/../../../samples') . '/*.php') as $file) { |
|
70 | 70 | $info = pathinfo($file); |
71 | 71 | $name = str_replace('_', ' ', preg_replace('/(|\.php)/', '', $info['filename'])); |
72 | 72 | if (preg_match('/^\d+/', $name)) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function getTemporaryFolder() |
114 | 114 | { |
115 | - $tempFolder = sys_get_temp_dir().'/phpspreadsheet'; |
|
115 | + $tempFolder = sys_get_temp_dir() . '/phpspreadsheet'; |
|
116 | 116 | if (!is_dir($tempFolder)) { |
117 | 117 | mkdir($tempFolder); |
118 | 118 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getFilename($filename, $extension = 'xlsx') |
132 | 132 | { |
133 | - return $this->getTemporaryFolder().'/'.str_replace('.php', '.'.$extension, basename($filename)); |
|
133 | + return $this->getTemporaryFolder() . '/' . str_replace('.php', '.' . $extension, basename($filename)); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $temporaryFilename = tempnam($this->getTemporaryFolder(), 'phpspreadsheet-'); |
146 | 146 | unlink($temporaryFilename); |
147 | 147 | |
148 | - return $temporaryFilename.'.'.$extension; |
|
148 | + return $temporaryFilename . '.' . $extension; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | public function log($message) |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function logEndingNotes() |
160 | 160 | { |
161 | 161 | // Do not show execution time for index |
162 | - $this->log('Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).'MB'); |
|
162 | + $this->log('Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . 'MB'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $callTime = $callEndTime - $callStartTime; |
176 | 176 | $reflection = new \ReflectionClass($writer); |
177 | 177 | $format = $reflection->getShortName(); |
178 | - $message = "Write {$format} format to <code>{$path}</code> in ".sprintf('%.4f', $callTime).' seconds'; |
|
178 | + $message = "Write {$format} format to <code>{$path}</code> in " . sprintf('%.4f', $callTime) . ' seconds'; |
|
179 | 179 | |
180 | 180 | $this->log($message); |
181 | 181 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | $callEndTime = microtime(true); |
193 | 193 | $callTime = $callEndTime - $callStartTime; |
194 | - $message = "Read {$format} format from <code>{$path}</code> in ".sprintf('%.4f', $callTime).' seconds'; |
|
194 | + $message = "Read {$format} format from <code>{$path}</code> in " . sprintf('%.4f', $callTime) . ' seconds'; |
|
195 | 195 | |
196 | 196 | $this->log($message); |
197 | 197 | } |
@@ -665,7 +665,7 @@ |
||
665 | 665 | $richtextRun->getFont()->setSize($this->size); |
666 | 666 | } |
667 | 667 | if ($this->color) { |
668 | - $richtextRun->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color('ff'.$this->color)); |
|
668 | + $richtextRun->getFont()->setColor(new \PhpOffice\PhpSpreadsheet\Style\Color('ff' . $this->color)); |
|
669 | 669 | } |
670 | 670 | if ($this->bold) { |
671 | 671 | $richtextRun->getFont()->setBold(true); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $rangeStart[1] : $rangeEnd[1] - $yMax + $y; |
328 | 328 | |
329 | 329 | // build range for region |
330 | - $range = $colStart.$rowStart.':'.$colEnd.$rowEnd; |
|
330 | + $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; |
|
331 | 331 | |
332 | 332 | // retrieve relevant style array for region |
333 | 333 | $regionStyles = $pStyles; |
@@ -630,14 +630,14 @@ discard block |
||
630 | 630 | } |
631 | 631 | |
632 | 632 | return md5( |
633 | - $this->fill->getHashCode(). |
|
634 | - $this->font->getHashCode(). |
|
635 | - $this->borders->getHashCode(). |
|
636 | - $this->alignment->getHashCode(). |
|
637 | - $this->numberFormat->getHashCode(). |
|
638 | - $hashConditionals. |
|
639 | - $this->protection->getHashCode(). |
|
640 | - ($this->quotePrefix ? 't' : 'f'). |
|
633 | + $this->fill->getHashCode() . |
|
634 | + $this->font->getHashCode() . |
|
635 | + $this->borders->getHashCode() . |
|
636 | + $this->alignment->getHashCode() . |
|
637 | + $this->numberFormat->getHashCode() . |
|
638 | + $hashConditionals . |
|
639 | + $this->protection->getHashCode() . |
|
640 | + ($this->quotePrefix ? 't' : 'f') . |
|
641 | 641 | __CLASS__ |
642 | 642 | ); |
643 | 643 | } |