MDL-65759 library: Update php-css-parser to 8.3.0
[moodle.git] / lib / php-css-parser / RuleSet / AtRuleSet.php
CommitLineData
fbe18cc0
FM
1<?php
2
3namespace Sabberworm\CSS\RuleSet;
4
5use Sabberworm\CSS\Property\AtRule;
6
7/**
8 * A RuleSet constructed by an unknown @-rule. @font-face rules are rendered into AtRuleSet objects.
9 */
10class AtRuleSet extends RuleSet implements AtRule {
11
12 private $sType;
13 private $sArgs;
14
15 public function __construct($sType, $sArgs = '', $iLineNo = 0) {
16 parent::__construct($iLineNo);
17 $this->sType = $sType;
18 $this->sArgs = $sArgs;
19 }
20
21 public function atRuleName() {
22 return $this->sType;
23 }
24
25 public function atRuleArgs() {
26 return $this->sArgs;
27 }
28
29 public function __toString() {
30 return $this->render(new \Sabberworm\CSS\OutputFormat());
31 }
32
33 public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
34 $sArgs = $this->sArgs;
35 if($sArgs) {
36 $sArgs = ' ' . $sArgs;
37 }
38 $sResult = "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{";
39 $sResult .= parent::render($oOutputFormat);
40 $sResult .= '}';
41 return $sResult;
42 }
43
44}