MDL-62781 question/privacy: fix tests with CodeRunner is installed
[moodle.git] / lib / php-css-parser / Property / CSSNamespace.php
blob7c0dee159818d5ed4de78505633a627d00a701d9
1 <?php
3 namespace Sabberworm\CSS\Property;
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;
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();
21 /**
22 * @return int
24 public function getLineNo() {
25 return $this->iLineNo;
28 public function __toString() {
29 return $this->render(new \Sabberworm\CSS\OutputFormat());
32 public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
33 return '@namespace '.($this->sPrefix === null ? '' : $this->sPrefix.' ').$this->mUrl->render($oOutputFormat).';';
36 public function getUrl() {
37 return $this->mUrl;
40 public function getPrefix() {
41 return $this->sPrefix;
44 public function setUrl($mUrl) {
45 $this->mUrl = $mUrl;
48 public function setPrefix($sPrefix) {
49 $this->sPrefix = $sPrefix;
52 public function atRuleName() {
53 return 'namespace';
56 public function atRuleArgs() {
57 $aResult = array($this->mUrl);
58 if($this->sPrefix) {
59 array_unshift($aResult, $this->sPrefix);
61 return $aResult;
64 public function addComments(array $aComments) {
65 $this->aComments = array_merge($this->aComments, $aComments);
68 public function getComments() {
69 return $this->aComments;
72 public function setComments(array $aComments) {
73 $this->aComments = $aComments;