diff --git a/src/Parsing/ParserState.php b/src/Parsing/ParserState.php index 525150e2..bfed3285 100644 --- a/src/Parsing/ParserState.php +++ b/src/Parsing/ParserState.php @@ -44,7 +44,7 @@ class ParserState * * @var string */ - private $sCharset; + private $charset; /** * @var int @@ -71,11 +71,11 @@ public function __construct($text, Settings $parserSettings, $lineNumber = 1) /** * Sets the charset to be used if the CSS does not contain an `@charset` declaration. * - * @param string $sCharset + * @param string $charset */ - public function setCharset($sCharset): void + public function setCharset($charset): void { - $this->sCharset = $sCharset; + $this->charset = $charset; $this->characters = $this->strsplit($this->text); if (\is_array($this->characters)) { $this->iLength = \count($this->characters); @@ -195,7 +195,7 @@ public function parseCharacter($bIsForIdentifier) $sUtf32 .= \chr($iUnicode & 0xff); $iUnicode = $iUnicode >> 8; } - return \iconv('utf-32le', $this->sCharset, $sUtf32); + return \iconv('utf-32le', $this->charset, $sUtf32); } if ($bIsForIdentifier) { $peek = \ord($this->peek()); @@ -431,7 +431,7 @@ public function backtrack($iAmount): void public function strlen($sString): int { if ($this->parserSettings->bMultibyteSupport) { - return \mb_strlen($sString, $this->sCharset); + return \mb_strlen($sString, $this->charset); } else { return \strlen($sString); } @@ -464,7 +464,7 @@ private function substr($iStart, $iLength): string private function strtolower($sString): string { if ($this->parserSettings->bMultibyteSupport) { - return \mb_strtolower($sString, $this->sCharset); + return \mb_strtolower($sString, $this->charset); } else { return \strtolower($sString); } @@ -478,13 +478,13 @@ private function strtolower($sString): string private function strsplit($sString) { if ($this->parserSettings->bMultibyteSupport) { - if ($this->streql($this->sCharset, 'utf-8')) { + if ($this->streql($this->charset, 'utf-8')) { return \preg_split('//u', $sString, -1, PREG_SPLIT_NO_EMPTY); } else { - $iLength = \mb_strlen($sString, $this->sCharset); + $iLength = \mb_strlen($sString, $this->charset); $result = []; for ($i = 0; $i < $iLength; ++$i) { - $result[] = \mb_substr($sString, $i, 1, $this->sCharset); + $result[] = \mb_substr($sString, $i, 1, $this->charset); } return $result; } @@ -507,7 +507,7 @@ private function strsplit($sString) private function strpos($sString, $sNeedle, $iOffset) { if ($this->parserSettings->bMultibyteSupport) { - return \mb_strpos($sString, $sNeedle, $iOffset, $this->sCharset); + return \mb_strpos($sString, $sNeedle, $iOffset, $this->charset); } else { return \strpos($sString, $sNeedle, $iOffset); } diff --git a/src/Property/Charset.php b/src/Property/Charset.php index 9addf369..20522739 100644 --- a/src/Property/Charset.php +++ b/src/Property/Charset.php @@ -55,12 +55,12 @@ public function getLineNo(): int } /** - * @param string|CSSString $sCharset + * @param string|CSSString $charset */ - public function setCharset($sCharset): void + public function setCharset($charset): void { - $sCharset = $sCharset instanceof CSSString ? $sCharset : new CSSString($sCharset); - $this->oCharset = $sCharset; + $charset = $charset instanceof CSSString ? $charset : new CSSString($charset); + $this->oCharset = $charset; } /**