See Release Notes
Long Term Support Release
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting; 4 5 use PhpOffice\PhpSpreadsheet\Cell\Cell; 6 use PhpOffice\PhpSpreadsheet\Style\Conditional; 7 use PhpOffice\PhpSpreadsheet\Style\Style; 8 9 class CellStyleAssessor 10 { 11 /** 12 * @var CellMatcher 13 */ 14 protected $cellMatcher; 15 16 /** 17 * @var StyleMerger 18 */ 19 protected $styleMerger; 20 21 public function __construct(Cell $cell, string $conditionalRange) 22 { 23 $this->cellMatcher = new CellMatcher($cell, $conditionalRange); 24 $this->styleMerger = new StyleMerger($cell->getStyle()); 25 } 26 27 /** 28 * @param Conditional[] $conditionalStyles 29 */ 30 public function matchConditions(array $conditionalStyles = []): Style 31 { 32 foreach ($conditionalStyles as $conditional) { 33 /** @var Conditional $conditional */ 34 if ($this->cellMatcher->evaluateConditional($conditional) === true) { 35 // Merging the conditional style into the base style goes in here 36 $this->styleMerger->mergeStyle($conditional->getStyle()); 37 if ($conditional->getStopIfTrue() === true) { 38 break; 39 } 40 } 41 } 42 43 return $this->styleMerger->getStyle(); 44 } 45 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body