ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
TokenFactory.php
Go to the documentation of this file.
1 <?php
2 
15 {
16  // p stands for prototype
17 
21  private $p_start;
22 
26  private $p_end;
27 
31  private $p_empty;
32 
36  private $p_text;
37 
41  private $p_comment;
42 
46  public function __construct()
47  {
48  $this->p_start = new HTMLPurifier_Token_Start('', array());
49  $this->p_end = new HTMLPurifier_Token_End('');
50  $this->p_empty = new HTMLPurifier_Token_Empty('', array());
51  $this->p_text = new HTMLPurifier_Token_Text('');
52  $this->p_comment = new HTMLPurifier_Token_Comment('');
53  }
54 
61  public function createStart($name, $attr = array())
62  {
63  $p = clone $this->p_start;
64  $p->__construct($name, $attr);
65  return $p;
66  }
67 
73  public function createEnd($name)
74  {
75  $p = clone $this->p_end;
76  $p->__construct($name);
77  return $p;
78  }
79 
86  public function createEmpty($name, $attr = array())
87  {
88  $p = clone $this->p_empty;
89  $p->__construct($name, $attr);
90  return $p;
91  }
92 
98  public function createText($data)
99  {
100  $p = clone $this->p_text;
101  $p->__construct($data);
102  return $p;
103  }
104 
110  public function createComment($data)
111  {
112  $p = clone $this->p_comment;
113  $p->__construct($data);
114  return $p;
115  }
116 }
117 
118 // vim: et sw=4 sts=4