PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.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 / CSSList / AtRuleBlockList.php

AtRuleBlockList.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.2, at back/Libraries/Sabberworm/CSS/src/CSSList/AtRuleBlockList.php

73 lines 1.7 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\CSSList;
6
7 use AcyMailing\Libraries\Sabberworm\CSS\OutputFormat;
8 use AcyMailing\Libraries\Sabberworm\CSS\Property\AtRule;
9
10 /**
11 * A `BlockList` constructed by an unknown at-rule. `@media` rules are rendered into `AtRuleBlockList` objects.
12 */
13 class AtRuleBlockList extends CSSBlockList implements AtRule
14 {
15 /**
16 * @var non-empty-string
17 */
18 private $type;
19
20 /**
21 * @var string
22 */
23 private $arguments;
24
25 /**
26 * @param non-empty-string $type
27 * @param int<1, max>|null $lineNumber
28 */
29 public function __construct(string $type, string $arguments = '', ?int $lineNumber = null)
30 {
31 parent::__construct($lineNumber);
32 $this->type = $type;
33 $this->arguments = $arguments;
34 }
35
36 /**
37 * @return non-empty-string
38 */
39 public function atRuleName(): string
40 {
41 return $this->type;
42 }
43
44 public function atRuleArgs(): string
45 {
46 return $this->arguments;
47 }
48
49 /**
50 * @return non-empty-string
51 */
52 public function render(OutputFormat $outputFormat): string
53 {
54 $formatter = $outputFormat->getFormatter();
55 $result = $formatter->comments($this);
56 $result .= $outputFormat->getContentBeforeAtRuleBlock();
57 $arguments = $this->arguments;
58 if ($arguments !== '') {
59 $arguments = ' ' . $arguments;
60 }
61 $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
62 $result .= $this->renderListContents($outputFormat);
63 $result .= '}';
64 $result .= $outputFormat->getContentAfterAtRuleBlock();
65 return $result;
66 }
67
68 public function isRootList(): bool
69 {
70 return false;
71 }
72 }
73