Fix code style
This commit is contained in:
1 parent
740fcfb8c1
commit
b968513cb9
171 files changed
+517
-792
No files matched your search
@@ -2,15 +2,13 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Common\Manager\OptionsManagerAbstract;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
|
||||
/**
|
||||
* Class OptionsManager
|
||||
* ODS Writer options manager
|
||||
*
|
||||
* @package Box\Spout\Writer\ODS\Manager
|
||||
*/
|
||||
class OptionsManager extends OptionsManagerAbstract
|
||||
{
|
||||
@@ -28,7 +26,7 @@ class OptionsManager extends OptionsManagerAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getSupportedOptions()
|
||||
{
|
||||
@@ -40,7 +38,7 @@ class OptionsManager extends OptionsManagerAbstract
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setDefaultOptions()
|
||||
{
|
||||
|
||||
@@ -8,8 +8,6 @@ use Box\Spout\Writer\ODS\Helper\BorderHelper;
|
||||
/**
|
||||
* Class StyleManager
|
||||
* Manages styles to be applied to a cell
|
||||
*
|
||||
* @package Box\Spout\Writer\ODS\Manager\Style
|
||||
*/
|
||||
class StyleManager extends \Box\Spout\Writer\Common\Manager\Style\StyleManager
|
||||
{
|
||||
@@ -24,7 +22,7 @@ class StyleManager extends \Box\Spout\Writer\Common\Manager\Style\StyleManager
|
||||
*/
|
||||
public function getStylesXMLFileContent($numWorksheets)
|
||||
{
|
||||
$content = <<<EOD
|
||||
$content = <<<'EOD'
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<office:document-styles office:version="1.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:msoxl="http://schemas.microsoft.com/office/excel/formula" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
EOD;
|
||||
@@ -34,7 +32,7 @@ EOD;
|
||||
$content .= $this->getAutomaticStylesSectionContent($numWorksheets);
|
||||
$content .= $this->getMasterStylesSectionContent($numWorksheets);
|
||||
|
||||
$content .= <<<EOD
|
||||
$content .= <<<'EOD'
|
||||
</office:document-styles>
|
||||
EOD;
|
||||
|
||||
@@ -132,7 +130,6 @@ EOD;
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the contents of the "<office:font-face-decls>" section, inside "content.xml" file.
|
||||
*
|
||||
@@ -163,7 +160,7 @@ EOD;
|
||||
$content .= $this->getStyleSectionContent($style);
|
||||
}
|
||||
|
||||
$content .= <<<EOD
|
||||
$content .= <<<'EOD'
|
||||
<style:style style:family="table-column" style:name="co1">
|
||||
<style:table-column-properties fo:break-before="auto"/>
|
||||
</style:style>
|
||||
|
||||
@@ -7,8 +7,6 @@ use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
/**
|
||||
* Class StyleRegistry
|
||||
* Registry for all used styles
|
||||
*
|
||||
* @package Box\Spout\Writer\ODS\Manager\Style
|
||||
*/
|
||||
class StyleRegistry extends \Box\Spout\Writer\Common\Manager\Style\StyleRegistry
|
||||
{
|
||||
|
||||
@@ -10,8 +10,6 @@ use Box\Spout\Writer\ODS\Manager\Style\StyleManager;
|
||||
/**
|
||||
* Class WorkbookManager
|
||||
* ODS workbook manager, providing the interfaces to work with workbook.
|
||||
*
|
||||
* @package Box\Spout\Writer\ODS\Manager
|
||||
*/
|
||||
class WorkbookManager extends WorkbookManagerAbstract
|
||||
{
|
||||
@@ -45,6 +43,7 @@ class WorkbookManager extends WorkbookManagerAbstract
|
||||
public function getWorksheetFilePath(Sheet $sheet)
|
||||
{
|
||||
$sheetsContentTempFolder = $this->fileSystemHelper->getSheetsContentTempFolder();
|
||||
|
||||
return $sheetsContentTempFolder . '/sheet' . $sheet->getIndex() . '.xml';
|
||||
}
|
||||
|
||||
@@ -65,4 +64,4 @@ class WorkbookManager extends WorkbookManagerAbstract
|
||||
->createStylesFile($this->styleManager, $numWorksheets)
|
||||
->zipRootFolderAndCopyToStream($finalFilePointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,13 @@ use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Helper\StringHelper;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Manager\WorksheetManagerInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\ODS\Manager\Style\StyleManager;
|
||||
|
||||
/**
|
||||
* Class WorksheetManager
|
||||
* ODS worksheet manager, providing the interfaces to work with ODS worksheets.
|
||||
*
|
||||
* @package Box\Spout\Writer\ODS\Manager
|
||||
*/
|
||||
class WorksheetManager implements WorksheetManagerInterface
|
||||
{
|
||||
@@ -39,8 +36,8 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
public function __construct(
|
||||
\Box\Spout\Common\Helper\Escaper\ODS $stringsEscaper,
|
||||
StringHelper $stringHelper,
|
||||
EntityFactory $entityFactory)
|
||||
{
|
||||
EntityFactory $entityFactory
|
||||
) {
|
||||
$this->stringsEscaper = $stringsEscaper;
|
||||
$this->stringHelper = $stringHelper;
|
||||
$this->entityFactory = $entityFactory;
|
||||
@@ -50,8 +47,8 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
* Prepares the worksheet to accept data
|
||||
*
|
||||
* @param Worksheet $worksheet The worksheet to start
|
||||
* @return void
|
||||
* @throws \Box\Spout\Common\Exception\IOException If the sheet data file cannot be opened for writing
|
||||
* @return void
|
||||
*/
|
||||
public function startSheet(Worksheet $worksheet)
|
||||
{
|
||||
@@ -65,8 +62,8 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
* Checks if the sheet has been sucessfully created. Throws an exception if not.
|
||||
*
|
||||
* @param bool|resource $sheetFilePointer Pointer to the sheet data file or FALSE if unable to open the file
|
||||
* @return void
|
||||
* @throws IOException If the sheet data file cannot be opened for writing
|
||||
* @return void
|
||||
*/
|
||||
private function throwIfSheetFilePointerIsNotAvailable($sheetFilePointer)
|
||||
{
|
||||
@@ -100,9 +97,9 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
* @param array $dataRow Array containing data to be written. Cannot be empty.
|
||||
* Example $dataRow = ['data1', 1234, null, '', 'data5'];
|
||||
* @param Style $rowStyle Style to be applied to the row. NULL means use default style.
|
||||
* @return void
|
||||
* @throws IOException If the data cannot be written
|
||||
* @throws InvalidArgumentException If a cell value's type is not supported
|
||||
* @return void
|
||||
*/
|
||||
public function addRow(Worksheet $worksheet, $dataRow, $rowStyle)
|
||||
{
|
||||
@@ -124,7 +121,6 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
// Using isset here because it is way faster than array_key_exists...
|
||||
if (!isset($dataRowWithNumericIndexes[$nextCellIndex]) ||
|
||||
$currentCellValue !== $dataRowWithNumericIndexes[$nextCellIndex]) {
|
||||
|
||||
$numTimesValueRepeated = ($nextCellIndex - $currentCellIndex);
|
||||
$data .= $this->getCellXML($currentCellValue, $styleIndex, $numTimesValueRepeated);
|
||||
|
||||
@@ -152,8 +148,8 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
* @param mixed $cellValue The value to be written
|
||||
* @param int $styleIndex Index of the used style
|
||||
* @param int $numTimesValueRepeated Number of times the value is consecutively repeated
|
||||
* @return string The cell XML content
|
||||
* @throws \Box\Spout\Common\Exception\InvalidArgumentException If a cell value's type is not supported
|
||||
* @return string The cell XML content
|
||||
*/
|
||||
private function getCellXML($cellValue, $styleIndex, $numTimesValueRepeated)
|
||||
{
|
||||
@@ -163,7 +159,7 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
$data .= ' table:number-columns-repeated="' . $numTimesValueRepeated . '"';
|
||||
}
|
||||
|
||||
/** @TODO Remove code duplication with XLSX writer: https://github.com/box/spout/pull/383#discussion_r113292746 */
|
||||
/* @TODO Remove code duplication with XLSX writer: https://github.com/box/spout/pull/383#discussion_r113292746 */
|
||||
if ($cellValue instanceof Cell) {
|
||||
$cell = $cellValue;
|
||||
} else {
|
||||
@@ -179,15 +175,15 @@ class WorksheetManager implements WorksheetManagerInterface
|
||||
}
|
||||
|
||||
$data .= '</table:table-cell>';
|
||||
} else if ($cell->isBoolean()) {
|
||||
} elseif ($cell->isBoolean()) {
|
||||
$data .= ' office:value-type="boolean" calcext:value-type="boolean" office:boolean-value="' . $cell->getValue() . '">';
|
||||
$data .= '<text:p>' . $cell->getValue() . '</text:p>';
|
||||
$data .= '</table:table-cell>';
|
||||
} else if ($cell->isNumeric()) {
|
||||
} elseif ($cell->isNumeric()) {
|
||||
$data .= ' office:value-type="float" calcext:value-type="float" office:value="' . $cell->getValue() . '">';
|
||||
$data .= '<text:p>' . $cell->getValue() . '</text:p>';
|
||||
$data .= '</table:table-cell>';
|
||||
} else if ($cell->isEmpty()) {
|
||||
} elseif ($cell->isEmpty()) {
|
||||
$data .= '/>';
|
||||
} else {
|
||||
throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . gettype($cell->getValue()));
|
||||
|
||||
Reference in new issue
Block a user