3 namespace Sabberworm\CSS\Value
;
5 abstract class ValueList
extends Value
{
7 protected $aComponents;
10 public function __construct($aComponents = array(), $sSeparator = ',', $iLineNo = 0) {
11 parent
::__construct($iLineNo);
12 if (!is_array($aComponents)) {
13 $aComponents = array($aComponents);
15 $this->aComponents
= $aComponents;
16 $this->sSeparator
= $sSeparator;
19 public function addListComponent($mComponent) {
20 $this->aComponents
[] = $mComponent;
23 public function getListComponents() {
24 return $this->aComponents
;
27 public function setListComponents($aComponents) {
28 $this->aComponents
= $aComponents;
31 public function getListSeparator() {
32 return $this->sSeparator
;
35 public function setListSeparator($sSeparator) {
36 $this->sSeparator
= $sSeparator;
39 public function __toString() {
40 return $this->render(new \Sabberworm\CSS\
OutputFormat());
43 public function render(\Sabberworm\CSS\OutputFormat
$oOutputFormat) {
44 return $oOutputFormat->implode($oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator
) . $this->sSeparator
. $oOutputFormat->spaceAfterListArgumentSeparator($this->sSeparator
), $this->aComponents
);