PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.1.4
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.1.4
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Libraries / Sabberworm / CSS / src / Value / ValueList.php

ValueList.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.1.4, at back/Libraries/Sabberworm/CSS/src/Value/ValueList.php

101 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sabberworm\CSS\Value;
4
5 use Sabberworm\CSS\OutputFormat;
6
7 abstract class ValueList extends Value
8 {
9 /**
10 * @var array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
11 */
12 protected $aComponents;
13
14 /**
15 * @var string
16 */
17 protected $sSeparator;
18
19 /**
20 * phpcs:ignore Generic.Files.LineLength
21 * @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>|RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $aComponents
22 * @param string $sSeparator
23 * @param int $iLineNo
24 */
25 public function __construct($aComponents = [], $sSeparator = ',', $iLineNo = 0)
26 {
27 parent::__construct($iLineNo);
28 if (!is_array($aComponents)) {
29 $aComponents = [$aComponents];
30 }
31 $this->aComponents = $aComponents;
32 $this->sSeparator = $sSeparator;
33 }
34
35 /**
36 * @param RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $mComponent
37 *
38 * @return void
39 */
40 public function addListComponent($mComponent)
41 {
42 $this->aComponents[] = $mComponent;
43 }
44
45 /**
46 * @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
47 */
48 public function getListComponents()
49 {
50 return $this->aComponents;
51 }
52
53 /**
54 * @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
55 *
56 * @return void
57 */
58 public function setListComponents(array $aComponents)
59 {
60 $this->aComponents = $aComponents;
61 }
62
63 /**
64 * @return string
65 */
66 public function getListSeparator()
67 {
68 return $this->sSeparator;
69 }
70
71 /**
72 * @param string $sSeparator
73 *
74 * @return void
75 */
76 public function setListSeparator($sSeparator)
77 {
78 $this->sSeparator = $sSeparator;
79 }
80
81 /**
82 * @return string
83 */
84 public function __toString()
85 {
86 return $this->render(new OutputFormat());
87 }
88
89 /**
90 * @return string
91 */
92 public function render(OutputFormat $oOutputFormat)
93 {
94 return $oOutputFormat->implode(
95 $oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator
96 . $oOutputFormat->spaceAfterListArgumentSeparator($this->sSeparator),
97 $this->aComponents
98 );
99 }
100 }
101