Satisfy php-cs-fixer

This commit is contained in:
Alexander Hofstede 2019-12-20 23:59:17 +01:00
parent c1757d23bf
commit 36573eaa8a
6 changed files with 13 additions and 8 deletions

View File

@ -60,5 +60,4 @@ trait ManagesCellSize
{ {
$this->columnWidths[] = [$start, $end, $width]; $this->columnWidths[] = [$start, $end, $width];
} }
} }

View File

@ -15,7 +15,6 @@ use Box\Spout\Writer\Common\Helper\FileSystemWithRootFolderHelperInterface;
use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface; use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface;
use Box\Spout\Writer\Common\Manager\Style\StyleMerger; use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
use Box\Spout\Writer\Exception\SheetNotFoundException; use Box\Spout\Writer\Exception\SheetNotFoundException;
use Box\Spout\Writer\Exception\WriterException;
/** /**
* Class WorkbookManagerAbstract * Class WorkbookManagerAbstract

View File

@ -191,9 +191,10 @@ EOD;
// Sort column widths since ODS cares about order // Sort column widths since ODS cares about order
usort($this->columnWidths, function ($a, $b) { usort($this->columnWidths, function ($a, $b) {
if ($a[0] == $b[0]) { if ($a[0] === $b[0]) {
return 0; return 0;
} }
return ($a[0] < $b[0]) ? -1 : 1; return ($a[0] < $b[0]) ? -1 : 1;
}); });
$content .= $this->getTableColumnStylesXMLContent(); $content .= $this->getTableColumnStylesXMLContent();
@ -415,6 +416,7 @@ EOD;
</style:style> </style:style>
EOD; EOD;
} }
return $content; return $content;
} }
@ -434,6 +436,7 @@ EOD;
// Note: This assumes the column widths are contiguous and default width is // Note: This assumes the column widths are contiguous and default width is
// only applied to columns after the last custom column with a custom width // only applied to columns after the last custom column with a custom width
$content .= '<table:table-column table:default-cell-style-name="ce1" table:style-name="default-column-style" table:number-columns-repeated="' . ($maxNumColumns - $entry[1]) . '"/>'; $content .= '<table:table-column table:default-cell-style-name="ce1" table:style-name="default-column-style" table:number-columns-repeated="' . ($maxNumColumns - $entry[1]) . '"/>';
return $content; return $content;
} }
} }

View File

@ -102,7 +102,7 @@ class WorksheetManager implements WorksheetManagerInterface
$escapedSheetName = $this->stringsEscaper->escape($externalSheet->getName()); $escapedSheetName = $this->stringsEscaper->escape($externalSheet->getName());
$tableStyleName = 'ta' . ($externalSheet->getIndex() + 1); $tableStyleName = 'ta' . ($externalSheet->getIndex() + 1);
$tableElement = '<table:table table:style-name="' . $tableStyleName . '" table:name="' . $escapedSheetName . '">'; $tableElement = '<table:table table:style-name="' . $tableStyleName . '" table:name="' . $escapedSheetName . '">';
$tableElement .= $this->styleManager->getStyledTableColumnXMLContent($worksheet->getMaxNumColumns()); $tableElement .= $this->styleManager->getStyledTableColumnXMLContent($worksheet->getMaxNumColumns());
return $tableElement; return $tableElement;

View File

@ -57,8 +57,10 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
{ {
$this->throwIfWriterAlreadyOpened('Writer must be configured before opening it.'); $this->throwIfWriterAlreadyOpened('Writer must be configured before opening it.');
$this->optionsManager->setOption(Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY, $this->optionsManager->setOption(
$shouldCreateNewSheetsAutomatically); Options::SHOULD_CREATE_NEW_SHEETS_AUTOMATICALLY,
$shouldCreateNewSheetsAutomatically
);
return $this; return $this;
} }
@ -77,8 +79,8 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
/** /**
* Returns all the workbook's sheets * Returns all the workbook's sheets
* *
* @return Sheet[] All the workbook's sheets
* @throws WriterNotOpenedException If the writer has not been opened yet * @throws WriterNotOpenedException If the writer has not been opened yet
* @return Sheet[] All the workbook's sheets
*/ */
public function getSheets() public function getSheets()
{ {

View File

@ -232,7 +232,7 @@ EOD;
if ($cell->isString()) { if ($cell->isString()) {
$cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue()); $cellXML .= $this->getCellXMLFragmentForNonEmptyString($cell->getValue());
} elseif ($cell->isBoolean()) { } elseif ($cell->isBoolean()) {
$cellXML .= ' t="b"><v>' . (int)($cell->getValue()) . '</v></c>'; $cellXML .= ' t="b"><v>' . (int) ($cell->getValue()) . '</v></c>';
} elseif ($cell->isNumeric()) { } elseif ($cell->isNumeric()) {
$cellXML .= '><v>' . $cell->getValue() . '</v></c>'; $cellXML .= '><v>' . $cell->getValue() . '</v></c>';
} elseif ($cell->isError() && is_string($cell->getValueEvenIfError())) { } elseif ($cell->isError() && is_string($cell->getValueEvenIfError())) {
@ -291,6 +291,7 @@ EOD;
$xml .= '<col min="' . $entry[0] . '" max="' . $entry[1] . '" width="' . $entry[2] . '" customWidth="true"/>'; $xml .= '<col min="' . $entry[0] . '" max="' . $entry[1] . '" width="' . $entry[2] . '" customWidth="true"/>';
} }
$xml .= '</cols>'; $xml .= '</cols>';
return $xml; return $xml;
} }
@ -308,6 +309,7 @@ EOD;
} }
// Ensure that the required defaultRowHeight is set // Ensure that the required defaultRowHeight is set
$rowHeightXml = empty($rowHeightXml) ? ' defaultRowHeight="0"' : $rowHeightXml; $rowHeightXml = empty($rowHeightXml) ? ' defaultRowHeight="0"' : $rowHeightXml;
return "<sheetFormatPr{$colWidthXml}{$rowHeightXml}/>"; return "<sheetFormatPr{$colWidthXml}{$rowHeightXml}/>";
} }