39 $this->aliases = array();
43 $id = $directive->id->toString();
44 if (
$i != $id) $this->
error(
false,
"Integrity violation: key '$i' does not match internal id '$id'");
54 $id_string = $id->toString();
55 $this->context[] =
"id '$id_string'";
58 $this->
error(
false,
'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
62 $this->
with($id,
'key')
65 array_pop($this->context);
72 $id = $d->id->toString();
73 $this->context[] =
"directive '$id'";
76 $this->
with($d,
'description')
80 $this->
with($d,
'type')
82 $this->
with($d,
'typeAllowsNull')
86 $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
88 $this->
error(
'default',
'had error: ' . $e->getMessage());
92 if (!is_null($d->allowed) || !empty($d->valueAliases)) {
97 $this->
error(
'type',
'must be a string type when used with allowed or value aliases');
105 array_pop($this->context);
113 if (is_null($d->allowed))
return;
114 $this->
with($d,
'allowed')
117 if (is_string($d->default) && !isset($d->allowed[$d->default])) {
118 $this->
error(
'default',
'must be an allowed value');
120 $this->context[] =
'allowed';
121 foreach ($d->allowed as $val => $x) {
122 if (!is_string($val)) $this->
error(
"value $val",
'must be a string');
124 array_pop($this->context);
132 if (is_null($d->valueAliases))
return;
133 $this->
with($d,
'valueAliases')
135 $this->context[] =
'valueAliases';
136 foreach ($d->valueAliases as $alias => $real) {
137 if (!is_string($alias)) $this->
error(
"alias $alias",
'must be a string');
138 if (!is_string($real)) $this->
error(
"alias target $real from alias '$alias'",
'must be a string');
139 if ($alias === $real) {
140 $this->
error(
"alias '$alias'",
"must not be an alias to itself");
143 if (!is_null($d->allowed)) {
144 foreach ($d->valueAliases as $alias => $real) {
145 if (isset($d->allowed[$alias])) {
146 $this->
error(
"alias '$alias'",
'must not be an allowed value');
147 } elseif (!isset($d->allowed[$real])) {
148 $this->
error(
"alias '$alias'",
'must be an alias to an allowed value');
152 array_pop($this->context);
160 $this->
with($d,
'aliases')
162 $this->context[] =
'aliases';
163 foreach ($d->aliases as $alias) {
165 $s = $alias->toString();
166 if (isset($this->interchange->directives[$s])) {
167 $this->
error(
"alias '$s'",
'collides with another directive');
169 if (isset($this->aliases[$s])) {
170 $other_directive = $this->aliases[$s];
171 $this->
error(
"alias '$s'",
"collides with alias for directive '$other_directive'");
173 $this->aliases[$s] = $d->id->toString();
175 array_pop($this->context);
184 protected function with($obj, $member) {
201 return implode(
' in ', array_reverse($this->context));