| Server IP : 138.197.107.151 / Your IP : 216.73.217.120 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/shark/vendor/sabberworm/php-css-parser/src/ |
Upload File : |
<?php
declare(strict_types=1);
namespace Sabberworm\CSS;
use Sabberworm\CSS\CSSList\Document;
use Sabberworm\CSS\Parsing\ParserState;
use Sabberworm\CSS\Parsing\SourceException;
/**
* This class parses CSS from text into a data structure.
*/
class Parser
{
/**
* @var ParserState
*/
private $parserState;
/**
* @param string $text the complete CSS as text (i.e., usually the contents of a CSS file)
* @param int<1, max> $lineNumber the line number (starting from 1, not from 0)
*/
public function __construct(string $text, ?Settings $parserSettings = null, int $lineNumber = 1)
{
if ($parserSettings === null) {
$parserSettings = Settings::create();
}
$this->parserState = new ParserState($text, $parserSettings, $lineNumber);
}
/**
* Parses the CSS provided to the constructor and creates a `Document` from it.
*
* @throws SourceException
*/
public function parse(): Document
{
return Document::parse($this->parserState);
}
}