PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.18
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.18
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / sabberworm / php-css-parser / src / Value / LineName.php

LineName.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.18, at vendor_prefixed/sabberworm/php-css-parser/src/Value/LineName.php

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sabberworm\CSS\Value;
5
6 use WCPOS\Vendor\Sabberworm\CSS\OutputFormat;
7 use WCPOS\Vendor\Sabberworm\CSS\Parsing\ParserState;
8 use WCPOS\Vendor\Sabberworm\CSS\Parsing\UnexpectedEOFException;
9 use WCPOS\Vendor\Sabberworm\CSS\Parsing\UnexpectedTokenException;
10 /**
11 * A name for a named CSS grid line.
12 *
13 * @see https://www.w3.org/TR/css-grid-1/#line-name
14 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Grid_layout/Named_grid_lines
15 */
16 class LineName extends ValueList
17 {
18 /**
19 * @param array<string> $components
20 * @param int<1, max>|null $lineNumber
21 */
22 public function __construct(array $components = [], ?int $lineNumber = null)
23 {
24 parent::__construct($components, ' ', $lineNumber);
25 }
26 /**
27 * @throws UnexpectedTokenException
28 * @throws UnexpectedEOFException
29 *
30 * @internal since V8.8.0
31 */
32 public static function parse(ParserState $parserState) : LineName
33 {
34 $parserState->consume('[');
35 $parserState->consumeWhiteSpace();
36 $names = [];
37 do {
38 if ($parserState->getSettings()->usesLenientParsing()) {
39 try {
40 $names[] = $parserState->parseIdentifier();
41 } catch (UnexpectedTokenException $e) {
42 if (!$parserState->comes(']')) {
43 throw $e;
44 }
45 }
46 } else {
47 $names[] = $parserState->parseIdentifier();
48 }
49 $parserState->consumeWhiteSpace();
50 } while (!$parserState->comes(']'));
51 $parserState->consume(']');
52 return new LineName($names, $parserState->currentLine());
53 }
54 /**
55 * @return non-empty-string
56 */
57 public function render(OutputFormat $outputFormat) : string
58 {
59 return '[' . parent::render(OutputFormat::createCompact()) . ']';
60 }
61 }
62