PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.5
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.5
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 / RuleSet / AtRuleSet.php

AtRuleSet.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.5, at back/Libraries/Sabberworm/CSS/src/RuleSet/AtRuleSet.php

69 lines 1.6 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\RuleSet;
6
7 use AcyMailing\Libraries\Sabberworm\CSS\OutputFormat;
8 use AcyMailing\Libraries\Sabberworm\CSS\Property\AtRule;
9
10 /**
11 * This class represents rule sets for generic at-rules which are not covered by specific classes, i.e., not
12 * `@import`, `@charset` or `@media`.
13 *
14 * A common example for this is `@font-face`.
15 */
16 class AtRuleSet extends RuleSet implements AtRule
17 {
18 /**
19 * @var non-empty-string
20 */
21 private $type;
22
23 /**
24 * @var string
25 */
26 private $arguments;
27
28 /**
29 * @param non-empty-string $type
30 * @param int<1, max>|null $lineNumber
31 */
32 public function __construct(string $type, string $arguments = '', ?int $lineNumber = null)
33 {
34 parent::__construct($lineNumber);
35 $this->type = $type;
36 $this->arguments = $arguments;
37 }
38
39 /**
40 * @return non-empty-string
41 */
42 public function atRuleName(): string
43 {
44 return $this->type;
45 }
46
47 public function atRuleArgs(): string
48 {
49 return $this->arguments;
50 }
51
52 /**
53 * @return non-empty-string
54 */
55 public function render(OutputFormat $outputFormat): string
56 {
57 $formatter = $outputFormat->getFormatter();
58 $result = $formatter->comments($this);
59 $arguments = $this->arguments;
60 if ($arguments !== '') {
61 $arguments = ' ' . $arguments;
62 }
63 $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
64 $result .= $this->renderRules($outputFormat);
65 $result .= '}';
66 return $result;
67 }
68 }
69