Fix code style
This commit is contained in:
1 parent
740fcfb8c1
commit
b968513cb9
171 files changed
+517
-792
No files matched your search
@@ -9,8 +9,6 @@ use Box\Spout\Writer\Exception\InvalidSheetNameException;
|
||||
/**
|
||||
* Class SheetManager
|
||||
* Sheet manager
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager
|
||||
*/
|
||||
class SheetManager
|
||||
{
|
||||
@@ -42,8 +40,8 @@ class SheetManager
|
||||
*
|
||||
* @param string $name
|
||||
* @param Sheet $sheet The sheet whose future name is checked
|
||||
* @return void
|
||||
* @throws \Box\Spout\Writer\Exception\InvalidSheetNameException If the sheet's name is invalid.
|
||||
* @return void
|
||||
*/
|
||||
public function throwIfNameIsInvalid($name, Sheet $sheet)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,6 @@ use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
/**
|
||||
* Class StyleManager
|
||||
* Manages styles to be applied to a cell
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager\Style
|
||||
*/
|
||||
class StyleManager implements StyleManagerInterface
|
||||
{
|
||||
@@ -57,6 +55,7 @@ class StyleManager implements StyleManagerInterface
|
||||
public function applyExtraStylesIfNeeded($style, $dataRow)
|
||||
{
|
||||
$updatedStyle = $this->applyWrapTextIfCellContainsNewLine($style, $dataRow);
|
||||
|
||||
return $updatedStyle;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Interface StyleHManagernterface
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager\Style
|
||||
*/
|
||||
interface StyleManagerInterface
|
||||
{
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\XLSX\Helper\BorderHelper;
|
||||
|
||||
/**
|
||||
* Class StyleMerger
|
||||
* Takes care of merging styles together
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager\Style
|
||||
*/
|
||||
class StyleMerger
|
||||
{
|
||||
|
||||
@@ -7,8 +7,6 @@ use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
/**
|
||||
* Class StyleRegistry
|
||||
* Registry for all used styles
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager\Style
|
||||
*/
|
||||
class StyleRegistry
|
||||
{
|
||||
@@ -72,6 +70,7 @@ class StyleRegistry
|
||||
protected function getStyleFromSerializedStyle($serializedStyle)
|
||||
{
|
||||
$styleId = $this->serializedStyleToStyleIdMappingTable[$serializedStyle];
|
||||
|
||||
return $this->styleIdToStyleMappingTable[$styleId];
|
||||
}
|
||||
|
||||
|
||||
@@ -4,23 +4,21 @@ namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
|
||||
use Box\Spout\Writer\Common\Helper\FileSystemWithRootFolderHelperInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Workbook;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Helper\FileSystemWithRootFolderHelperInterface;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface;
|
||||
use Box\Spout\Writer\Exception\SheetNotFoundException;
|
||||
use Box\Spout\Writer\Exception\WriterException;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class WorkbookManagerAbstract
|
||||
* Abstract workbook manager, providing the generic interfaces to work with workbook.
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager
|
||||
*/
|
||||
abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
{
|
||||
@@ -48,7 +46,6 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
/** @var Worksheet The worksheet where data will be written to */
|
||||
protected $currentWorksheet;
|
||||
|
||||
|
||||
/**
|
||||
* @param Workbook $workbook
|
||||
* @param OptionsManagerInterface $optionsManager
|
||||
@@ -65,8 +62,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
StyleManagerInterface $styleManager,
|
||||
FileSystemWithRootFolderHelperInterface $fileSystemHelper,
|
||||
EntityFactory $entityFactory,
|
||||
ManagerFactoryInterface $managerFactory)
|
||||
{
|
||||
ManagerFactoryInterface $managerFactory
|
||||
) {
|
||||
$this->workbook = $workbook;
|
||||
$this->optionManager = $optionsManager;
|
||||
$this->worksheetManager = $worksheetManager;
|
||||
@@ -99,8 +96,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
* Creates a new sheet in the workbook and make it the current sheet.
|
||||
* The writing will resume where it stopped (i.e. data won't be truncated).
|
||||
*
|
||||
* @return Worksheet The created sheet
|
||||
* @throws IOException If unable to open the sheet for writing
|
||||
* @return Worksheet The created sheet
|
||||
*/
|
||||
public function addNewSheetAndMakeItCurrent()
|
||||
{
|
||||
@@ -113,8 +110,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
/**
|
||||
* Creates a new sheet in the workbook. The current sheet remains unchanged.
|
||||
*
|
||||
* @return Worksheet The created sheet
|
||||
* @throws \Box\Spout\Common\Exception\IOException If unable to open the sheet for writing
|
||||
* @return Worksheet The created sheet
|
||||
*/
|
||||
private function addNewSheet()
|
||||
{
|
||||
@@ -158,8 +155,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
* The writing will resume where it stopped (i.e. data won't be truncated).
|
||||
*
|
||||
* @param Sheet $sheet The "external" sheet to set as current
|
||||
* @return void
|
||||
* @throws SheetNotFoundException If the given sheet does not exist in the workbook
|
||||
* @return void
|
||||
*/
|
||||
public function setCurrentSheet(Sheet $sheet)
|
||||
{
|
||||
@@ -208,9 +205,9 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
* @param array $dataRow Array containing data to be written. Cannot be empty.
|
||||
* Example $dataRow = ['data1', 1234, null, '', 'data5'];
|
||||
* @param Style $style Style to be applied to the row.
|
||||
* @return void
|
||||
* @throws IOException If trying to create a new sheet and unable to open the sheet for writing
|
||||
* @throws WriterException If unable to write data
|
||||
* @return void
|
||||
*/
|
||||
public function addRowToCurrentWorksheet($dataRow, Style $style)
|
||||
{
|
||||
@@ -238,6 +235,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
private function hasCurrentWorkseetReachedMaxRows()
|
||||
{
|
||||
$currentWorksheet = $this->getCurrentWorksheet();
|
||||
|
||||
return ($currentWorksheet->getLastWrittenRowIndex() >= $this->getMaxRowsPerWorksheet());
|
||||
}
|
||||
|
||||
@@ -248,8 +246,8 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
* @param array $dataRow Array containing data to be written. Cannot be empty.
|
||||
* Example $dataRow = ['data1', 1234, null, '', 'data5'];
|
||||
* @param Style $style Style to be applied to the row.
|
||||
* @return void
|
||||
* @throws WriterException If unable to write data
|
||||
* @return void
|
||||
*/
|
||||
private function addRowWithStyleToWorksheet(Worksheet $worksheet, $dataRow, Style $style)
|
||||
{
|
||||
|
||||
@@ -4,17 +4,15 @@ namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Workbook;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Exception\SheetNotFoundException;
|
||||
use Box\Spout\Writer\Exception\WriterException;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Interface WorkbookManagerInterface
|
||||
* workbook manager interface, providing the generic interfaces to work with workbook.
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager
|
||||
*/
|
||||
interface WorkbookManagerInterface
|
||||
{
|
||||
@@ -27,8 +25,8 @@ interface WorkbookManagerInterface
|
||||
* Creates a new sheet in the workbook and make it the current sheet.
|
||||
* The writing will resume where it stopped (i.e. data won't be truncated).
|
||||
*
|
||||
* @return Worksheet The created sheet
|
||||
* @throws IOException If unable to open the sheet for writing
|
||||
* @return Worksheet The created sheet
|
||||
*/
|
||||
public function addNewSheetAndMakeItCurrent();
|
||||
|
||||
@@ -49,8 +47,8 @@ interface WorkbookManagerInterface
|
||||
* The writing will resume where it stopped (i.e. data won't be truncated).
|
||||
*
|
||||
* @param Sheet $sheet The "external" sheet to set as current
|
||||
* @return void
|
||||
* @throws SheetNotFoundException If the given sheet does not exist in the workbook
|
||||
* @return void
|
||||
*/
|
||||
public function setCurrentSheet(Sheet $sheet);
|
||||
|
||||
@@ -62,9 +60,9 @@ interface WorkbookManagerInterface
|
||||
* @param array $dataRow Array containing data to be written. Cannot be empty.
|
||||
* Example $dataRow = ['data1', 1234, null, '', 'data5'];
|
||||
* @param Style $style Style to be applied to the row.
|
||||
* @return void
|
||||
* @throws IOException If trying to create a new sheet and unable to open the sheet for writing
|
||||
* @throws WriterException If unable to write data
|
||||
* @return void
|
||||
*/
|
||||
public function addRowToCurrentWorksheet($dataRow, Style $style);
|
||||
|
||||
@@ -77,4 +75,4 @@ interface WorkbookManagerInterface
|
||||
* @return void
|
||||
*/
|
||||
public function close($finalFilePointer);
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,12 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
|
||||
/**
|
||||
* Interface WorksheetManagerInterface
|
||||
* Inteface for worksheet managers, providing the generic interfaces to work with worksheets.
|
||||
*
|
||||
* @package Box\Spout\Writer\Common\Manager
|
||||
*/
|
||||
interface WorksheetManagerInterface
|
||||
{
|
||||
@@ -20,9 +18,9 @@ interface 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 \Box\Spout\Common\Exception\IOException If the data cannot be written
|
||||
* @throws \Box\Spout\Common\Exception\InvalidArgumentException If a cell value's type is not supported
|
||||
* @return void
|
||||
*/
|
||||
public function addRow(Worksheet $worksheet, $dataRow, $rowStyle);
|
||||
|
||||
@@ -30,8 +28,8 @@ interface 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);
|
||||
|
||||
@@ -42,4 +40,4 @@ interface WorksheetManagerInterface
|
||||
* @return void
|
||||
*/
|
||||
public function close(Worksheet $worksheet);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user