AtRuleBlockList.php
2 years ago
CSSBlockList.php
4 years ago
CSSList.php
2 years ago
Document.php
8 months ago
KeyFrame.php
2 years ago
index.php
3 years ago
Document.php
82 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Sabberworm\CSS\CSSList; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Sabberworm\CSS\OutputFormat; |
| 5 | use MailPoetVendor\Sabberworm\CSS\Parsing\ParserState; |
| 6 | use MailPoetVendor\Sabberworm\CSS\Parsing\SourceException; |
| 7 | use MailPoetVendor\Sabberworm\CSS\Property\Selector; |
| 8 | use MailPoetVendor\Sabberworm\CSS\RuleSet\DeclarationBlock; |
| 9 | use MailPoetVendor\Sabberworm\CSS\RuleSet\RuleSet; |
| 10 | use MailPoetVendor\Sabberworm\CSS\Value\Value; |
| 11 | class Document extends CSSBlockList |
| 12 | { |
| 13 | public function __construct($iLineNo = 0) |
| 14 | { |
| 15 | parent::__construct($iLineNo); |
| 16 | } |
| 17 | public static function parse(ParserState $oParserState) |
| 18 | { |
| 19 | $oDocument = new Document($oParserState->currentLine()); |
| 20 | CSSList::parseList($oParserState, $oDocument); |
| 21 | return $oDocument; |
| 22 | } |
| 23 | public function getAllDeclarationBlocks() |
| 24 | { |
| 25 | $aResult = []; |
| 26 | $this->allDeclarationBlocks($aResult); |
| 27 | return $aResult; |
| 28 | } |
| 29 | public function getAllSelectors() |
| 30 | { |
| 31 | return $this->getAllDeclarationBlocks(); |
| 32 | } |
| 33 | public function getAllRuleSets() |
| 34 | { |
| 35 | $aResult = []; |
| 36 | $this->allRuleSets($aResult); |
| 37 | return $aResult; |
| 38 | } |
| 39 | public function getAllValues($mElement = null, $bSearchInFunctionArguments = \false) |
| 40 | { |
| 41 | $sSearchString = null; |
| 42 | if ($mElement === null) { |
| 43 | $mElement = $this; |
| 44 | } elseif (\is_string($mElement)) { |
| 45 | $sSearchString = $mElement; |
| 46 | $mElement = $this; |
| 47 | } |
| 48 | $aResult = []; |
| 49 | $this->allValues($mElement, $aResult, $sSearchString, $bSearchInFunctionArguments); |
| 50 | return $aResult; |
| 51 | } |
| 52 | public function getSelectorsBySpecificity($sSpecificitySearch = null) |
| 53 | { |
| 54 | $aResult = []; |
| 55 | $this->allSelectors($aResult, $sSpecificitySearch); |
| 56 | return $aResult; |
| 57 | } |
| 58 | public function expandShorthands() |
| 59 | { |
| 60 | foreach ($this->getAllDeclarationBlocks() as $oDeclaration) { |
| 61 | $oDeclaration->expandShorthands(); |
| 62 | } |
| 63 | } |
| 64 | public function createShorthands() |
| 65 | { |
| 66 | foreach ($this->getAllDeclarationBlocks() as $oDeclaration) { |
| 67 | $oDeclaration->createShorthands(); |
| 68 | } |
| 69 | } |
| 70 | public function render(?OutputFormat $oOutputFormat = null) |
| 71 | { |
| 72 | if ($oOutputFormat === null) { |
| 73 | $oOutputFormat = new OutputFormat(); |
| 74 | } |
| 75 | return $oOutputFormat->comments($this) . $this->renderListContents($oOutputFormat); |
| 76 | } |
| 77 | public function isRootList() |
| 78 | { |
| 79 | return \true; |
| 80 | } |
| 81 | } |
| 82 |