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\Property;
   4  
   5  /**
   6   * Class representing an @charset rule.
   7   * The following restrictions apply:
   8   * • May not be found in any CSSList other than the Document.
   9   * • May only appear at the very top of a Document’s contents.
  10   * • Must not appear more than once.
  11   */
  12  class Charset implements AtRule {
  13  
  14  	 private $sCharset;
  15  	 protected $iLineNo;
  16  	 protected $aComment;
  17  
  18  	public function __construct($sCharset, $iLineNo = 0) {
  19  	 	 $this->sCharset = $sCharset;
  20  	 	 $this->iLineNo = $iLineNo;
  21  	 	 $this->aComments = array();
  22  	 }
  23  
  24  	 /**
  25  	  * @return int
  26  	  */
  27  	public function getLineNo() {
  28  	 	 return $this->iLineNo;
  29  	 }
  30  
  31  	public function setCharset($sCharset) {
  32  	 	 $this->sCharset = $sCharset;
  33  	 }
  34  
  35  	public function getCharset() {
  36  	 	 return $this->sCharset;
  37  	 }
  38  
  39  	public function __toString() {
  40  	 	 return $this->render(new \Sabberworm\CSS\OutputFormat());
  41  	 }
  42  
  43  	public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
  44  	 	 return "@charset {$this->sCharset->render($oOutputFormat)};";
  45  	 }
  46  
  47  	public function atRuleName() {
  48  	 	 return 'charset';
  49  	 }
  50  
  51  	public function atRuleArgs() {
  52  	 	 return $this->sCharset;
  53  	 }
  54  
  55  	public function addComments(array $aComments) {
  56  	 	 $this->aComments = array_merge($this->aComments, $aComments);
  57  	 }
  58  
  59  	public function getComments() {
  60  	 	 return $this->aComments;
  61  	 }
  62  
  63  	public function setComments(array $aComments) {
  64  	 	 $this->aComments = $aComments;
  65  	 }
  66  }