Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

File Size: 212 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

RuleSet:: (13 methods):
  __construct()
  parseRuleSet()
  getLineNo()
  addRule()
  getRules()
  setRules()
  getRulesAssoc()
  removeRule()
  __toString()
  render()
  addComments()
  getComments()
  setComments()


Class: RuleSet  - X-Ref

RuleSet is a generic superclass denoting rules. The typical example for rule sets are declaration block.
However, unknown At-Rules (like @font-face) are also rule sets.

__construct($iLineNo = 0)   X-Ref
No description

parseRuleSet(ParserState $oParserState, RuleSet $oRuleSet)   X-Ref
No description

getLineNo()   X-Ref

return: int

addRule(Rule $oRule, Rule $oSibling = null)   X-Ref
No description

getRules($mRule = null)   X-Ref
Returns all rules matching the given rule name

param: (null|string|Rule) $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: Rule[] Rules.

setRules(array $aRules)   X-Ref
Override all the rules of this set.

param: Rule[] $aRules The rules to override with.

getRulesAssoc($mRule = null)   X-Ref
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.

param: (string) $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: Rule[] Rules.

removeRule($mRule)   X-Ref
Remove a rule from this RuleSet. This accepts all the possible values that @link{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 behvaiour, use removeRule($oRule->getRule()).

param: (null|string|Rule) $mRule pattern 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.

__toString()   X-Ref
No description

render(\Sabberworm\CSS\OutputFormat $oOutputFormat)   X-Ref
No description

addComments(array $aComments)   X-Ref

param: array $aComments Array of comments.

getComments()   X-Ref

return: array

setComments(array $aComments)   X-Ref

param: array $aComments Array containing Comment objects.