some cleanup todos

This commit is contained in:
madflow 2017-08-01 13:01:12 +02:00
parent 99c327ba84
commit edccd21dbd
3 changed files with 8 additions and 9 deletions

View File

@ -70,15 +70,12 @@ class Cell
/** /**
* Cell constructor. * Cell constructor.
* @param $value mixed * @param $value mixed
* @param $style Style * @param $style|null Style
*/ */
public function __construct($value, Style $style = null) public function __construct($value, Style $style = null)
{ {
$this->setValue($value); $this->setValue($value);
if ($style) { $this->setStyle($style);
$this->setStyle($style);
}
$this->styleMerger = new StyleMerger(); $this->styleMerger = new StyleMerger();
} }
@ -108,7 +105,7 @@ class Cell
} }
/** /**
* @return Style * @return Style|null
*/ */
public function getStyle() public function getStyle()
{ {
@ -205,15 +202,15 @@ class Cell
/** /**
* @param Style $style|null * @param Style $style|null
* @return $this * @return Cell
*/ */
public function applyStyle(Style $style = null) public function applyStyle(Style $style = null)
{ {
if ($style === null) { if ($style === null) {
return $this; return $this;
} }
$merged = $this->styleMerger->merge($this->getStyle(), $style); $mergedStyle = $this->styleMerger->merge($this->getStyle(), $style);
$this->setStyle($merged); $this->setStyle($mergedStyle);
return $this; return $this;
} }
} }

View File

@ -119,6 +119,7 @@ class WorksheetManager implements WorksheetManagerInterface
/** @var Cell|null $nextCell */ /** @var Cell|null $nextCell */
$nextCell = isset($cells[$nextCellIndex]) ? $cells[$nextCellIndex] : null; $nextCell = isset($cells[$nextCellIndex]) ? $cells[$nextCellIndex] : null;
// @TODO refactoring: move this to its own method
if (null === $nextCell || $cell->getValue() !== $nextCell->getValue()) { if (null === $nextCell || $cell->getValue() !== $nextCell->getValue()) {
// Apply styles - the row style is merged at this point // Apply styles - the row style is merged at this point

View File

@ -149,6 +149,7 @@ EOD;
$rowXML = '<row r="' . $rowIndex . '" spans="1:' . $numCells . '">'; $rowXML = '<row r="' . $rowIndex . '" spans="1:' . $numCells . '">';
// @TODO refactoring: move this to its own method
/** @var Cell $cell */ /** @var Cell $cell */
foreach($row->getCells() as $cell) { foreach($row->getCells() as $cell) {
// Apply styles - the row style is merged at this point // Apply styles - the row style is merged at this point