Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
<?php

namespace Sabberworm\CSS\Property;

> use Sabberworm\CSS\Comment\Comment; use Sabberworm\CSS\Value\URL; > use Sabberworm\CSS\OutputFormat;
/**
< * Class representing an @import rule.
> * Class representing an `@import` rule. > */ > class Import implements AtRule > { > /** > * @var URL
*/
< class Import implements AtRule {
private $oLocation;
> private $sMediaQuery; > /** protected $iLineNo; > * @var string protected $aComments; > */
> public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0) { > /** $this->oLocation = $oLocation; > * @var int $this->sMediaQuery = $sMediaQuery; > */
$this->iLineNo = $iLineNo;
> $this->aComments = array(); > /** } > * @var array<array-key, Comment> > */
< public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0) {
> /** > * @param URL $oLocation > * @param string $sMediaQuery > * @param int $iLineNo > */ > public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0) > {
< $this->aComments = array();
> $this->aComments = [];
*/
< public function getLineNo() {
> public function getLineNo() > {
return $this->iLineNo; }
< public function setLocation($oLocation) {
> /** > * @param URL $oLocation > * > * @return void > */ > public function setLocation($oLocation) > {
$this->oLocation = $oLocation; }
< public function getLocation() {
> /** > * @return URL > */ > public function getLocation() > {
return $this->oLocation; }
< public function __toString() { < return $this->render(new \Sabberworm\CSS\OutputFormat());
> /** > * @return string > */ > public function __toString() > { > return $this->render(new OutputFormat());
}
< public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { < return "@import ".$this->oLocation->render($oOutputFormat).($this->sMediaQuery === null ? '' : ' '.$this->sMediaQuery).';';
> /** > * @return string > */ > public function render(OutputFormat $oOutputFormat) > { > return "@import " . $this->oLocation->render($oOutputFormat) > . ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';';
}
< public function atRuleName() {
> /** > * @return string > */ > public function atRuleName() > {
return 'import'; }
< public function atRuleArgs() { < $aResult = array($this->oLocation);
> /** > * @return array<int, URL|string> > */ > public function atRuleArgs() > { > $aResult = [$this->oLocation];
if($this->sMediaQuery) { array_push($aResult, $this->sMediaQuery); } return $aResult; }
< public function addComments(array $aComments) {
> /** > * @param array<array-key, Comment> $aComments > * > * @return void > */ > public function addComments(array $aComments) > {
$this->aComments = array_merge($this->aComments, $aComments); }
< public function getComments() {
> /** > * @return array<array-key, Comment> > */ > public function getComments() > {
return $this->aComments; }
< public function setComments(array $aComments) {
> /** > * @param array<array-key, Comment> $aComments > * > * @return void > */ > public function setComments(array $aComments) > {
$this->aComments = $aComments; } }