foreach ($elements as $tag =>
$restrictions) { // `<*>`'s attribute restrictions do not need to be compared.
if ($tag === '*'
) { continue;
} $original[$tag] =
$restrictions;
$global[$tag] =
$globally_allowed_attribute_restrictions;
} // The subset of attribute restrictions after diffing with those on `<*>`.
$net_global_attribute_restrictions =
(new self($original)) ->
doDiff(new self($global)) ->
getAllowedElements(FALSE
);
// Update each tag's attribute restrictions to the subset.
foreach ($elements as $tag =>
$restrictions) { // `<*>` remains untouched.
if ($tag === '*'
) { continue;
} $this->elements
[$tag] =
$net_global_attribute_restrictions[$tag] // If the tag is absent from the subset, then its attribute
// restrictions were a strict subset of `<*>`: just allowing the tag