PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.19
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.19
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / sabberworm / php-css-parser / src / Property / Import.php

Import.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.19, at vendor_prefixed/sabberworm/php-css-parser/src/Property/Import.php

89 lines 2.4 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 namespace WCPOS\Vendor\Sabberworm\CSS\Property;
5
6 use WCPOS\Vendor\Sabberworm\CSS\Comment\CommentContainer;
7 use WCPOS\Vendor\Sabberworm\CSS\OutputFormat;
8 use WCPOS\Vendor\Sabberworm\CSS\Position\Position;
9 use WCPOS\Vendor\Sabberworm\CSS\Position\Positionable;
10 use WCPOS\Vendor\Sabberworm\CSS\ShortClassNameProvider;
11 use WCPOS\Vendor\Sabberworm\CSS\Value\URL;
12 /**
13 * Class representing an `@import` rule.
14 */
15 class Import implements AtRule, Positionable
16 {
17 use CommentContainer;
18 use Position;
19 use ShortClassNameProvider;
20 /**
21 * @var URL
22 */
23 private $location;
24 /**
25 * @var string|null
26 */
27 private $mediaQuery;
28 /**
29 * @param int<1, max>|null $lineNumber
30 */
31 public function __construct(URL $location, ?string $mediaQuery, ?int $lineNumber = null)
32 {
33 $this->location = $location;
34 $this->mediaQuery = $mediaQuery;
35 $this->setPosition($lineNumber);
36 }
37 public function setLocation(URL $location) : void
38 {
39 $this->location = $location;
40 }
41 public function getLocation() : URL
42 {
43 return $this->location;
44 }
45 /**
46 * @return non-empty-string
47 */
48 public function render(OutputFormat $outputFormat) : string
49 {
50 return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat) . ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
51 }
52 /**
53 * @return non-empty-string
54 */
55 public function atRuleName() : string
56 {
57 return 'import';
58 }
59 /**
60 * @return array{0: URL, 1?: non-empty-string}
61 */
62 public function atRuleArgs() : array
63 {
64 $result = [$this->location];
65 if (\is_string($this->mediaQuery) && $this->mediaQuery !== '') {
66 $result[] = $this->mediaQuery;
67 }
68 return $result;
69 }
70 public function getMediaQuery() : ?string
71 {
72 return $this->mediaQuery;
73 }
74 /**
75 * @return array<string, bool|int|float|string|array<mixed>|null>
76 *
77 * @internal
78 */
79 public function getArrayRepresentation() : array
80 {
81 return [
82 'class' => $this->getShortClassName(),
83 // We're using the term "uri" here to match the wording used in the specs:
84 // https://www.w3.org/TR/CSS22/cascade.html#at-import
85 'uri' => $this->location->getArrayRepresentation(),
86 ];
87 }
88 }
89