diff --git a/src/CSSList/AtRuleBlockList.php b/src/CSSList/AtRuleBlockList.php index 2fe8a98d..3266b828 100644 --- a/src/CSSList/AtRuleBlockList.php +++ b/src/CSSList/AtRuleBlockList.php @@ -57,17 +57,17 @@ public function __toString(): string public function render(OutputFormat $outputFormat): string { - $sResult = $outputFormat->comments($this); - $sResult .= $outputFormat->sBeforeAtRuleBlock; + $result = $outputFormat->comments($this); + $result .= $outputFormat->sBeforeAtRuleBlock; $arguments = $this->arguments; if ($arguments) { $arguments = ' ' . $arguments; } - $sResult .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{"; - $sResult .= $this->renderListContents($outputFormat); - $sResult .= '}'; - $sResult .= $outputFormat->sAfterAtRuleBlock; - return $sResult; + $result .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{"; + $result .= $this->renderListContents($outputFormat); + $result .= '}'; + $result .= $outputFormat->sAfterAtRuleBlock; + return $result; } public function isRootList(): bool diff --git a/src/CSSList/Document.php b/src/CSSList/Document.php index 45bb8f76..5f073072 100644 --- a/src/CSSList/Document.php +++ b/src/CSSList/Document.php @@ -46,10 +46,10 @@ public static function parse(ParserState $parserState): Document */ public function getAllDeclarationBlocks(): array { - /** @var array $aResult */ - $aResult = []; - $this->allDeclarationBlocks($aResult); - return $aResult; + /** @var array $result */ + $result = []; + $this->allDeclarationBlocks($result); + return $result; } /** @@ -59,10 +59,10 @@ public function getAllDeclarationBlocks(): array */ public function getAllRuleSets(): array { - /** @var array $aResult */ - $aResult = []; - $this->allRuleSets($aResult); - return $aResult; + /** @var array $result */ + $result = []; + $this->allRuleSets($result); + return $result; } /** @@ -86,10 +86,10 @@ public function getAllValues($element = null, $bSearchInFunctionArguments = fals $sSearchString = $element; $element = $this; } - /** @var array $aResult */ - $aResult = []; - $this->allValues($element, $aResult, $sSearchString, $bSearchInFunctionArguments); - return $aResult; + /** @var array $result */ + $result = []; + $this->allValues($element, $result, $sSearchString, $bSearchInFunctionArguments); + return $result; } /** @@ -107,10 +107,10 @@ public function getAllValues($element = null, $bSearchInFunctionArguments = fals */ public function getSelectorsBySpecificity($sSpecificitySearch = null): array { - /** @var array $aResult */ - $aResult = []; - $this->allSelectors($aResult, $sSpecificitySearch); - return $aResult; + /** @var array $result */ + $result = []; + $this->allSelectors($result, $sSpecificitySearch); + return $result; } /** diff --git a/src/CSSList/KeyFrame.php b/src/CSSList/KeyFrame.php index 04a7e760..4ab558c6 100644 --- a/src/CSSList/KeyFrame.php +++ b/src/CSSList/KeyFrame.php @@ -68,11 +68,11 @@ public function __toString(): string public function render(OutputFormat $outputFormat): string { - $sResult = $outputFormat->comments($this); - $sResult .= "@{$this->vendorKeyFrame} {$this->animationName}{$outputFormat->spaceBeforeOpeningBrace()}{"; - $sResult .= $this->renderListContents($outputFormat); - $sResult .= '}'; - return $sResult; + $result = $outputFormat->comments($this); + $result .= "@{$this->vendorKeyFrame} {$this->animationName}{$outputFormat->spaceBeforeOpeningBrace()}{"; + $result .= $this->renderListContents($outputFormat); + $result .= '}'; + return $result; } public function isRootList(): bool diff --git a/src/OutputFormatter.php b/src/OutputFormatter.php index 6740d822..48db2e0b 100644 --- a/src/OutputFormatter.php +++ b/src/OutputFormatter.php @@ -141,7 +141,7 @@ public function safely($cCode) */ public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = false): string { - $sResult = ''; + $result = ''; $oFormat = $this->oFormat; if ($bIncreaseLevel) { $oFormat = $oFormat->nextLevel(); @@ -151,15 +151,15 @@ public function implode(string $sSeparator, array $aValues, $bIncreaseLevel = fa if ($bIsFirst) { $bIsFirst = false; } else { - $sResult .= $sSeparator; + $result .= $sSeparator; } if ($mValue instanceof Renderable) { - $sResult .= $mValue->render($oFormat); + $result .= $mValue->render($oFormat); } else { - $sResult .= $mValue; + $result .= $mValue; } } - return $sResult; + return $result; } /** @@ -188,15 +188,15 @@ public function comments(Commentable $oCommentable): string return ''; } - $sResult = ''; + $result = ''; $comments = $oCommentable->getComments(); $iLastCommentIndex = \count($comments) - 1; foreach ($comments as $i => $oComment) { - $sResult .= $oComment->render($this->oFormat); - $sResult .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks(); + $result .= $oComment->render($this->oFormat); + $result .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks(); } - return $sResult; + return $result; } /** diff --git a/src/Parsing/ParserState.php b/src/Parsing/ParserState.php index f4263a99..4f98c0ed 100644 --- a/src/Parsing/ParserState.php +++ b/src/Parsing/ParserState.php @@ -144,22 +144,22 @@ public function parseIdentifier($bIgnoreCase = true) if ($this->isEnd()) { throw new UnexpectedEOFException('', '', 'identifier', $this->lineNumber); } - $sResult = $this->parseCharacter(true); - if ($sResult === null) { + $result = $this->parseCharacter(true); + if ($result === null) { throw new UnexpectedTokenException('', $this->peek(5), 'identifier', $this->lineNumber); } $sCharacter = null; while (!$this->isEnd() && ($sCharacter = $this->parseCharacter(true)) !== null) { if (\preg_match('/[a-zA-Z0-9\\x{00A0}-\\x{FFFF}_-]/Sux', $sCharacter)) { - $sResult .= $sCharacter; + $result .= $sCharacter; } else { - $sResult .= '\\' . $sCharacter; + $result .= '\\' . $sCharacter; } } if ($bIgnoreCase) { - $sResult = $this->strtolower($sResult); + $result = $this->strtolower($result); } - return $sResult; + return $result; } /** @@ -308,11 +308,11 @@ public function consume($mValue = 1): string if ($this->iCurrentPosition + $mValue > $this->iLength) { throw new UnexpectedEOFException((string) $mValue, $this->peek(5), 'count', $this->lineNumber); } - $sResult = $this->substr($this->iCurrentPosition, $mValue); - $iLineCount = \substr_count($sResult, "\n"); + $result = $this->substr($this->iCurrentPosition, $mValue); + $iLineCount = \substr_count($result, "\n"); $this->lineNumber += $iLineCount; $this->iCurrentPosition += $mValue; - return $sResult; + return $result; } } @@ -460,13 +460,13 @@ private function substr($iStart, $iLength): string if ($iStart + $iLength > $this->iLength) { $iLength = $this->iLength - $iStart; } - $sResult = ''; + $result = ''; while ($iLength > 0) { - $sResult .= $this->aText[$iStart]; + $result .= $this->aText[$iStart]; $iStart++; $iLength--; } - return $sResult; + return $result; } /** @@ -493,11 +493,11 @@ private function strsplit($sString) return \preg_split('//u', $sString, -1, PREG_SPLIT_NO_EMPTY); } else { $iLength = \mb_strlen($sString, $this->sCharset); - $aResult = []; + $result = []; for ($i = 0; $i < $iLength; ++$i) { - $aResult[] = \mb_substr($sString, $i, 1, $this->sCharset); + $result[] = \mb_substr($sString, $i, 1, $this->sCharset); } - return $aResult; + return $result; } } else { if ($sString === '') { diff --git a/src/Property/CSSNamespace.php b/src/Property/CSSNamespace.php index 2563e13a..a646bcdd 100644 --- a/src/Property/CSSNamespace.php +++ b/src/Property/CSSNamespace.php @@ -111,11 +111,11 @@ public function atRuleName(): string */ public function atRuleArgs(): array { - $aResult = [$this->mUrl]; + $result = [$this->mUrl]; if ($this->sPrefix) { - \array_unshift($aResult, $this->sPrefix); + \array_unshift($result, $this->sPrefix); } - return $aResult; + return $result; } /** diff --git a/src/Property/Import.php b/src/Property/Import.php index e852eed6..62dcb2b4 100644 --- a/src/Property/Import.php +++ b/src/Property/Import.php @@ -94,11 +94,11 @@ public function atRuleName(): string */ public function atRuleArgs(): array { - $aResult = [$this->location]; + $result = [$this->location]; if ($this->mediaQuery) { - \array_push($aResult, $this->mediaQuery); + \array_push($result, $this->mediaQuery); } - return $aResult; + return $result; } /** diff --git a/src/Rule/Rule.php b/src/Rule/Rule.php index 872e7162..014a5030 100644 --- a/src/Rule/Rule.php +++ b/src/Rule/Rule.php @@ -271,20 +271,20 @@ public function __toString(): string public function render(OutputFormat $outputFormat): string { - $sResult = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}"; + $result = "{$outputFormat->comments($this)}{$this->sRule}:{$outputFormat->spaceAfterRuleName()}"; if ($this->mValue instanceof Value) { // Can also be a ValueList - $sResult .= $this->mValue->render($outputFormat); + $result .= $this->mValue->render($outputFormat); } else { - $sResult .= $this->mValue; + $result .= $this->mValue; } if (!empty($this->aIeHack)) { - $sResult .= ' \\' . \implode('\\', $this->aIeHack); + $result .= ' \\' . \implode('\\', $this->aIeHack); } if ($this->bIsImportant) { - $sResult .= ' !important'; + $result .= ' !important'; } - $sResult .= ';'; - return $sResult; + $result .= ';'; + return $result; } /** diff --git a/src/RuleSet/AtRuleSet.php b/src/RuleSet/AtRuleSet.php index 0891d6bd..601198d6 100644 --- a/src/RuleSet/AtRuleSet.php +++ b/src/RuleSet/AtRuleSet.php @@ -60,14 +60,14 @@ public function __toString(): string public function render(OutputFormat $outputFormat): string { - $sResult = $outputFormat->comments($this); + $result = $outputFormat->comments($this); $arguments = $this->arguments; if ($arguments) { $arguments = ' ' . $arguments; } - $sResult .= "@{$this->sType}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{"; - $sResult .= $this->renderRules($outputFormat); - $sResult .= '}'; - return $sResult; + $result .= "@{$this->sType}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{"; + $result .= $this->renderRules($outputFormat); + $result .= '}'; + return $result; } } diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 79e0dd0c..11e1982d 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -163,21 +163,21 @@ public function __toString(): string */ public function render(OutputFormat $outputFormat): string { - $sResult = $outputFormat->comments($this); + $result = $outputFormat->comments($this); if (\count($this->aSelectors) === 0) { // If all the selectors have been removed, this declaration block becomes invalid throw new OutputException('Attempt to print declaration block with missing selector', $this->lineNumber); } - $sResult .= $outputFormat->sBeforeDeclarationBlock; - $sResult .= $outputFormat->implode( + $result .= $outputFormat->sBeforeDeclarationBlock; + $result .= $outputFormat->implode( $outputFormat->spaceBeforeSelectorSeparator() . ',' . $outputFormat->spaceAfterSelectorSeparator(), $this->aSelectors ); - $sResult .= $outputFormat->sAfterDeclarationBlockSelectors; - $sResult .= $outputFormat->spaceBeforeOpeningBrace() . '{'; - $sResult .= $this->renderRules($outputFormat); - $sResult .= '}'; - $sResult .= $outputFormat->sAfterDeclarationBlock; - return $sResult; + $result .= $outputFormat->sAfterDeclarationBlockSelectors; + $result .= $outputFormat->spaceBeforeOpeningBrace() . '{'; + $result .= $this->renderRules($outputFormat); + $result .= '}'; + $result .= $outputFormat->sAfterDeclarationBlock; + return $result; } } diff --git a/src/RuleSet/RuleSet.php b/src/RuleSet/RuleSet.php index 528f57cf..231f3365 100644 --- a/src/RuleSet/RuleSet.php +++ b/src/RuleSet/RuleSet.php @@ -153,8 +153,8 @@ public function getRules($mRule = null) if ($mRule instanceof Rule) { $mRule = $mRule->getRule(); } - /** @var array $aResult */ - $aResult = []; + /** @var array $result */ + $result = []; foreach ($this->aRules as $sName => $aRules) { // Either no search rule is given or the search rule matches the found rule exactly // or the search rule ends in “-” and the found rule starts with the search rule. @@ -165,16 +165,16 @@ public function getRules($mRule = null) && (\strpos($sName, $mRule) === 0 || $sName === \substr($mRule, 0, -1)) ) ) { - $aResult = \array_merge($aResult, $aRules); + $result = \array_merge($result, $aRules); } } - \usort($aResult, static function (Rule $first, Rule $second): int { + \usort($result, static function (Rule $first, Rule $second): int { if ($first->getLineNo() === $second->getLineNo()) { return $first->getColNo() - $second->getColNo(); } return $first->getLineNo() - $second->getLineNo(); }); - return $aResult; + return $result; } /** @@ -207,12 +207,12 @@ public function setRules(array $aRules): void */ public function getRulesAssoc($mRule = null) { - /** @var array $aResult */ - $aResult = []; + /** @var array $result */ + $result = []; foreach ($this->getRules($mRule) as $rule) { - $aResult[$rule->getRule()] = $rule; + $result[$rule->getRule()] = $rule; } - return $aResult; + return $result; } /** @@ -267,7 +267,7 @@ public function __toString(): string */ protected function renderRules(OutputFormat $outputFormat) { - $sResult = ''; + $result = ''; $bIsFirst = true; $oNextLevel = $outputFormat->nextLevel(); foreach ($this->aRules as $aRules) { @@ -280,20 +280,20 @@ protected function renderRules(OutputFormat $outputFormat) } if ($bIsFirst) { $bIsFirst = false; - $sResult .= $oNextLevel->spaceBeforeRules(); + $result .= $oNextLevel->spaceBeforeRules(); } else { - $sResult .= $oNextLevel->spaceBetweenRules(); + $result .= $oNextLevel->spaceBetweenRules(); } - $sResult .= $sRendered; + $result .= $sRendered; } } if (!$bIsFirst) { // Had some output - $sResult .= $outputFormat->spaceAfterRules(); + $result .= $outputFormat->spaceAfterRules(); } - return $outputFormat->removeLastSemicolon($sResult); + return $outputFormat->removeLastSemicolon($result); } /** diff --git a/src/Value/CSSString.php b/src/Value/CSSString.php index 6cc609ea..496b9468 100644 --- a/src/Value/CSSString.php +++ b/src/Value/CSSString.php @@ -51,12 +51,12 @@ public static function parse(ParserState $parserState): CSSString if ($sQuote !== null) { $parserState->consume($sQuote); } - $sResult = ''; + $result = ''; $sContent = null; if ($sQuote === null) { // Unquoted strings end in whitespace or with braces, brackets, parentheses while (\preg_match('/[\\s{}()<>\\[\\]]/isu', $parserState->peek()) !== 1) { - $sResult .= $parserState->parseCharacter(false); + $result .= $parserState->parseCharacter(false); } } else { while (!$parserState->comes($sQuote)) { @@ -67,11 +67,11 @@ public static function parse(ParserState $parserState): CSSString $parserState->currentLine() ); } - $sResult .= $sContent; + $result .= $sContent; } $parserState->consume($sQuote); } - return new CSSString($sResult, $parserState->currentLine()); + return new CSSString($result, $parserState->currentLine()); } /** diff --git a/src/Value/Value.php b/src/Value/Value.php index 4410551a..b6973438 100644 --- a/src/Value/Value.php +++ b/src/Value/Value.php @@ -122,24 +122,24 @@ public static function parseValue(ParserState $parserState, array $aListDelimite public static function parseIdentifierOrFunction(ParserState $parserState, $bIgnoreCase = false) { $oAnchor = $parserState->anchor(); - $mResult = $parserState->parseIdentifier($bIgnoreCase); + $result = $parserState->parseIdentifier($bIgnoreCase); if ($parserState->comes('(')) { $oAnchor->backtrack(); - if ($parserState->streql('url', $mResult)) { - $mResult = URL::parse($parserState); + if ($parserState->streql('url', $result)) { + $result = URL::parse($parserState); } elseif ( - $parserState->streql('calc', $mResult) - || $parserState->streql('-webkit-calc', $mResult) - || $parserState->streql('-moz-calc', $mResult) + $parserState->streql('calc', $result) + || $parserState->streql('-webkit-calc', $result) + || $parserState->streql('-moz-calc', $result) ) { - $mResult = CalcFunction::parse($parserState); + $result = CalcFunction::parse($parserState); } else { - $mResult = CSSFunction::parse($parserState, $bIgnoreCase); + $result = CSSFunction::parse($parserState, $bIgnoreCase); } } - return $mResult; + return $result; } /**