PluginProbe
Independent Analytics – WordPress Analytics Plugin / 1.19.1
Independent Analytics – WordPress Analytics Plugin v1.19.1
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / vendor / sabberworm / php-css-parser / src / Parser.php
Parser.php
56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IAWP\Sabberworm\CSS;
4
5 use IAWP\Sabberworm\CSS\CSSList\Document;
6 use IAWP\Sabberworm\CSS\Parsing\ParserState;
7 use IAWP\Sabberworm\CSS\Parsing\SourceException;
8 /**
9 * This class parses CSS from text into a data structure.
10 */
11 class Parser
12 {
13 /**
14 * @var ParserState
15 */
16 private $oParserState;
17 /**
18 * @param string $sText
19 * @param Settings|null $oParserSettings
20 * @param int $iLineNo the line number (starting from 1, not from 0)
21 */
22 public function __construct($sText, Settings $oParserSettings = null, $iLineNo = 1)
23 {
24 if ($oParserSettings === null) {
25 $oParserSettings = Settings::create();
26 }
27 $this->oParserState = new ParserState($sText, $oParserSettings, $iLineNo);
28 }
29 /**
30 * @param string $sCharset
31 *
32 * @return void
33 */
34 public function setCharset($sCharset)
35 {
36 $this->oParserState->setCharset($sCharset);
37 }
38 /**
39 * @return void
40 */
41 public function getCharset()
42 {
43 // Note: The `return` statement is missing here. This is a bug that needs to be fixed.
44 $this->oParserState->getCharset();
45 }
46 /**
47 * @return Document
48 *
49 * @throws SourceException
50 */
51 public function parse()
52 {
53 return Document::parse($this->oParserState);
54 }
55 }
56