/usr/share/php/Horde/Css/Parser/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/Document.php is in php-horde-css-parser 1.0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | <?php
namespace Sabberworm\CSS\CSSList;
/**
* The root CSSList of a parsed file. Contains all top-level css contents, mostly declaration blocks, but also any @-rules encountered.
*/
class Document extends CSSBlockList {
/**
* Gets all DeclarationBlock objects recursively.
*/
public function getAllDeclarationBlocks() {
$aResult = array();
$this->allDeclarationBlocks($aResult);
return $aResult;
}
/**
* @deprecated use getAllDeclarationBlocks()
*/
public function getAllSelectors() {
return $this->getAllDeclarationBlocks();
}
/**
* Returns all RuleSet objects found recursively in the tree.
*/
public function getAllRuleSets() {
$aResult = array();
$this->allRuleSets($aResult);
return $aResult;
}
/**
* Returns all Value objects found recursively in the tree.
* @param (object|string) $mElement the CSSList or RuleSet to start the search from (defaults to the whole document). If a string is given, it is used as rule name filter (@see{RuleSet->getRules()}).
* @param (bool) $bSearchInFunctionArguments whether to also return Value objects used as Function arguments.
*/
public function getAllValues($mElement = null, $bSearchInFunctionArguments = false) {
$sSearchString = null;
if ($mElement === null) {
$mElement = $this;
} else if (is_string($mElement)) {
$sSearchString = $mElement;
$mElement = $this;
}
$aResult = array();
$this->allValues($mElement, $aResult, $sSearchString, $bSearchInFunctionArguments);
return $aResult;
}
/**
* Returns all Selector objects found recursively in the tree.
* Note that this does not yield the full DeclarationBlock that the selector belongs to (and, currently, there is no way to get to that).
* @param $sSpecificitySearch An optional filter by specificity. May contain a comparison operator and a number or just a number (defaults to "==").
* @example getSelectorsBySpecificity('>= 100')
*/
public function getSelectorsBySpecificity($sSpecificitySearch = null) {
if (is_numeric($sSpecificitySearch) || is_numeric($sSpecificitySearch[0])) {
$sSpecificitySearch = "== $sSpecificitySearch";
}
$aResult = array();
$this->allSelectors($aResult, $sSpecificitySearch);
return $aResult;
}
/**
* Expands all shorthand properties to their long value
*/
public function expandShorthands() {
foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
$oDeclaration->expandShorthands();
}
}
/**
* Create shorthands properties whenever possible
*/
public function createShorthands() {
foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
$oDeclaration->createShorthands();
}
}
// Override render() to make format argument optional
public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat = null) {
if($oOutputFormat === null) {
$oOutputFormat = new \Sabberworm\CSS\OutputFormat();
}
return parent::render($oOutputFormat);
}
public function isRootList() {
return true;
}
}
|