AtRuleSet.php
2 years ago
DeclarationBlock.php
2 years ago
RuleSet.php
8 months ago
index.php
3 years ago
AtRuleSet.php
41 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Sabberworm\CSS\RuleSet; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Sabberworm\CSS\OutputFormat; |
| 5 | use MailPoetVendor\Sabberworm\CSS\Property\AtRule; |
| 6 | class AtRuleSet extends RuleSet implements AtRule |
| 7 | { |
| 8 | private $sType; |
| 9 | private $sArgs; |
| 10 | public function __construct($sType, $sArgs = '', $iLineNo = 0) |
| 11 | { |
| 12 | parent::__construct($iLineNo); |
| 13 | $this->sType = $sType; |
| 14 | $this->sArgs = $sArgs; |
| 15 | } |
| 16 | public function atRuleName() |
| 17 | { |
| 18 | return $this->sType; |
| 19 | } |
| 20 | public function atRuleArgs() |
| 21 | { |
| 22 | return $this->sArgs; |
| 23 | } |
| 24 | public function __toString() |
| 25 | { |
| 26 | return $this->render(new OutputFormat()); |
| 27 | } |
| 28 | public function render(OutputFormat $oOutputFormat) |
| 29 | { |
| 30 | $sResult = $oOutputFormat->comments($this); |
| 31 | $sArgs = $this->sArgs; |
| 32 | if ($sArgs) { |
| 33 | $sArgs = ' ' . $sArgs; |
| 34 | } |
| 35 | $sResult .= "@{$this->sType}{$sArgs}{$oOutputFormat->spaceBeforeOpeningBrace()}{"; |
| 36 | $sResult .= $this->renderRules($oOutputFormat); |
| 37 | $sResult .= '}'; |
| 38 | return $sResult; |
| 39 | } |
| 40 | } |
| 41 |