See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\Wizard; 4 5 use PhpOffice\PhpSpreadsheet\Exception; 6 use PhpOffice\PhpSpreadsheet\Style\Conditional; 7 use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\Wizard; 8 9 /** 10 * @method Expression formula(string $expression) 11 */ 12 class Expression extends WizardAbstract implements WizardInterface 13 { 14 /** 15 * @var string 16 */ 17 protected $expression; 18 19 public function __construct(string $cellRange) 20 { 21 parent::__construct($cellRange); 22 } 23 24 public function expression(string $expression): self 25 { 26 $expression = $this->validateOperand($expression, Wizard::VALUE_TYPE_FORMULA); 27 $this->expression = $expression; 28 29 return $this; 30 } 31 32 public function getConditional(): Conditional 33 { 34 $expression = $this->adjustConditionsForCellReferences([$this->expression]); 35 36 $conditional = new Conditional(); 37 $conditional->setConditionType(Conditional::CONDITION_EXPRESSION); 38 $conditional->setConditions($expression); 39 $conditional->setStyle($this->getStyle()); 40 $conditional->setStopIfTrue($this->getStopIfTrue()); 41 42 return $conditional; 43 } 44 45 public static function fromConditional(Conditional $conditional, string $cellRange = 'A1'): WizardInterface 46 { 47 if ($conditional->getConditionType() !== Conditional::CONDITION_EXPRESSION) { 48 throw new Exception('Conditional is not an Expression CF Rule conditional'); 49 } 50 51 $wizard = new self($cellRange); 52 $wizard->style = $conditional->getStyle(); 53 $wizard->stopIfTrue = $conditional->getStopIfTrue(); 54 $wizard->expression = self::reverseAdjustCellRef((string) ($conditional->getConditions()[0]), $cellRange); 55 56 return $wizard; 57 } 58 59 /** 60 * @param string $methodName 61 * @param mixed[] $arguments 62 */ 63 public function __call($methodName, $arguments): self 64 { 65 if ($methodName !== 'formula') { 66 throw new Exception('Invalid Operation for Expression CF Rule Wizard'); 67 } 68 69 $this->expression(...$arguments); 70 71 return $this; 72 } 73 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body