CSSFunction.php
2 years ago
CSSString.php
4 years ago
CalcFunction.php
2 years ago
CalcRuleValueList.php
4 years ago
Color.php
2 years ago
LineName.php
4 years ago
PrimitiveValue.php
4 years ago
RuleValueList.php
4 years ago
Size.php
2 years ago
URL.php
2 years ago
Value.php
2 years ago
ValueList.php
4 years ago
index.php
3 years ago
ValueList.php
47 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Sabberworm\CSS\Value; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Sabberworm\CSS\OutputFormat; |
| 5 | abstract class ValueList extends Value |
| 6 | { |
| 7 | protected $aComponents; |
| 8 | protected $sSeparator; |
| 9 | public function __construct($aComponents = [], $sSeparator = ',', $iLineNo = 0) |
| 10 | { |
| 11 | parent::__construct($iLineNo); |
| 12 | if (!\is_array($aComponents)) { |
| 13 | $aComponents = [$aComponents]; |
| 14 | } |
| 15 | $this->aComponents = $aComponents; |
| 16 | $this->sSeparator = $sSeparator; |
| 17 | } |
| 18 | public function addListComponent($mComponent) |
| 19 | { |
| 20 | $this->aComponents[] = $mComponent; |
| 21 | } |
| 22 | public function getListComponents() |
| 23 | { |
| 24 | return $this->aComponents; |
| 25 | } |
| 26 | public function setListComponents(array $aComponents) |
| 27 | { |
| 28 | $this->aComponents = $aComponents; |
| 29 | } |
| 30 | public function getListSeparator() |
| 31 | { |
| 32 | return $this->sSeparator; |
| 33 | } |
| 34 | public function setListSeparator($sSeparator) |
| 35 | { |
| 36 | $this->sSeparator = $sSeparator; |
| 37 | } |
| 38 | public function __toString() |
| 39 | { |
| 40 | return $this->render(new OutputFormat()); |
| 41 | } |
| 42 | public function render(OutputFormat $oOutputFormat) |
| 43 | { |
| 44 | return $oOutputFormat->implode($oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator . $oOutputFormat->spaceAfterListArgumentSeparator($this->sSeparator), $this->aComponents); |
| 45 | } |
| 46 | } |
| 47 |