See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
1 <?php 2 3 namespace Sabberworm\CSS; 4 5 use Sabberworm\CSS\CSSList\Document; 6 use Sabberworm\CSS\Parsing\ParserState; 7 use Sabberworm\CSS\Parsing\SourceException; 8 9 /** 10 * This class parses CSS from text into a data structure. 11 */ 12 class Parser 13 { 14 /** 15 * @var ParserState 16 */ 17 private $oParserState; 18 19 /** 20 * @param string $sText 21 * @param Settings|null $oParserSettings 22 * @param int $iLineNo the line number (starting from 1, not from 0) 23 */ 24 public function __construct($sText, Settings $oParserSettings = null, $iLineNo = 1) 25 { 26 if ($oParserSettings === null) { 27 $oParserSettings = Settings::create(); 28 } 29 $this->oParserState = new ParserState($sText, $oParserSettings, $iLineNo); 30 } 31 32 /** 33 * @param string $sCharset 34 * 35 * @return void 36 */ 37 public function setCharset($sCharset) 38 { 39 $this->oParserState->setCharset($sCharset); 40 } 41 42 /** 43 * @return void 44 */ 45 public function getCharset() 46 { 47 // Note: The `return` statement is missing here. This is a bug that needs to be fixed. 48 $this->oParserState->getCharset(); 49 } 50 51 /** 52 * @return Document 53 * 54 * @throws SourceException 55 */ 56 public function parse() 57 { 58 return Document::parse($this->oParserState); 59 } 60 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body