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
37 changes: 29 additions & 8 deletions src/Value/CSSFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, ['=', ' ', ',']);
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/Value/CalcFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions src/Value/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('#')) {
Expand Down