PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
yatra / vendor / sabberworm / php-css-parser / src / Parser.php

Parser.php in Yatra – Travel Booking & Tour Operator Software trunk, at vendor/sabberworm/php-css-parser/src/Parser.php

71 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 the complete CSS as text (i.e., usually the contents of a CSS file)
21 * @param Settings|null $oParserSettings
22 * @param int $iLineNo the line number (starting from 1, not from 0)
23 */
24 public function __construct($sText, $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 * Sets the charset to be used if the CSS does not contain an `@charset` declaration.
34 *
35 * @param string $sCharset
36 *
37 * @return void
38 *
39 * @deprecated since 8.7.0, will be removed in version 9.0.0 with #687
40 */
41 public function setCharset($sCharset)
42 {
43 $this->oParserState->setCharset($sCharset);
44 }
45
46 /**
47 * Returns the charset that is used if the CSS does not contain an `@charset` declaration.
48 *
49 * @return void
50 *
51 * @deprecated since 8.7.0, will be removed in version 9.0.0 with #687
52 */
53 public function getCharset()
54 {
55 // Note: The `return` statement is missing here. This is a bug that needs to be fixed.
56 $this->oParserState->getCharset();
57 }
58
59 /**
60 * Parses the CSS provided to the constructor and creates a `Document` from it.
61 *
62 * @return Document
63 *
64 * @throws SourceException
65 */
66 public function parse()
67 {
68 return Document::parse($this->oParserState);
69 }
70 }
71