CSSFunction.php
2 years ago
CSSString.php
4 years ago
CalcFunction.php
2 years ago
CalcRuleValueList.php
4 years ago
Color.php
2 years ago
LineName.php
4 years ago
PrimitiveValue.php
4 years ago
RuleValueList.php
4 years ago
Size.php
2 years ago
URL.php
2 years ago
Value.php
2 years ago
ValueList.php
4 years ago
index.php
3 years ago
LineName.php
45 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Sabberworm\CSS\Value; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Sabberworm\CSS\OutputFormat; |
| 5 | use MailPoetVendor\Sabberworm\CSS\Parsing\ParserState; |
| 6 | use MailPoetVendor\Sabberworm\CSS\Parsing\UnexpectedEOFException; |
| 7 | use MailPoetVendor\Sabberworm\CSS\Parsing\UnexpectedTokenException; |
| 8 | class LineName extends ValueList |
| 9 | { |
| 10 | public function __construct(array $aComponents = [], $iLineNo = 0) |
| 11 | { |
| 12 | parent::__construct($aComponents, ' ', $iLineNo); |
| 13 | } |
| 14 | public static function parse(ParserState $oParserState) |
| 15 | { |
| 16 | $oParserState->consume('['); |
| 17 | $oParserState->consumeWhiteSpace(); |
| 18 | $aNames = []; |
| 19 | do { |
| 20 | if ($oParserState->getSettings()->bLenientParsing) { |
| 21 | try { |
| 22 | $aNames[] = $oParserState->parseIdentifier(); |
| 23 | } catch (UnexpectedTokenException $e) { |
| 24 | if (!$oParserState->comes(']')) { |
| 25 | throw $e; |
| 26 | } |
| 27 | } |
| 28 | } else { |
| 29 | $aNames[] = $oParserState->parseIdentifier(); |
| 30 | } |
| 31 | $oParserState->consumeWhiteSpace(); |
| 32 | } while (!$oParserState->comes(']')); |
| 33 | $oParserState->consume(']'); |
| 34 | return new LineName($aNames, $oParserState->currentLine()); |
| 35 | } |
| 36 | public function __toString() |
| 37 | { |
| 38 | return $this->render(new OutputFormat()); |
| 39 | } |
| 40 | public function render(OutputFormat $oOutputFormat) |
| 41 | { |
| 42 | return '[' . parent::render(OutputFormat::createCompact()) . ']'; |
| 43 | } |
| 44 | } |
| 45 |