Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

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