PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.4
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.4
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 / Property / Import.php

Import.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.4.4, at vendor/sabberworm/php-css-parser/src/Property/Import.php

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