PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.10.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.10.2
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 / Property / Import.php

Import.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.10.2, at back/Libraries/Sabberworm/CSS/src/Property/Import.php

86 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AcyMailing\Libraries\Sabberworm\CSS\Property;
6
7 use AcyMailing\Libraries\Sabberworm\CSS\Comment\CommentContainer;
8 use AcyMailing\Libraries\Sabberworm\CSS\OutputFormat;
9 use AcyMailing\Libraries\Sabberworm\CSS\Position\Position;
10 use AcyMailing\Libraries\Sabberworm\CSS\Position\Positionable;
11 use AcyMailing\Libraries\Sabberworm\CSS\Value\URL;
12
13 /**
14 * Class representing an `@import` rule.
15 */
16 class Import implements AtRule, Positionable
17 {
18 use CommentContainer;
19 use Position;
20
21 /**
22 * @var URL
23 */
24 private $location;
25
26 /**
27 * @var string|null
28 */
29 private $mediaQuery;
30
31 /**
32 * @param int<1, max>|null $lineNumber
33 */
34 public function __construct(URL $location, ?string $mediaQuery, ?int $lineNumber = null)
35 {
36 $this->location = $location;
37 $this->mediaQuery = $mediaQuery;
38 $this->setPosition($lineNumber);
39 }
40
41 public function setLocation(URL $location): void
42 {
43 $this->location = $location;
44 }
45
46 public function getLocation(): URL
47 {
48 return $this->location;
49 }
50
51 /**
52 * @return non-empty-string
53 */
54 public function render(OutputFormat $outputFormat): string
55 {
56 return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat)
57 . ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
58 }
59
60 /**
61 * @return non-empty-string
62 */
63 public function atRuleName(): string
64 {
65 return 'import';
66 }
67
68 /**
69 * @return array{0: URL, 1?: non-empty-string}
70 */
71 public function atRuleArgs(): array
72 {
73 $result = [$this->location];
74 if (\is_string($this->mediaQuery) && $this->mediaQuery !== '') {
75 $result[] = $this->mediaQuery;
76 }
77
78 return $result;
79 }
80
81 public function getMediaQuery(): ?string
82 {
83 return $this->mediaQuery;
84 }
85 }
86