abstract class RulesHelper

Methods

static array
getBitfields(TagCollection $tags, Ruleset $rootRules)

Generate the allowedChildren and allowedDescendants bitfields for every tag and for the root context

static array
initMatrix(array $rules)

Initialize a matrix of settings

static void
applyTargetedRule(array $matrix, array $rules, string $ruleName, string $key, int $value)

Apply given rule from each applicable tag

static array
unrollRules(array $rules)

No description

static void
pruneMatrix(array $matrix)

Remove unusable tags from the matrix

static int[]
pack(string $allowedChildren, string $allowedDescendants)

Convert a binary representation such as "101011" to an array of integer

Details

at line 22
static array getBitfields(TagCollection $tags, Ruleset $rootRules)

Generate the allowedChildren and allowedDescendants bitfields for every tag and for the root context

Parameters

TagCollection $tags
Ruleset $rootRules

Return Value

array

at line 101
static protected array initMatrix(array $rules)

Initialize a matrix of settings

Parameters

array $rules

Rules for each tag

Return Value

array

Multidimensional array of [tagName => [scope => [targetName => setting]]]

at line 128
static protected void applyTargetedRule(array $matrix, array $rules, string $ruleName, string $key, int $value)

Apply given rule from each applicable tag

For each tag, if the rule has any target we set the corresponding value for each target in the matrix

Parameters

array $matrix

Settings matrix

array $rules

Rules for each tag

string $ruleName

Rule name

string $key

Key in the matrix

int $value

Value to be set

Return Value

void

at line 148
static protected array unrollRules(array $rules)

No description

Parameters

array $rules

Return Value

array

at line 190
static protected void pruneMatrix(array $matrix)

Remove unusable tags from the matrix

Parameters

array $matrix

Return Value

void

at line 240
static protected int[] pack(string $allowedChildren, string $allowedDescendants)

Convert a binary representation such as "101011" to an array of integer

Each bitfield is split in groups of 8 bits, then converted to a 16-bit integer where the allowedChildren bitfield occupies the least significant bits and the allowedDescendants bitfield occupies the most significant bits

Parameters

string $allowedChildren
string $allowedDescendants

Return Value

int[]