49 $this->aliases = array();
53 $id = $directive->id->toString();
55 $this->
error(
false,
"Integrity violation: key '$i' does not match internal id '$id'");
68 $id_string = $id->toString();
69 $this->
context[] =
"id '$id_string'";
72 $this->
error(
false,
'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
76 $this->
with($id,
'key')
88 $id = $d->id->toString();
89 $this->
context[] =
"directive '$id'";
92 $this->
with($d,
'description')
96 $this->
with($d,
'type')
98 $this->
with($d,
'typeAllowsNull')
102 $this->parser->parse($d->default, $d->type, $d->typeAllowsNull);
104 $this->
error(
'default',
'had error: ' . $e->getMessage());
108 if (!is_null($d->allowed) || !
empty($d->valueAliases)) {
113 $this->
error(
'type',
'must be a string type when used with allowed or value aliases');
131 if (is_null($d->allowed)) {
134 $this->
with($d,
'allowed')
137 if (is_string($d->default) && !isset($d->allowed[$d->default])) {
138 $this->
error(
'default',
'must be an allowed value');
141 foreach ($d->allowed
as $val => $x) {
142 if (!is_string($val)) {
143 $this->
error(
"value $val",
'must be a string');
156 if (is_null($d->valueAliases)) {
159 $this->
with($d,
'valueAliases')
161 $this->
context[] =
'valueAliases';
162 foreach ($d->valueAliases
as $alias => $real) {
163 if (!is_string($alias)) {
164 $this->
error(
"alias $alias",
'must be a string');
166 if (!is_string($real)) {
167 $this->
error(
"alias target $real from alias '$alias'",
'must be a string');
169 if ($alias === $real) {
170 $this->
error(
"alias '$alias'",
"must not be an alias to itself");
173 if (!is_null($d->allowed)) {
174 foreach ($d->valueAliases
as $alias => $real) {
175 if (isset($d->allowed[$alias])) {
176 $this->
error(
"alias '$alias'",
'must not be an allowed value');
177 } elseif (!isset($d->allowed[$real])) {
178 $this->
error(
"alias '$alias'",
'must be an alias to an allowed value');
192 $this->
with($d,
'aliases')
195 foreach ($d->aliases
as $alias) {
197 $s = $alias->toString();
198 if (isset($this->interchange->directives[
$s])) {
199 $this->
error(
"alias '$s'",
'collides with another directive');
201 if (isset($this->aliases[
$s])) {
202 $other_directive = $this->aliases[
$s];
203 $this->
error(
"alias '$s'",
"collides with alias for directive '$other_directive'");
205 $this->aliases[
$s] = $d->id->toString();
228 protected function error($target, $msg)
230 if ($target !==
false) {
244 return implode(
' in ', array_reverse($this->
context));