Improve SCrutinizer happiness

This commit is contained in:
MarkBaker 2020-07-05 17:35:13 +02:00
parent cf6769eab1
commit 961dc693d1
2 changed files with 3 additions and 5 deletions

View File

@ -632,7 +632,7 @@ class Xml extends BaseReader
$xml_x = $worksheet->children($namespaces['x']); $xml_x = $worksheet->children($namespaces['x']);
if (isset($xml_x->WorksheetOptions)) { if (isset($xml_x->WorksheetOptions)) {
$printSettings = $this->pageSetup($xml_x, $namespaces, $this->getPrintDefaults()); $printSettings = $this->pageSetup($xml_x, $namespaces, $this->getPrintDefaults());
$printSettings = $this->printSetup($xml_x, $namespaces, $printSettings); $printSettings = $this->printSetup($xml_x, $printSettings);
$spreadsheet->getActiveSheet()->getPageSetup() $spreadsheet->getActiveSheet()->getPageSetup()
->setPaperSize($printSettings->paperSize) ->setPaperSize($printSettings->paperSize)
@ -933,7 +933,7 @@ class Xml extends BaseReader
return $printDefaults; return $printDefaults;
} }
private function printSetup(SimpleXMLElement $xmlX, array $namespaces, stdClass $printDefaults): stdClass private function printSetup(SimpleXMLElement $xmlX, stdClass $printDefaults): stdClass
{ {
if (isset($xmlX->WorksheetOptions->Print)) { if (isset($xmlX->WorksheetOptions->Print)) {
foreach ($xmlX->WorksheetOptions->Print as $printData) { foreach ($xmlX->WorksheetOptions->Print as $printData) {

View File

@ -875,9 +875,7 @@ class Worksheet extends WriterPart
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber()); $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
$objWriter->writeAttribute('useFirstPageNumber', '1'); $objWriter->writeAttribute('useFirstPageNumber', '1');
} }
if ($pSheet->getPageSetup()->getPageOrder() !== null) { $objWriter->writeAttribute('pageOrder', $pSheet->getPageSetup()->getPageOrder());
$objWriter->writeAttribute('pageOrder', $pSheet->getPageSetup()->getPageOrder());
}
$getUnparsedLoadedData = $pSheet->getParent()->getUnparsedLoadedData(); $getUnparsedLoadedData = $pSheet->getParent()->getUnparsedLoadedData();
if (isset($getUnparsedLoadedData['sheets'][$pSheet->getCodeName()]['pageSetupRelId'])) { if (isset($getUnparsedLoadedData['sheets'][$pSheet->getCodeName()]['pageSetupRelId'])) {