PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.4
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.4
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Libraries / Sabberworm / CSS / src / CSSList / Document.php

Document.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.4, at back/Libraries/Sabberworm/CSS/src/CSSList/Document.php

66 lines 2.0 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
5 namespace AcyMailing\Libraries\Sabberworm\CSS\CSSList;
6
7 use AcyMailing\Libraries\Sabberworm\CSS\OutputFormat;
8 use AcyMailing\Libraries\Sabberworm\CSS\Parsing\ParserState;
9 use AcyMailing\Libraries\Sabberworm\CSS\Parsing\SourceException;
10 use AcyMailing\Libraries\Sabberworm\CSS\Property\Selector;
11
12 /**
13 * This class represents the root of a parsed CSS file. It contains all top-level CSS contents: mostly declaration
14 * blocks, but also any at-rules encountered (`Import` and `Charset`).
15 */
16 class Document extends CSSBlockList
17 {
18 /**
19 * @throws SourceException
20 *
21 * @internal since V8.8.0
22 */
23 public static function parse(ParserState $parserState): Document
24 {
25 $document = new Document($parserState->currentLine());
26 CSSList::parseList($parserState, $document);
27
28 return $document;
29 }
30
31 /**
32 * Returns all `Selector` objects with the requested specificity found recursively in the tree.
33 *
34 * Note that this does not yield the full `DeclarationBlock` that the selector belongs to
35 * (and, currently, there is no way to get to that).
36 *
37 * @param string|null $specificitySearch
38 * An optional filter by specificity.
39 * May contain a comparison operator and a number or just a number (defaults to "==").
40 *
41 * @return list<Selector>
42 *
43 * @example `getSelectorsBySpecificity('>= 100')`
44 */
45 public function getSelectorsBySpecificity(?string $specificitySearch = null): array
46 {
47 return $this->getAllSelectors($specificitySearch);
48 }
49
50 /**
51 * Overrides `render()` to make format argument optional.
52 */
53 public function render(?OutputFormat $outputFormat = null): string
54 {
55 if ($outputFormat === null) {
56 $outputFormat = new OutputFormat();
57 }
58 return $outputFormat->getFormatter()->comments($this) . $this->renderListContents($outputFormat);
59 }
60
61 public function isRootList(): bool
62 {
63 return true;
64 }
65 }
66