Merge Reader and Writer entities
Merged Cell/Row/Style entities
This commit is contained in:
1 parent
4d1d1c1e87
commit
f5168114d0
66 files changed
+183
-576
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity;
|
||||
namespace Box\Spout\Common\Entity;
|
||||
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Helper\CellTypeHelper;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class Cell
|
||||
@@ -36,10 +36,15 @@ class Cell
|
||||
*/
|
||||
const TYPE_BOOLEAN = 4;
|
||||
|
||||
/**
|
||||
* Date cell type
|
||||
*/
|
||||
const TYPE_DATE = 5;
|
||||
|
||||
/**
|
||||
* Error cell type
|
||||
*/
|
||||
const TYPE_ERROR = 5;
|
||||
const TYPE_ERROR = 6;
|
||||
|
||||
/**
|
||||
* The value of this cell
|
||||
@@ -110,6 +115,14 @@ class Cell
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value type
|
||||
*
|
||||
@@ -124,9 +137,12 @@ class Cell
|
||||
if (CellTypeHelper::isEmpty($value)) {
|
||||
return self::TYPE_EMPTY;
|
||||
}
|
||||
if (CellTypeHelper::isNumeric($this->getValue())) {
|
||||
if (CellTypeHelper::isNumeric($value)) {
|
||||
return self::TYPE_NUMERIC;
|
||||
}
|
||||
if (CellTypeHelper::isDateTimeOrDateInterval($value)) {
|
||||
return self::TYPE_DATE;
|
||||
}
|
||||
if (CellTypeHelper::isNonEmptyString($value)) {
|
||||
return self::TYPE_STRING;
|
||||
}
|
||||
@@ -150,16 +166,6 @@ class Cell
|
||||
return $this->type === self::TYPE_EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Not used at the moment
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFormula()
|
||||
{
|
||||
return $this->type === self::TYPE_FORMULA;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity;
|
||||
namespace Box\Spout\Common\Entity;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
class Row
|
||||
{
|
||||
@@ -40,7 +40,7 @@ class Row
|
||||
|
||||
/**
|
||||
* @param Cell[] $cells
|
||||
* @return $this
|
||||
* @return Row
|
||||
*/
|
||||
public function setCells(array $cells)
|
||||
{
|
||||
@@ -53,20 +53,14 @@ class Row
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Style
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
return $this->style;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Style|null $style
|
||||
* @param Cell $cell
|
||||
* @param mixed $cellIndex
|
||||
* @parma int $cellIndex
|
||||
* @return Row
|
||||
*/
|
||||
public function setStyle($style)
|
||||
public function setCellAtIndex(Cell $cell, $cellIndex)
|
||||
{
|
||||
$this->style = $style ?: new Style();
|
||||
$this->cells[$cellIndex] = $cell;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -89,4 +83,33 @@ class Row
|
||||
{
|
||||
return count($this->cells);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Style
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
return $this->style;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Style|null $style
|
||||
* @return Row
|
||||
*/
|
||||
public function setStyle($style)
|
||||
{
|
||||
$this->style = $style ?: new Style();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array The row values, as array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return array_map(function (Cell $cell) {
|
||||
return !$cell->isError() ? $cell->getValue() : null;
|
||||
}, $this->cells);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity\Style;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
/**
|
||||
* Class Border
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity\Style;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
use Box\Spout\Writer\Exception\Border\InvalidNameException;
|
||||
use Box\Spout\Writer\Exception\Border\InvalidStyleException;
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity\Style;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
use Box\Spout\Writer\Exception\InvalidColorException;
|
||||
use Box\Spout\Common\Exception\InvalidColorException;
|
||||
|
||||
/**
|
||||
* Class Color
|
||||
@@ -49,7 +49,7 @@ class Color
|
||||
* Throws an exception is the color component value is outside of bounds (0 - 255)
|
||||
*
|
||||
* @param int $colorComponent
|
||||
* @throws \Box\Spout\Writer\Exception\InvalidColorException
|
||||
* @throws \Box\Spout\Common\Exception\InvalidColorException
|
||||
* @return void
|
||||
*/
|
||||
protected static function throwIfInvalidColorComponentValue($colorComponent)
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity\Style;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
/**
|
||||
* Class Style
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Common\Exception;
|
||||
|
||||
/**
|
||||
* Class InvalidColorException
|
||||
*/
|
||||
class InvalidColorException extends SpoutException
|
||||
{
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace Box\Spout\Reader\CSV\Creator;
|
||||
|
||||
use Box\Spout\Common\Creator\HelperFactory;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Reader\Common\Creator\InternalEntityFactoryInterface;
|
||||
use Box\Spout\Reader\Common\Entity\Cell;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Reader\CSV\RowIterator;
|
||||
use Box\Spout\Reader\CSV\Sheet;
|
||||
use Box\Spout\Reader\CSV\SheetIterator;
|
||||
@@ -71,7 +71,7 @@ class InternalEntityFactory implements InternalEntityFactoryInterface
|
||||
*/
|
||||
public function createRow(array $cells = [])
|
||||
{
|
||||
return new Row($cells);
|
||||
return new Row($cells, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace Box\Spout\Reader\CSV;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Helper\EncodingHelper;
|
||||
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Reader\Common\Entity\Options;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Reader\CSV\Creator\InternalEntityFactory;
|
||||
use Box\Spout\Reader\IteratorInterface;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Reader\Common\Creator;
|
||||
|
||||
use Box\Spout\Reader\Common\Entity\Cell;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
|
||||
/**
|
||||
* Interface EntityFactoryInterface
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Reader\Common\Entity;
|
||||
|
||||
use Box\Spout\Common\Helper\CellTypeHelper;
|
||||
|
||||
/**
|
||||
* Class Cell
|
||||
*/
|
||||
class Cell
|
||||
{
|
||||
/**
|
||||
* Numeric cell type (whole numbers, fractional numbers, dates)
|
||||
*/
|
||||
const TYPE_NUMERIC = 0;
|
||||
|
||||
/**
|
||||
* String (text) cell type
|
||||
*/
|
||||
const TYPE_STRING = 1;
|
||||
|
||||
/**
|
||||
* Formula cell type
|
||||
* Not used at the moment
|
||||
*/
|
||||
const TYPE_FORMULA = 2;
|
||||
|
||||
/**
|
||||
* Empty cell type
|
||||
*/
|
||||
const TYPE_EMPTY = 3;
|
||||
|
||||
/**
|
||||
* Boolean cell type
|
||||
*/
|
||||
const TYPE_BOOLEAN = 4;
|
||||
|
||||
/**
|
||||
* Date cell type
|
||||
*/
|
||||
const TYPE_DATE = 5;
|
||||
|
||||
/**
|
||||
* Error cell type
|
||||
*/
|
||||
const TYPE_ERROR = 6;
|
||||
|
||||
/**
|
||||
* The value of this cell
|
||||
* @var mixed|null
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* The cell type
|
||||
* @var int|null
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->setValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed|null $value
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->type = $this->detectType($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value type
|
||||
*
|
||||
* @param mixed|null $value
|
||||
* @return int
|
||||
*/
|
||||
protected function detectType($value)
|
||||
{
|
||||
if (CellTypeHelper::isBoolean($value)) {
|
||||
return self::TYPE_BOOLEAN;
|
||||
}
|
||||
if (CellTypeHelper::isEmpty($value)) {
|
||||
return self::TYPE_EMPTY;
|
||||
}
|
||||
if (CellTypeHelper::isNumeric($value)) {
|
||||
return self::TYPE_NUMERIC;
|
||||
}
|
||||
if (CellTypeHelper::isDateTimeOrDateInterval($value)) {
|
||||
return self::TYPE_DATE;
|
||||
}
|
||||
if (CellTypeHelper::isNonEmptyString($value)) {
|
||||
return self::TYPE_STRING;
|
||||
}
|
||||
|
||||
return self::TYPE_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isBoolean()
|
||||
{
|
||||
return $this->type === self::TYPE_BOOLEAN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->type === self::TYPE_EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNumeric()
|
||||
{
|
||||
return $this->type === self::TYPE_NUMERIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isString()
|
||||
{
|
||||
return $this->type === self::TYPE_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isError()
|
||||
{
|
||||
return $this->type === self::TYPE_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Reader\Common\Entity;
|
||||
|
||||
class Row
|
||||
{
|
||||
/**
|
||||
* The cells in this row
|
||||
* @var Cell[]
|
||||
*/
|
||||
protected $cells = [];
|
||||
|
||||
/**
|
||||
* Row constructor.
|
||||
* @param Cell[] $cells
|
||||
*/
|
||||
public function __construct(array $cells)
|
||||
{
|
||||
$this->setCells($cells);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Cell[] $cells
|
||||
*/
|
||||
public function getCells()
|
||||
{
|
||||
return $this->cells;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Cell[] $cells
|
||||
* @return Row
|
||||
*/
|
||||
public function setCells(array $cells)
|
||||
{
|
||||
$this->cells = [];
|
||||
foreach ($cells as $cell) {
|
||||
$this->addCell($cell);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Cell $cell
|
||||
* @param mixed $cellIndex
|
||||
* @parma int $cellIndex
|
||||
* @return Row
|
||||
*/
|
||||
public function setCellAtIndex(Cell $cell, $cellIndex)
|
||||
{
|
||||
$this->cells[$cellIndex] = $cell;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Cell $cell
|
||||
* @return Row
|
||||
*/
|
||||
public function addCell(Cell $cell)
|
||||
{
|
||||
$this->cells[] = $cell;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNumCells()
|
||||
{
|
||||
return count($this->cells);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array The row values, as array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return array_map(function (Cell $cell) {
|
||||
return !$cell->isError() ? $cell->getValue() : null;
|
||||
}, $this->cells);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Reader\Common\Manager;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\Creator\InternalEntityFactoryInterface;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
|
||||
/**
|
||||
* Class RowManager
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Box\Spout\Reader\ODS\Creator;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\Creator\InternalEntityFactoryInterface;
|
||||
use Box\Spout\Reader\Common\Entity\Cell;
|
||||
use Box\Spout\Reader\Common\Entity\Options;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\XMLProcessor;
|
||||
use Box\Spout\Reader\ODS\RowIterator;
|
||||
use Box\Spout\Reader\ODS\Sheet;
|
||||
@@ -84,7 +84,7 @@ class InternalEntityFactory implements InternalEntityFactoryInterface
|
||||
*/
|
||||
public function createRow(array $cells = [])
|
||||
{
|
||||
return new Row($cells);
|
||||
return new Row($cells, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace Box\Spout\Reader\ODS;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Reader\Common\Entity\Cell;
|
||||
use Box\Spout\Reader\Common\Entity\Options;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\Manager\RowManager;
|
||||
use Box\Spout\Reader\Common\XMLProcessor;
|
||||
use Box\Spout\Reader\Exception\InvalidValueException;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Box\Spout\Reader\XLSX\Creator;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\Creator\InternalEntityFactoryInterface;
|
||||
use Box\Spout\Reader\Common\Entity\Cell;
|
||||
use Box\Spout\Reader\Common\Entity\Options;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\XMLProcessor;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
use Box\Spout\Reader\XLSX\Manager\SharedStringsManager;
|
||||
@@ -118,7 +118,7 @@ class InternalEntityFactory implements InternalEntityFactoryInterface
|
||||
*/
|
||||
public function createRow(array $cells = [])
|
||||
{
|
||||
return new Row($cells);
|
||||
return new Row($cells, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Box\Spout\Reader\XLSX;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Reader\Common\Entity\Cell;
|
||||
use Box\Spout\Reader\Common\Entity\Row;
|
||||
use Box\Spout\Reader\Common\Manager\RowManager;
|
||||
use Box\Spout\Reader\Common\XMLProcessor;
|
||||
use Box\Spout\Reader\Exception\InvalidValueException;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Box\Spout\Writer\CSV;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Helper\EncodingHelper;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\WriterAbstract;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Creator;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\WriterInterface;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Creator\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
|
||||
/**
|
||||
* Class BorderBuilder
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Creator\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleBuilder
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
|
||||
|
||||
class CellManager
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
|
||||
class RowManager
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleManager
|
||||
@@ -69,7 +69,7 @@ class StyleManager implements StyleManagerInterface
|
||||
* on the Windows version of Excel...
|
||||
*
|
||||
* @param Cell $cell The cell the style should be applied to
|
||||
* @return \Box\Spout\Writer\Common\Entity\Style\Style The eventually updated style
|
||||
* @return \Box\Spout\Common\Entity\Style\Style The eventually updated style
|
||||
*/
|
||||
protected function applyWrapTextIfCellContainsNewLine(Cell $cell)
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Interface StyleHManagernterface
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleMerger
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleRegistry
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Creator\InternalEntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Common\Entity\Workbook;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Common\Entity\Workbook;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Exception\Border;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Writer\Exception\WriterException;
|
||||
|
||||
class InvalidNameException extends WriterException
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Exception\Border;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Writer\Exception\WriterException;
|
||||
|
||||
class InvalidStyleException extends WriterException
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\Exception\Border;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Writer\Exception\WriterException;
|
||||
|
||||
class InvalidWidthException extends WriterException
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Exception;
|
||||
|
||||
/**
|
||||
* Class InvalidColorException
|
||||
*/
|
||||
class InvalidColorException extends WriterException
|
||||
{
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS\Helper;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
|
||||
/**
|
||||
* Class BorderHelper
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\ODS\Helper\BorderHelper;
|
||||
|
||||
@@ -189,7 +189,7 @@ EOD;
|
||||
/**
|
||||
* Returns the contents of the "<style:style>" section, inside "<office:automatic-styles>" section
|
||||
*
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @param \Box\Spout\Common\Entity\Style\Style $style
|
||||
* @return string
|
||||
*/
|
||||
protected function getStyleSectionContent($style)
|
||||
@@ -209,7 +209,7 @@ EOD;
|
||||
/**
|
||||
* Returns the contents of the "<style:text-properties>" section, inside "<style:style>" section
|
||||
*
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @param \Box\Spout\Common\Entity\Style\Style $style
|
||||
* @return string
|
||||
*/
|
||||
private function getTextPropertiesSectionContent($style)
|
||||
@@ -226,7 +226,7 @@ EOD;
|
||||
/**
|
||||
* Returns the contents of the "<style:text-properties>" section, inside "<style:style>" section
|
||||
*
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @param \Box\Spout\Common\Entity\Style\Style $style
|
||||
* @return string
|
||||
*/
|
||||
private function getFontSectionContent($style)
|
||||
@@ -271,7 +271,7 @@ EOD;
|
||||
/**
|
||||
* Returns the contents of the "<style:table-cell-properties>" section, inside "<style:style>" section
|
||||
*
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @param \Box\Spout\Common\Entity\Style\Style $style
|
||||
* @return string
|
||||
*/
|
||||
private function getTableCellPropertiesSectionContent($style)
|
||||
@@ -306,7 +306,7 @@ EOD;
|
||||
/**
|
||||
* Returns the contents of the borders definition for the "<style:table-cell-properties>" section
|
||||
*
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @param \Box\Spout\Common\Entity\Style\Style $style
|
||||
* @return string
|
||||
*/
|
||||
private function getBorderXMLContent($style)
|
||||
@@ -323,7 +323,7 @@ EOD;
|
||||
/**
|
||||
* Returns the contents of the background color definition for the "<style:table-cell-properties>" section
|
||||
*
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style $style
|
||||
* @param \Box\Spout\Common\Entity\Style\Style $style
|
||||
* @return string
|
||||
*/
|
||||
private function getBackgroundColorXMLContent($style)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleRegistry
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS\Manager;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Helper\Escaper\ODS as ODSEscaper;
|
||||
use Box\Spout\Common\Helper\StringHelper;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
|
||||
use Box\Spout\Writer\Common\Manager\WorksheetManagerInterface;
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
namespace Box\Spout\Writer;
|
||||
|
||||
use Box\Spout\Common\Creator\HelperFactory;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Exception\SpoutException;
|
||||
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Interface WriterInterface
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace Box\Spout\Writer;
|
||||
|
||||
use Box\Spout\Common\Creator\HelperFactory;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Manager\WorkbookManagerInterface;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Helper;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\BorderPart;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\BorderPart;
|
||||
|
||||
class BorderHelper
|
||||
{
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\XLSX\Helper\BorderHelper;
|
||||
|
||||
/**
|
||||
@@ -153,7 +153,7 @@ EOD;
|
||||
$content .= '<border><left/><right/><top/><bottom/></border>';
|
||||
|
||||
foreach ($registeredBorders as $styleId) {
|
||||
/** @var \Box\Spout\Writer\Common\Entity\Style\Style $style */
|
||||
/** @var \Box\Spout\Common\Entity\Style\Style $style */
|
||||
$style = $this->styleRegistry->getStyleFromStyleId($styleId);
|
||||
$border = $style->getBorder();
|
||||
$content .= '<border>';
|
||||
@@ -163,7 +163,7 @@ EOD;
|
||||
|
||||
foreach ($sortOrder as $partName) {
|
||||
if ($border->hasPart($partName)) {
|
||||
/** @var $part \Box\Spout\Writer\Common\Entity\Style\BorderPart */
|
||||
/** @var $part \Box\Spout\Common\Entity\Style\BorderPart */
|
||||
$part = $border->getPart($partName);
|
||||
$content .= BorderHelper::serializeBorderPart($part);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Manager\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleRegistry
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Manager;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Helper\Escaper\XLSX as XLSXEscaper;
|
||||
use Box\Spout\Common\Helper\StringHelper;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Creator\InternalEntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Helper\CellHelper;
|
||||
use Box\Spout\Writer\Common\Manager\RowManager;
|
||||
|
||||
Reference in new issue
Block a user