Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Sabberworm\CSS\RuleSet\RuleSet Class Reference
Inheritance diagram for Sabberworm\CSS\RuleSet\RuleSet:
Sabberworm\CSS\Renderable Sabberworm\CSS\Comment\Commentable Sabberworm\CSS\RuleSet\AtRuleSet Sabberworm\CSS\RuleSet\DeclarationBlock

Public Member Functions

 __toString ()
 
 addComments (array $aComments)
 
 addRule (Rule $oRule, Rule $oSibling=null)
 
 getComments ()
 
 getLineNo ()
 
 getRules ($mRule=null)
 
 getRulesAssoc ($mRule=null)
 Returns all rules matching the given pattern and returns them in an associative array with the rule’s name as keys.
 
 removeRule ($mRule)
 Removes a rule from this RuleSet.
 
 render (OutputFormat $oOutputFormat)
 
 setComments (array $aComments)
 
 setRules (array $aRules)
 Overrides all the rules of this set.
 

Static Public Member Functions

static parseRuleSet (ParserState $oParserState, RuleSet $oRuleSet)
 

Public Attributes

$this aComments = []
 

Member Function Documentation

◆ __toString()

Sabberworm\CSS\RuleSet\RuleSet::__toString ( )

◆ addComments()

Sabberworm\CSS\RuleSet\RuleSet::addComments ( array $aComments)
Parameters
array<string,Comment>$aComments
Return values
void

Implements Sabberworm\CSS\Comment\Commentable.

◆ addRule()

Sabberworm\CSS\RuleSet\RuleSet::addRule ( Rule $oRule,
Rule $oSibling = null )
Parameters
Rule | null$oSibling
Return values
void

◆ getComments()

Sabberworm\CSS\RuleSet\RuleSet::getComments ( )
Return values
array<string,Comment>

Implements Sabberworm\CSS\Comment\Commentable.

◆ getLineNo()

Sabberworm\CSS\RuleSet\RuleSet::getLineNo ( )
Return values
int

Implements Sabberworm\CSS\Renderable.

◆ getRulesAssoc()

Sabberworm\CSS\RuleSet\RuleSet::getRulesAssoc ( $mRule = null)

Returns all rules matching the given pattern and returns them in an associative array with the rule’s name as keys.

This method exists mainly for backwards-compatibility and is really only partially useful.

Note: This method loses some information: Calling this (with an argument of background-) on a declaration block like { background-color: green; background-color; rgba(0, 127, 0, 0.7); } will only yield an associative array containing the rgba-valued rule while getRules() would yield an indexed array containing both.

Parameters
Rule | string | null$mRule$mRule Pattern to search for. If null, returns all rules. If the pattern ends with a dash, all rules starting with the pattern are returned as well as one matching the pattern with the dash excluded. Passing a Rule behaves like calling getRules($mRule->getRule()).
Return values
array<string,Rule>

◆ parseRuleSet()

static Sabberworm\CSS\RuleSet\RuleSet::parseRuleSet ( ParserState $oParserState,
RuleSet $oRuleSet )
static
Return values
void
Exceptions
UnexpectedTokenException
UnexpectedEOFException

◆ removeRule()

Sabberworm\CSS\RuleSet\RuleSet::removeRule ( $mRule)

Removes a rule from this RuleSet.

This accepts all the possible values that getRules() accepts.

If given a Rule, it will only remove this particular rule (by identity). If given a name, it will remove all rules by that name.

Note: this is different from pre-v.2.0 behaviour of PHP-CSS-Parser, where passing a Rule instance would remove all rules with the same name. To get the old behaviour, use removeRule($oRule->getRule()).

Parameters
Rule | string | null$mRulepattern to remove. If $mRule is null, all rules are removed. If the pattern ends in a dash, all rules starting with the pattern are removed as well as one matching the pattern with the dash excluded. Passing a Rule behaves matches by identity.
Return values
void

◆ render()

Sabberworm\CSS\RuleSet\RuleSet::render ( OutputFormat $oOutputFormat)

◆ setComments()

Sabberworm\CSS\RuleSet\RuleSet::setComments ( array $aComments)
Parameters
array<string,Comment>$aComments
Return values
void

Implements Sabberworm\CSS\Comment\Commentable.

◆ setRules()

Sabberworm\CSS\RuleSet\RuleSet::setRules ( array $aRules)

Overrides all the rules of this set.

Parameters
array<array-key,Rule>$aRules The rules to override with.
Return values
void

The documentation for this class was generated from the following file: