Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class Parser
private $parserState;

/**
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
* @param string $text the complete CSS as text (i.e., usually the contents of a CSS file)
* @param int<0, max> $lineNumber the line number (starting from 1, not from 0)
*/
public function __construct($sText, ?Settings $parserSettings = null, $lineNumber = 1)
public function __construct($text, ?Settings $parserSettings = null, $lineNumber = 1)
{
if ($parserSettings === null) {
$parserSettings = Settings::create();
}
$this->parserState = new ParserState($sText, $parserSettings, $lineNumber);
$this->parserState = new ParserState($text, $parserSettings, $lineNumber);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class ParserState
/**
* @var string
*/
private $sText;
private $text;

/**
* @var array<int, string>
*/
private $aText;
private $characters;

/**
* @var int
Expand All @@ -57,13 +57,13 @@ class ParserState
private $lineNumber;

/**
* @param string $sText the complete CSS as text (i.e., usually the contents of a CSS file)
* @param string $text the complete CSS as text (i.e., usually the contents of a CSS file)
* @param int<0, max> $lineNumber
*/
public function __construct($sText, Settings $parserSettings, $lineNumber = 1)
public function __construct($text, Settings $parserSettings, $lineNumber = 1)
{
$this->parserSettings = $parserSettings;
$this->sText = $sText;
$this->text = $text;
$this->lineNumber = $lineNumber;
$this->setCharset($this->parserSettings->sDefaultCharset);
}
Expand All @@ -76,9 +76,9 @@ public function __construct($sText, Settings $parserSettings, $lineNumber = 1)
public function setCharset($sCharset): void
{
$this->sCharset = $sCharset;
$this->aText = $this->strsplit($this->sText);
if (\is_array($this->aText)) {
$this->iLength = \count($this->aText);
$this->characters = $this->strsplit($this->text);
if (\is_array($this->characters)) {
$this->iLength = \count($this->characters);
}
}

Expand Down Expand Up @@ -451,7 +451,7 @@ private function substr($iStart, $iLength): string
}
$result = '';
while ($iLength > 0) {
$result .= $this->aText[$iStart];
$result .= $this->characters[$iStart];
$iStart++;
$iLength--;
}
Expand Down