示例#1
0
 /**
  * Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
  * @param HTMLPurifier_ConfigSchema_Interchange_Id $id
  */
 public function validateId($id)
 {
     $id_string = $id->toString();
     $this->context[] = "id '{$id_string}'";
     if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
         // handled by InterchangeBuilder
         $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
     }
     // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
     // we probably should check that it has at least one namespace
     $this->with($id, 'key')->assertNotEmpty()->assertIsString();
     // implicit assertIsString handled by InterchangeBuilder
     array_pop($this->context);
 }
 /**
  * Convenience function that creates an HTMLPurifier_ConfigSchema_Interchange_Id
  * object based on a string Id.
  */
 protected function id($id)
 {
     return HTMLPurifier_ConfigSchema_Interchange_Id::make($id);
 }