diff --git a/src/Value/CSSFunction.php b/src/Value/CSSFunction.php index e69ae86b..6cc6b6ae 100644 --- a/src/Value/CSSFunction.php +++ b/src/Value/CSSFunction.php @@ -34,21 +34,42 @@ public function __construct($sName, $aArguments, $sSeparator = ',', $iLineNo = 0 } /** - * @param ParserState $oParserState - * @param bool $bIgnoreCase - * * @throws SourceException * @throws UnexpectedEOFException * @throws UnexpectedTokenException */ - public static function parse(ParserState $oParserState, $bIgnoreCase = false): CSSFunction + public static function parse(ParserState $oParserState, bool $bIgnoreCase = false): CSSFunction { - $mResult = $oParserState->parseIdentifier($bIgnoreCase); + $sName = self::parseName($oParserState, $bIgnoreCase); $oParserState->consume('('); - $aArguments = Value::parseValue($oParserState, ['=', ' ', ',']); - $mResult = new CSSFunction($mResult, $aArguments, ',', $oParserState->currentLine()); + $mArguments = self::parseArguments($oParserState); + + $oResult = new CSSFunction($sName, $mArguments, ',', $oParserState->currentLine()); $oParserState->consume(')'); - return $mResult; + + return $oResult; + } + + /** + * @throws SourceException + * @throws UnexpectedEOFException + * @throws UnexpectedTokenException + */ + private static function parseName(ParserState $oParserState, bool $bIgnoreCase = false): string + { + return $oParserState->parseIdentifier($bIgnoreCase); + } + + /** + * @return Value|string + * + * @throws SourceException + * @throws UnexpectedEOFException + * @throws UnexpectedTokenException + */ + private static function parseArguments(ParserState $oParserState) + { + return Value::parseValue($oParserState, ['=', ' ', ',']); } /** diff --git a/src/Value/CalcFunction.php b/src/Value/CalcFunction.php index 37a49c34..85f4085a 100644 --- a/src/Value/CalcFunction.php +++ b/src/Value/CalcFunction.php @@ -19,13 +19,10 @@ class CalcFunction extends CSSFunction private const T_OPERATOR = 2; /** - * @param ParserState $oParserState - * @param bool $bIgnoreCase - * * @throws UnexpectedTokenException * @throws UnexpectedEOFException */ - public static function parse(ParserState $oParserState, $bIgnoreCase = false): CSSFunction + public static function parse(ParserState $oParserState, bool $bIgnoreCase = false): CSSFunction { $aOperators = ['+', '-', '*', '/']; $sFunction = $oParserState->parseIdentifier(); diff --git a/src/Value/Color.php b/src/Value/Color.php index f6574ffb..09ae46e3 100644 --- a/src/Value/Color.php +++ b/src/Value/Color.php @@ -23,13 +23,10 @@ public function __construct(array $aColor, $iLineNo = 0) } /** - * @param ParserState $oParserState - * @param bool $bIgnoreCase - * * @throws UnexpectedEOFException * @throws UnexpectedTokenException */ - public static function parse(ParserState $oParserState, $bIgnoreCase = false): CSSFunction + public static function parse(ParserState $oParserState, bool $bIgnoreCase = false): CSSFunction { $aColor = []; if ($oParserState->comes('#')) {