[ Index ]

PHP Cross Reference of Moodle 310

title

Body

[close]

/lib/php-css-parser/Value/ -> URL.php (source)

   1  <?php
   2  
   3  namespace Sabberworm\CSS\Value;
   4  
   5  use Sabberworm\CSS\Parsing\ParserState;
   6  
   7  class URL extends PrimitiveValue {
   8  
   9      private $oURL;
  10  
  11  	public function __construct(CSSString $oURL, $iLineNo = 0) {
  12          parent::__construct($iLineNo);
  13          $this->oURL = $oURL;
  14      }
  15  
  16  	public static function parse(ParserState $oParserState) {
  17          $bUseUrl = $oParserState->comes('url', true);
  18          if ($bUseUrl) {
  19              $oParserState->consume('url');
  20              $oParserState->consumeWhiteSpace();
  21              $oParserState->consume('(');
  22          }
  23          $oParserState->consumeWhiteSpace();
  24          $oResult = new URL(CSSString::parse($oParserState), $oParserState->currentLine());
  25          if ($bUseUrl) {
  26              $oParserState->consumeWhiteSpace();
  27              $oParserState->consume(')');
  28          }
  29          return $oResult;
  30      }
  31  
  32  
  33  	public function setURL(CSSString $oURL) {
  34          $this->oURL = $oURL;
  35      }
  36  
  37  	public function getURL() {
  38          return $this->oURL;
  39      }
  40  
  41  	public function __toString() {
  42          return $this->render(new \Sabberworm\CSS\OutputFormat());
  43      }
  44  
  45  	public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
  46          return "url({$this->oURL->render($oOutputFormat)})";
  47      }
  48  
  49  }


Generated: Wed Jan 22 11:59:49 2025 Cross-referenced by PHPXref 0.7.1