PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.2
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.2
2.4.3 2.4.4 2.4.2 2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 All 60 releases
easy-invoice / vendor / sabberworm / php-css-parser / src / Value / ValueList.php

ValueList.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.4.2, at vendor/sabberworm/php-css-parser/src/Value/ValueList.php

115 lines 2.7 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 /**
8 * A `ValueList` represents a lists of `Value`s, separated by some separation character
9 * (mostly `,`, whitespace, or `/`).
10 *
11 * There are two types of `ValueList`s: `RuleValueList` and `CSSFunction`
12 */
13 abstract class ValueList extends Value
14 {
15 /**
16 * @var array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
17 *
18 * @internal since 8.8.0
19 */
20 protected $aComponents;
21
22 /**
23 * @var string
24 *
25 * @internal since 8.8.0
26 */
27 protected $sSeparator;
28
29 /**
30 * phpcs:ignore Generic.Files.LineLength
31 * @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>|RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $aComponents
32 * @param string $sSeparator
33 * @param int $iLineNo
34 */
35 public function __construct($aComponents = [], $sSeparator = ',', $iLineNo = 0)
36 {
37 parent::__construct($iLineNo);
38 if (!is_array($aComponents)) {
39 $aComponents = [$aComponents];
40 }
41 $this->aComponents = $aComponents;
42 $this->sSeparator = $sSeparator;
43 }
44
45 /**
46 * @param RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string $mComponent
47 *
48 * @return void
49 */
50 public function addListComponent($mComponent)
51 {
52 $this->aComponents[] = $mComponent;
53 }
54
55 /**
56 * @return array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string>
57 */
58 public function getListComponents()
59 {
60 return $this->aComponents;
61 }
62
63 /**
64 * @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents
65 *
66 * @return void
67 */
68 public function setListComponents(array $aComponents)
69 {
70 $this->aComponents = $aComponents;
71 }
72
73 /**
74 * @return string
75 */
76 public function getListSeparator()
77 {
78 return $this->sSeparator;
79 }
80
81 /**
82 * @param string $sSeparator
83 *
84 * @return void
85 */
86 public function setListSeparator($sSeparator)
87 {
88 $this->sSeparator = $sSeparator;
89 }
90
91 /**
92 * @return string
93 *
94 * @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
95 */
96 public function __toString()
97 {
98 return $this->render(new OutputFormat());
99 }
100
101 /**
102 * @param OutputFormat|null $oOutputFormat
103 *
104 * @return string
105 */
106 public function render($oOutputFormat)
107 {
108 return $oOutputFormat->implode(
109 $oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator
110 . $oOutputFormat->spaceAfterListArgumentSeparator($this->sSeparator),
111 $this->aComponents
112 );
113 }
114 }
115