MDL-62781 question/privacy: fix tests with CodeRunner is installed
[moodle.git] / lib / php-css-parser / Property / Charset.php
blob61c6ebc5b63e98460b6ac3999689636b5bcd3dcb
1 <?php
3 namespace Sabberworm\CSS\Property;
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.
12 class Charset implements AtRule {
14 private $sCharset;
15 protected $iLineNo;
16 protected $aComment;
18 public function __construct($sCharset, $iLineNo = 0) {
19 $this->sCharset = $sCharset;
20 $this->iLineNo = $iLineNo;
21 $this->aComments = array();
24 /**
25 * @return int
27 public function getLineNo() {
28 return $this->iLineNo;
31 public function setCharset($sCharset) {
32 $this->sCharset = $sCharset;
35 public function getCharset() {
36 return $this->sCharset;
39 public function __toString() {
40 return $this->render(new \Sabberworm\CSS\OutputFormat());
43 public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
44 return "@charset {$this->sCharset->render($oOutputFormat)};";
47 public function atRuleName() {
48 return 'charset';
51 public function atRuleArgs() {
52 return $this->sCharset;
55 public function addComments(array $aComments) {
56 $this->aComments = array_merge($this->aComments, $aComments);
59 public function getComments() {
60 return $this->aComments;
63 public function setComments(array $aComments) {
64 $this->aComments = $aComments;