← All changes
|
back/Libraries/Sabberworm/CSS/src/Value/LineName.php
+0
-59
11.0.2
→
11.1.1
View file →
| @@ -1,59 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -declare(strict_types=1); | |
| 4 | - | |
| 5 | -namespace AcyMailing\Libraries\Sabberworm\CSS\Value; | |
| 6 | - | |
| 7 | -use AcyMailing\Libraries\Sabberworm\CSS\OutputFormat; | |
| 8 | -use AcyMailing\Libraries\Sabberworm\CSS\Parsing\ParserState; | |
| 9 | -use AcyMailing\Libraries\Sabberworm\CSS\Parsing\UnexpectedEOFException; | |
| 10 | -use AcyMailing\Libraries\Sabberworm\CSS\Parsing\UnexpectedTokenException; | |
| 11 | - | |
| 12 | -class LineName extends ValueList | |
| 13 | -{ | |
| 14 | - /** | |
| 15 | - * @param array<Value|string> $components | |
| 16 | - * @param int<1, max>|null $lineNumber | |
| 17 | - */ | |
| 18 | - public function __construct(array $components = [], ?int $lineNumber = null) | |
| 19 | - { | |
| 20 | - parent::__construct($components, ' ', $lineNumber); | |
| 21 | - } | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * @throws UnexpectedTokenException | |
| 25 | - * @throws UnexpectedEOFException | |
| 26 | - * | |
| 27 | - * @internal since V8.8.0 | |
| 28 | - */ | |
| 29 | - public static function parse(ParserState $parserState): LineName | |
| 30 | - { | |
| 31 | - $parserState->consume('['); | |
| 32 | - $parserState->consumeWhiteSpace(); | |
| 33 | - $names = []; | |
| 34 | - do { | |
| 35 | - if ($parserState->getSettings()->usesLenientParsing()) { | |
| 36 | - try { | |
| 37 | - $names[] = $parserState->parseIdentifier(); | |
| 38 | - } catch (UnexpectedTokenException $e) { | |
| 39 | - if (!$parserState->comes(']')) { | |
| 40 | - throw $e; | |
| 41 | - } | |
| 42 | - } | |
| 43 | - } else { | |
| 44 | - $names[] = $parserState->parseIdentifier(); | |
| 45 | - } | |
| 46 | - $parserState->consumeWhiteSpace(); | |
| 47 | - } while (!$parserState->comes(']')); | |
| 48 | - $parserState->consume(']'); | |
| 49 | - return new LineName($names, $parserState->currentLine()); | |
| 50 | - } | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * @return non-empty-string | |
| 54 | - */ | |
| 55 | - public function render(OutputFormat $outputFormat): string | |
| 56 | - { | |
| 57 | - return '[' . parent::render(OutputFormat::createCompact()) . ']'; | |
| 58 | - } | |
| 59 | -} | |