1<?php 2 3namespace PhpCss\Ast\Selector { 4 5 use PhpCss\Ast; 6 7 class Sequence extends Ast\Selector { 8 9 /** 10 * @var Simple[] 11 */ 12 public $simples = []; 13 public $combinator; 14 15 /** 16 * @param Simple[] $simples 17 * @param Combinator|NULL $combinator 18 */ 19 public function __construct(array $simples = [], Combinator $combinator = NULL) { 20 $this->simples = $simples; 21 $this->combinator = $combinator; 22 } 23 24 /** 25 * Accept visitors, because this element has children, enter and leave are called. 26 * 27 * @param Ast\Visitor $visitor 28 * @return null|void 29 */ 30 public function accept(Ast\Visitor $visitor): void { 31 if ($visitor->visitEnter($this)) { 32 foreach ($this->simples as $simple) { 33 $simple->accept($visitor); 34 } 35 if (isset($this->combinator)) { 36 $this->combinator->accept($visitor); 37 } 38 $visitor->visitLeave($this); 39 } 40 } 41 } 42} 43