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')
 
   79        array_pop($this->context);
 
   88        $id = 
$d->id->toString();
 
   89        $this->context[] = 
"directive '$id'";
 
   92        $this->
with(
$d, 
'description')
 
   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');
 
  121        array_pop($this->context);
 
  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');
 
  140        $this->context[] = 
'allowed';
 
  141        foreach (
$d->allowed as $val => 
$x) {
 
  142            if (!is_string($val)) {
 
  143                $this->
error(
"value $val", 
'must be a string');
 
  146        array_pop($this->context);
 
  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');
 
  182        array_pop($this->context);
 
  192        $this->
with(
$d, 
'aliases')
 
  194        $this->context[] = 
'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();
 
  207        array_pop($this->context);
 
  219    protected function with($obj, $member)
 
  244        return implode(
' in ', array_reverse($this->context));
 
for($col=0; $col< 50; $col++) $d
An exception for terminatinating execution or to throw for unit testing.
Exceptions related to configuration schema.
Represents a directive ID in the interchange format.
Fluent interface for validating the contents of member variables.
Performs validations on HTMLPurifier_ConfigSchema_Interchange.
validate($interchange)
Validates a fully-formed interchange object.
with($obj, $member)
Convenience function for generating HTMLPurifier_ConfigSchema_ValidatorAtom for validating simple mem...
validateDirectiveValueAliases($d)
Extra validation if $valueAliases member variable of HTMLPurifier_ConfigSchema_Interchange_Directive ...
validateDirectiveAllowed($d)
Extra validation if $allowed member variable of HTMLPurifier_ConfigSchema_Interchange_Directive is de...
validateDirectiveAliases($d)
Extra validation if $aliases member variable of HTMLPurifier_ConfigSchema_Interchange_Directive is de...
$context
Context-stack to provide easy to read error messages.
validateId($id)
Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
validateDirective($d)
Validates a HTMLPurifier_ConfigSchema_Interchange_Directive object.
error($target, $msg)
Emits an error, providing helpful context.
getFormattedContext()
Returns a formatted context string.
$interchange
@type HTMLPurifier_ConfigSchema_Interchange
$parser
to test default's type.
Exception type for HTMLPurifier_VarParser.
Parses string representations into their corresponding native PHP variable type.
static $stringTypes
Lookup table of types that are string, and can have aliases or allowed value lists.
static $types
Lookup table of allowed types.