Merge Reader and Writer entities
Merged Cell/Row/Style entities
This commit is contained in:
parent
4d1d1c1e87
commit
f5168114d0
@ -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,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity\Style;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
/**
|
||||
* Class Border
|
@ -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;
|
@ -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,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity\Style;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
/**
|
||||
* Class Style
|
10
src/Spout/Common/Exception/InvalidColorException.php
Normal file
10
src/Spout/Common/Exception/InvalidColorException.php
Normal file
@ -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;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Reader\Common\Entity;
|
||||
namespace Box\Spout\Common\Entity;
|
||||
|
||||
class CellTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity;
|
||||
namespace Box\Spout\Common\Entity;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
|
||||
class RowTest extends TestCase
|
||||
class RowTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|Style
|
@ -1,11 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\EntityStyle;
|
||||
namespace Box\Spout\Common\Entity\Style;
|
||||
|
||||
use Box\Spout\Writer\Common\Creator\Style\BorderBuilder;
|
||||
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\Writer\Exception\Border\InvalidNameException;
|
||||
use Box\Spout\Writer\Exception\Border\InvalidStyleException;
|
||||
use Box\Spout\Writer\Exception\Border\InvalidWidthException;
|
@ -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 ColorTest
|
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Reader\Common\Entity;
|
||||
|
||||
class RowTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|Cell
|
||||
*/
|
||||
private function getCellMock()
|
||||
{
|
||||
return $this->createMock(Cell::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testValidInstance()
|
||||
{
|
||||
$this->assertInstanceOf(Row::class, new Row([], null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testSetCells()
|
||||
{
|
||||
$row = new Row([], null);
|
||||
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
|
||||
|
||||
$this->assertEquals(2, $row->getNumCells());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testSetCellsResets()
|
||||
{
|
||||
$row = new Row([], null);
|
||||
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
|
||||
|
||||
$this->assertEquals(2, $row->getNumCells());
|
||||
|
||||
$row->setCells([$this->getCellMock()]);
|
||||
|
||||
$this->assertEquals(1, $row->getNumCells());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testGetCells()
|
||||
{
|
||||
$row = new Row([], null);
|
||||
|
||||
$this->assertEquals(0, $row->getNumCells());
|
||||
|
||||
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
|
||||
|
||||
$this->assertEquals(2, $row->getNumCells());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testAddCell()
|
||||
{
|
||||
$row = new Row([], null);
|
||||
$row->setCells([$this->getCellMock(), $this->getCellMock()]);
|
||||
|
||||
$this->assertEquals(2, $row->getNumCells());
|
||||
|
||||
$row->addCell($this->getCellMock());
|
||||
|
||||
$this->assertEquals(3, $row->getNumCells());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testFluentInterface()
|
||||
{
|
||||
$row = new Row([], null);
|
||||
$row
|
||||
->addCell($this->getCellMock())
|
||||
->setCells([]);
|
||||
|
||||
$this->assertTrue(is_object($row));
|
||||
}
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Reader\Common\Manager;
|
||||
|
||||
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;
|
||||
use Box\Spout\Reader\XLSX\Creator\HelperFactory;
|
||||
use Box\Spout\Reader\XLSX\Creator\InternalEntityFactory;
|
||||
use Box\Spout\Reader\XLSX\Creator\ManagerFactory;
|
||||
@ -37,7 +37,7 @@ class RowManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$rowManager = $this->createRowManager();
|
||||
|
||||
$rowToFill = new Row([]);
|
||||
$rowToFill = new Row([], null);
|
||||
foreach ($rowCells as $cellIndex => $cell) {
|
||||
$rowToFill->setCellAtIndex($cell, $cellIndex);
|
||||
}
|
||||
@ -70,7 +70,7 @@ class RowManagerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testIsEmptyRow(array $cells, $expectedIsEmpty)
|
||||
{
|
||||
$rowManager = $this->createRowManager();
|
||||
$row = new Row($cells);
|
||||
$row = new Row($cells, null);
|
||||
|
||||
$this->assertEquals($expectedIsEmpty, $rowManager->isEmpty($row));
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
|
||||
if ($expectedDateAsString === null) {
|
||||
$this->fail('An exception should have been thrown');
|
||||
} else {
|
||||
$this->assertInstanceOf('DateTime', $result);
|
||||
$this->assertInstanceOf(\DateTime::class, $result);
|
||||
$this->assertSame($expectedDateAsString, $result->format('Y-m-d H:i:s'));
|
||||
}
|
||||
} catch (InvalidValueException $exception) {
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
namespace Box\Spout\Writer\CSV;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Helper\EncodingHelper;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
|
||||
|
@ -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\Color;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ class StyleBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$mergedStyle = $styleMerger->merge($currentStyle, $baseStyle);
|
||||
|
||||
$this->assertEquals(null, $currentStyle->getBorder(), 'Current style has no border');
|
||||
$this->assertInstanceOf('Box\Spout\Writer\Common\Entity\Style\Border', $baseStyle->getBorder(), 'Base style has a border');
|
||||
$this->assertInstanceOf('Box\Spout\Writer\Common\Entity\Style\Border', $mergedStyle->getBorder(), 'Merged style has a border');
|
||||
$this->assertInstanceOf(Border::class, $baseStyle->getBorder(), 'Base style has a border');
|
||||
$this->assertInstanceOf(Border::class, $mergedStyle->getBorder(), 'Merged style has a border');
|
||||
}
|
||||
}
|
||||
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Box\Spout\Writer\Common\Entity;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class CellTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testValidInstance()
|
||||
{
|
||||
$this->assertInstanceOf(Cell::class, new Cell('cell'));
|
||||
$this->assertInstanceOf(Cell::class, new Cell('cell-with-style', $this->createMock(Style::class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCellTypeNumeric()
|
||||
{
|
||||
$this->assertTrue((new Cell(0))->isNumeric());
|
||||
$this->assertTrue((new Cell(1))->isNumeric());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCellTypeString()
|
||||
{
|
||||
$this->assertTrue((new Cell('String!'))->isString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCellTypeEmptyString()
|
||||
{
|
||||
$this->assertTrue((new Cell(''))->isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCellTypeEmptyNull()
|
||||
{
|
||||
$this->assertTrue((new Cell(null))->isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCellTypeBool()
|
||||
{
|
||||
$this->assertTrue((new Cell(true))->isBoolean());
|
||||
$this->assertTrue((new Cell(false))->isBoolean());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testCellTypeError()
|
||||
{
|
||||
$this->assertTrue((new Cell([]))->isError());
|
||||
}
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Manager\CellManager;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Spout\Writer\Common\Manager;
|
||||
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Manager\RowManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
|
||||
/**
|
||||
* Class StyleManagerTest
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleMergerTest
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Box\Spout\Writer\Common\Manager\Style;
|
||||
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Class StyleRegistryTest
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Exception\SpoutException;
|
||||
@ -9,7 +10,6 @@ use Box\Spout\Common\Type;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Helper\ZipHelper;
|
||||
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
|
@ -2,16 +2,16 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\Style\BorderBuilder;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Box\Spout\Writer;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
|
||||
/**
|
||||
* Trait RowCreationHelper
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX\Manager\Style;
|
||||
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Creator\Style\BorderBuilder;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
|
||||
/**
|
||||
* Class StyleRegistryTest
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Exception\SpoutException;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
|
@ -2,17 +2,17 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Common\Type;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use Box\Spout\Writer\Common\Creator\EntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\Style\BorderBuilder;
|
||||
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
|
||||
use Box\Spout\Writer\Common\Entity\Cell;
|
||||
use Box\Spout\Writer\Common\Entity\Row;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Border;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Color;
|
||||
use Box\Spout\Writer\Common\Entity\Style\Style;
|
||||
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
|
||||
use Box\Spout\Writer\Exception\WriterNotOpenedException;
|
||||
use Box\Spout\Writer\RowCreationHelper;
|
||||
@ -26,7 +26,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
|
||||
use TestUsingResource;
|
||||
use RowCreationHelper;
|
||||
|
||||
/** @var \Box\Spout\Writer\Common\Entity\Style\Style */
|
||||
/** @var \Box\Spout\Common\Entity\Style\Style */
|
||||
private $defaultStyle;
|
||||
|
||||
/**
|
||||
@ -531,7 +531,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @param Row[] $allRows
|
||||
* @param string $fileName
|
||||
* @param \Box\Spout\Writer\Common\Entity\Style\Style|null $defaultStyle
|
||||
* @param \Box\Spout\Common\Entity\Style\Style|null $defaultStyle
|
||||
* @return Writer
|
||||
*/
|
||||
private function writeToXLSXFileWithDefaultStyle($allRows, $fileName, $defaultStyle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user