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 / Charset.php

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

77 lines 2.1 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\CSSString;
12 /**
13 * Class representing an `@charset` rule.
14 *
15 * The following restrictions apply:
16 * - May not be found in any CSSList other than the Document.
17 * - May only appear at the very top of a Document’s contents.
18 * - Must not appear more than once.
19 */
20 class Charset implements AtRule, Positionable
21 {
22 use CommentContainer;
23 use Position;
24 use ShortClassNameProvider;
25 /**
26 * @var CSSString
27 */
28 private $charset;
29 /**
30 * @param int<1, max>|null $lineNumber
31 */
32 public function __construct(CSSString $charset, ?int $lineNumber = null)
33 {
34 $this->charset = $charset;
35 $this->setPosition($lineNumber);
36 }
37 /**
38 * @param string|CSSString $charset
39 */
40 public function setCharset($charset) : void
41 {
42 $charset = $charset instanceof CSSString ? $charset : new CSSString($charset);
43 $this->charset = $charset;
44 }
45 public function getCharset() : string
46 {
47 return $this->charset->getString();
48 }
49 /**
50 * @return non-empty-string
51 */
52 public function render(OutputFormat $outputFormat) : string
53 {
54 return "{$outputFormat->getFormatter()->comments($this)}@charset {$this->charset->render($outputFormat)};";
55 }
56 /**
57 * @return non-empty-string
58 */
59 public function atRuleName() : string
60 {
61 return 'charset';
62 }
63 public function atRuleArgs() : CSSString
64 {
65 return $this->charset;
66 }
67 /**
68 * @return array<string, bool|int|float|string|array<mixed>|null>
69 *
70 * @internal
71 */
72 public function getArrayRepresentation() : array
73 {
74 return ['class' => $this->getShortClassName(), 'charset' => $this->charset->getArrayRepresentation()];
75 }
76 }
77