ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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