← All changes
|
back/Libraries/Sabberworm/CSS/src/RuleSet/AtRuleSet.php
+0
-68
10.11.1
→
11.1.1
View file →
| @@ -1,68 +1,0 @@ | ||
| 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 | -} | |