init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Conditional;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Style;
|
||||
|
||||
class CellStyleAssessor
|
||||
{
|
||||
protected CellMatcher $cellMatcher;
|
||||
|
||||
protected StyleMerger $styleMerger;
|
||||
|
||||
public function __construct(Cell $cell, string $conditionalRange)
|
||||
{
|
||||
$this->cellMatcher = new CellMatcher($cell, $conditionalRange);
|
||||
$this->styleMerger = new StyleMerger($cell->getStyle());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Conditional[] $conditionalStyles
|
||||
*/
|
||||
public function matchConditions(array $conditionalStyles = []): Style
|
||||
{
|
||||
foreach ($conditionalStyles as $conditional) {
|
||||
if ($this->cellMatcher->evaluateConditional($conditional) === true) {
|
||||
// Merging the conditional style into the base style goes in here
|
||||
$this->styleMerger->mergeStyle($conditional->getStyle());
|
||||
if ($conditional->getStopIfTrue() === true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->styleMerger->getStyle();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue