ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Switch.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
12  protected $tag;
13 
17  protected $withTag;
18 
22  protected $withoutTag;
23 
29  public function __construct($tag, $with_tag, $without_tag)
30  {
31  $this->tag = $tag;
32  $this->withTag = $with_tag;
33  $this->withoutTag = $without_tag;
34  }
35 
42  public function validate($string, $config, $context)
43  {
44  $token = $context->get('CurrentToken', true);
45  if (!$token || $token->name !== $this->tag) {
46  return $this->withoutTag->validate($string, $config, $context);
47  } else {
48  return $this->withTag->validate($string, $config, $context);
49  }
50  }
51 }
52 
53 // vim: et sw=4 sts=4
validate($string, $config, $context)
Definition: Switch.php:42
$context
Definition: webdav.php:25
$config
Definition: bootstrap.php:15
Decorator that, depending on a token, switches between two definitions.
Definition: Switch.php:6
__construct($tag, $with_tag, $without_tag)
Definition: Switch.php:29
$withTag
HTMLPurifier_AttrDef
Definition: Switch.php:17
$withoutTag
HTMLPurifier_AttrDef
Definition: Switch.php:22