Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]
1 <?php 2 3 namespace Sabberworm\CSS\Value; 4 5 use Sabberworm\CSS\OutputFormat; 6 use Sabberworm\CSS\Parsing\ParserState; 7 use Sabberworm\CSS\Parsing\UnexpectedEOFException; 8 use Sabberworm\CSS\Parsing\UnexpectedTokenException; 9 10 class LineName extends ValueList 11 { 12 /** 13 * @param array<int, RuleValueList|CSSFunction|CSSString|LineName|Size|URL|string> $aComponents 14 * @param int $iLineNo 15 */ 16 public function __construct(array $aComponents = [], $iLineNo = 0) 17 { 18 parent::__construct($aComponents, ' ', $iLineNo); 19 } 20 21 /** 22 * @return LineName 23 * 24 * @throws UnexpectedTokenException 25 * @throws UnexpectedEOFException 26 */ 27 public static function parse(ParserState $oParserState) 28 { 29 $oParserState->consume('['); 30 $oParserState->consumeWhiteSpace(); 31 $aNames = []; 32 do { 33 if ($oParserState->getSettings()->bLenientParsing) { 34 try { 35 $aNames[] = $oParserState->parseIdentifier(); 36 } catch (UnexpectedTokenException $e) { 37 if (!$oParserState->comes(']')) { 38 throw $e; 39 } 40 } 41 } else { 42 $aNames[] = $oParserState->parseIdentifier(); 43 } 44 $oParserState->consumeWhiteSpace(); 45 } while (!$oParserState->comes(']')); 46 $oParserState->consume(']'); 47 return new LineName($aNames, $oParserState->currentLine()); 48 } 49 50 /** 51 * @return string 52 */ 53 public function __toString() 54 { 55 return $this->render(new OutputFormat()); 56 } 57 58 /** 59 * @return string 60 */ 61 public function render(OutputFormat $oOutputFormat) 62 { 63 return '[' . parent::render(OutputFormat::createCompact()) . ']'; 64 } 65 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body