PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
yatra / vendor / sabberworm / php-css-parser / src / Property / CSSNamespace.php

CSSNamespace.php in Yatra – Travel Booking & Tour Operator Software trunk, at vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php

157 lines 2.8 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\Property;
4
5 use Sabberworm\CSS\Comment\Comment;
6 use Sabberworm\CSS\OutputFormat;
7 use Sabberworm\CSS\Position\Position;
8 use Sabberworm\CSS\Position\Positionable;
9
10 /**
11 * `CSSNamespace` represents an `@namespace` rule.
12 */
13 class CSSNamespace implements AtRule, Positionable
14 {
15 use Position;
16
17 /**
18 * @var string
19 */
20 private $mUrl;
21
22 /**
23 * @var string
24 */
25 private $sPrefix;
26
27 /**
28 * @var int
29 */
30 private $iLineNo;
31
32 /**
33 * @var array<array-key, Comment>
34 *
35 * @internal since 8.8.0
36 */
37 protected $aComments;
38
39 /**
40 * @param string $mUrl
41 * @param string|null $sPrefix
42 * @param int $iLineNo
43 */
44 public function __construct($mUrl, $sPrefix = null, $iLineNo = 0)
45 {
46 $this->mUrl = $mUrl;
47 $this->sPrefix = $sPrefix;
48 $this->setPosition($iLineNo);
49 $this->aComments = [];
50 }
51
52 /**
53 * @return string
54 *
55 * @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
56 */
57 public function __toString()
58 {
59 return $this->render(new OutputFormat());
60 }
61
62 /**
63 * @param OutputFormat|null $oOutputFormat
64 *
65 * @return string
66 */
67 public function render($oOutputFormat)
68 {
69 return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
70 . $this->mUrl->render($oOutputFormat) . ';';
71 }
72
73 /**
74 * @return string
75 */
76 public function getUrl()
77 {
78 return $this->mUrl;
79 }
80
81 /**
82 * @return string|null
83 */
84 public function getPrefix()
85 {
86 return $this->sPrefix;
87 }
88
89 /**
90 * @param string $mUrl
91 *
92 * @return void
93 */
94 public function setUrl($mUrl)
95 {
96 $this->mUrl = $mUrl;
97 }
98
99 /**
100 * @param string $sPrefix
101 *
102 * @return void
103 */
104 public function setPrefix($sPrefix)
105 {
106 $this->sPrefix = $sPrefix;
107 }
108
109 /**
110 * @return string
111 */
112 public function atRuleName()
113 {
114 return 'namespace';
115 }
116
117 /**
118 * @return array<int, string>
119 */
120 public function atRuleArgs()
121 {
122 $aResult = [$this->mUrl];
123 if ($this->sPrefix) {
124 array_unshift($aResult, $this->sPrefix);
125 }
126 return $aResult;
127 }
128
129 /**
130 * @param array<array-key, Comment> $aComments
131 *
132 * @return void
133 */
134 public function addComments(array $aComments)
135 {
136 $this->aComments = array_merge($this->aComments, $aComments);
137 }
138
139 /**
140 * @return array<array-key, Comment>
141 */
142 public function getComments()
143 {
144 return $this->aComments;
145 }
146
147 /**
148 * @param array<array-key, Comment> $aComments
149 *
150 * @return void
151 */
152 public function setComments(array $aComments)
153 {
154 $this->aComments = $aComments;
155 }
156 }
157