Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

   1  <?php
   2  
   3  namespace Sabberworm\CSS\Property;
   4  
   5  /**
   6  * CSSNamespace represents an @namespace rule.
   7  */
   8  class CSSNamespace implements AtRule {
   9  	 private $mUrl;
  10  	 private $sPrefix;
  11  	 private $iLineNo;
  12  	 protected $aComments;
  13  	 
  14  	public function __construct($mUrl, $sPrefix = null, $iLineNo = 0) {
  15  	 	 $this->mUrl = $mUrl;
  16  	 	 $this->sPrefix = $sPrefix;
  17  	 	 $this->iLineNo = $iLineNo;
  18  	 	 $this->aComments = array();
  19  	 }
  20  
  21  	 /**
  22  	  * @return int
  23  	  */
  24  	public function getLineNo() {
  25  	 	 return $this->iLineNo;
  26  	 }
  27  
  28  	public function __toString() {
  29  	 	 return $this->render(new \Sabberworm\CSS\OutputFormat());
  30  	 }
  31  
  32  	public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
  33  	 	 return '@namespace '.($this->sPrefix === null ? '' : $this->sPrefix.' ').$this->mUrl->render($oOutputFormat).';';
  34  	 }
  35  	 
  36  	public function getUrl() {
  37  	 	 return $this->mUrl;
  38  	 }
  39  
  40  	public function getPrefix() {
  41  	 	 return $this->sPrefix;
  42  	 }
  43  
  44  	public function setUrl($mUrl) {
  45  	 	 $this->mUrl = $mUrl;
  46  	 }
  47  
  48  	public function setPrefix($sPrefix) {
  49  	 	 $this->sPrefix = $sPrefix;
  50  	 }
  51  
  52  	public function atRuleName() {
  53  	 	 return 'namespace';
  54  	 }
  55  
  56  	public function atRuleArgs() {
  57  	 	 $aResult = array($this->mUrl);
  58  	 	 if($this->sPrefix) {
  59  	 	 	 array_unshift($aResult, $this->sPrefix);
  60  	 	 }
  61  	 	 return $aResult;
  62  	 }
  63  
  64  	public function addComments(array $aComments) {
  65  	 	 $this->aComments = array_merge($this->aComments, $aComments);
  66  	 }
  67  
  68  	public function getComments() {
  69  	 	 return $this->aComments;
  70  	 }
  71  
  72  	public function setComments(array $aComments) {
  73  	 	 $this->aComments = $aComments;
  74  	 }
  75  }