Rename ManagedStyle to PossiblyUpdatedStyle and add documentation

This commit is contained in:
Antoine Lamirault authored and Adrien Loison committed 2021-03-30 19:42:21 +02:00
1 parent 8a17d6c71f
commit eb84ec9364
7 files changed
+52 -43

No files matched your search

@@ -4,6 +4,10 @@ namespace Box\Spout\Writer\Common\Manager;
use Box\Spout\Common\Entity\Style\Style;
/**
* Class RegisteredStyle
* Allow to know if this style must replace actual row style.
*/
class RegisteredStyle
{
/**
@@ -14,12 +18,12 @@ class RegisteredStyle
/**
* @var bool
*/
private $isRowStyle;
private $isMatchingRowStyle;
public function __construct(Style $style, bool $isRowStyle)
public function __construct(Style $style, bool $isMatchingRowStyle)
{
$this->style = $style;
$this->isRowStyle = $isRowStyle;
$this->isMatchingRowStyle = $isMatchingRowStyle;
}
public function getStyle() : Style
@@ -27,8 +31,8 @@ class RegisteredStyle
return $this->style;
}
public function isRowStyle() : bool
public function isMatchingRowStyle() : bool
{
return $this->isRowStyle;
return $this->isMatchingRowStyle;
}
}
@@ -4,7 +4,12 @@ namespace Box\Spout\Writer\Common\Manager\Style;
use Box\Spout\Common\Entity\Style\Style;
class ManagedStyle
/**
* Class PossiblyUpdatedStyle
* Indicates if style is updated.
* It allow to know if style registration must be done.
*/
class PossiblyUpdatedStyle
{
private $style;
private $isUpdated;
@@ -50,9 +50,9 @@ class StyleManager implements StyleManagerInterface
* Typically, set "wrap text" if a cell contains a new line.
*
* @param Cell $cell
* @return ManagedStyle The eventually updated style
* @return PossiblyUpdatedStyle The eventually updated style
*/
public function applyExtraStylesIfNeeded(Cell $cell) : ManagedStyle
public function applyExtraStylesIfNeeded(Cell $cell) : PossiblyUpdatedStyle
{
return $this->applyWrapTextIfCellContainsNewLine($cell);
}
@@ -67,9 +67,9 @@ class StyleManager implements StyleManagerInterface
* on the Windows version of Excel...
*
* @param Cell $cell The cell the style should be applied to
* @return ManagedStyle The eventually updated style
* @return PossiblyUpdatedStyle The eventually updated style
*/
protected function applyWrapTextIfCellContainsNewLine(Cell $cell) : ManagedStyle
protected function applyWrapTextIfCellContainsNewLine(Cell $cell) : PossiblyUpdatedStyle
{
$cellStyle = $cell->getStyle();
@@ -77,9 +77,9 @@ class StyleManager implements StyleManagerInterface
if (!$cellStyle->hasSetWrapText() && $cell->isString() && \strpos($cell->getValue(), "\n") !== false) {
$cellStyle->setShouldWrapText();
return new ManagedStyle($cellStyle, true);
return new PossiblyUpdatedStyle($cellStyle, true);
}
return new ManagedStyle($cellStyle, false);
return new PossiblyUpdatedStyle($cellStyle, false);
}
}
@@ -24,7 +24,7 @@ interface StyleManagerInterface
* Typically, set "wrap text" if a cell contains a new line.
*
* @param Cell $cell
* @return ManagedStyle The eventually updated style
* @return PossiblyUpdatedStyle The eventually updated style
*/
public function applyExtraStylesIfNeeded(Cell $cell) : ManagedStyle;
public function applyExtraStylesIfNeeded(Cell $cell) : PossiblyUpdatedStyle;
}