Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  
   3  namespace Sabberworm\CSS\CSSList;
   4  
   5  use Sabberworm\CSS\Property\AtRule;
   6  
   7  /**
   8   * A BlockList constructed by an unknown @-rule. @media rules are rendered into AtRuleBlockList objects.
   9   */
  10  class AtRuleBlockList extends CSSBlockList 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  = $oOutputFormat->sBeforeAtRuleBlock;
  39  	 	 $sResult .= "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{";
  40  	 	 $sResult .= parent::render($oOutputFormat);
  41  	 	 $sResult .= '}';
  42  	 	 $sResult .= $oOutputFormat->sAfterAtRuleBlock;
  43  	 	 return $sResult;
  44  	 }
  45  
  46  	public function isRootList() {
  47  	 	 return false;
  48  	 }
  49  
  50  }