[3.1.0] Implement Duplicate validator, also modify some design things
[htmlpurifier.git] / library / HTMLPurifier / ConfigSchema / Validator / Duplicate.php
blobbcada41d1ce7a7ab06c2b4cb4d9f6f42944dde3f
1 <?php
3 /**
4 * Validates that this ID does not exist already in the interchange object.
5 * @note
6 * Although this tests both possible values, in practice the ID
7 * will only be in one or the other. We do this to keep things simple.
8 */
9 class HTMLPurifier_ConfigSchema_Validator_Duplicate extends HTMLPurifier_ConfigSchema_Validator
12 public function validate(&$arr, $interchange) {
13 if (isset($interchange->namespaces[$arr['ID']])) {
14 $this->error('Cannot redefine namespace');
16 if (isset($interchange->directives[$arr['ID']])) {
17 $this->error('Cannot redefine directive');