ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
HTMLPurifier_TokenFactory Class Reference

Factory for token generation. More...

+ Collaboration diagram for HTMLPurifier_TokenFactory:

Public Member Functions

 __construct ()
 Generates blank prototypes for cloning. More...
 
 createStart ($name, $attr=array())
 Creates a HTMLPurifier_Token_Start. More...
 
 createEnd ($name)
 Creates a HTMLPurifier_Token_End. More...
 
 createEmpty ($name, $attr=array())
 Creates a HTMLPurifier_Token_Empty. More...
 
 createText ($data)
 Creates a HTMLPurifier_Token_Text. More...
 
 createComment ($data)
 Creates a HTMLPurifier_Token_Comment. More...
 

Data Fields

 $p_end
 
 $p_empty
 
 $p_text
 
 $p_comment
 

Private Attributes

 $p_start
 Prototypes that will be cloned. More...
 

Detailed Description

Factory for token generation.

Note
Doing some benchmarking indicates that the new operator is much slower than the clone operator (even discounting the cost of the constructor). This class is for that optimization. Other then that, there's not much point as we don't maintain parallel HTMLPurifier_Token hierarchies (the main reason why you'd want to use an abstract factory).
Todo:
Port DirectLex to use this

Definition at line 14 of file TokenFactory.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_TokenFactory::__construct ( )

Generates blank prototypes for cloning.

Definition at line 27 of file TokenFactory.php.

27  {
28  $this->p_start = new HTMLPurifier_Token_Start('', array());
29  $this->p_end = new HTMLPurifier_Token_End('');
30  $this->p_empty = new HTMLPurifier_Token_Empty('', array());
31  $this->p_text = new HTMLPurifier_Token_Text('');
32  $this->p_comment= new HTMLPurifier_Token_Comment('');
33  }
Concrete end token class.
Definition: End.php:10
Concrete start token class.
Definition: Start.php:6
Concrete empty token class.
Definition: Empty.php:6
Concrete text token class.
Definition: Text.php:12
Concrete comment token class.
Definition: Comment.php:6

Member Function Documentation

◆ createComment()

HTMLPurifier_TokenFactory::createComment (   $data)

Creates a HTMLPurifier_Token_Comment.

Parameters
$dataData of comment token
Returns
Generated HTMLPurifier_Token_Comment

Definition at line 86 of file TokenFactory.php.

References $data, and $p_comment.

86  {
87  $p = clone $this->p_comment;
88  $p->__construct($data);
89  return $p;
90  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ createEmpty()

HTMLPurifier_TokenFactory::createEmpty (   $name,
  $attr = array() 
)

Creates a HTMLPurifier_Token_Empty.

Parameters
$nameTag name
$attrAssociative array of attributes
Returns
Generated HTMLPurifier_Token_Empty

Definition at line 64 of file TokenFactory.php.

References $p_empty.

64  {
65  $p = clone $this->p_empty;
66  $p->__construct($name, $attr);
67  return $p;
68  }

◆ createEnd()

HTMLPurifier_TokenFactory::createEnd (   $name)

Creates a HTMLPurifier_Token_End.

Parameters
$nameTag name
Returns
Generated HTMLPurifier_Token_End

Definition at line 52 of file TokenFactory.php.

References $p_end.

52  {
53  $p = clone $this->p_end;
54  $p->__construct($name);
55  return $p;
56  }

◆ createStart()

HTMLPurifier_TokenFactory::createStart (   $name,
  $attr = array() 
)

Creates a HTMLPurifier_Token_Start.

Parameters
$nameTag name
$attrAssociative array of attributes
Returns
Generated HTMLPurifier_Token_Start

Definition at line 41 of file TokenFactory.php.

References $p_start.

41  {
42  $p = clone $this->p_start;
43  $p->__construct($name, $attr);
44  return $p;
45  }
$p_start
Prototypes that will be cloned.

◆ createText()

HTMLPurifier_TokenFactory::createText (   $data)

Creates a HTMLPurifier_Token_Text.

Parameters
$dataData of text token
Returns
Generated HTMLPurifier_Token_Text

Definition at line 75 of file TokenFactory.php.

References $data, and $p_text.

75  {
76  $p = clone $this->p_text;
77  $p->__construct($data);
78  return $p;
79  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

Field Documentation

◆ $p_comment

HTMLPurifier_TokenFactory::$p_comment

Definition at line 22 of file TokenFactory.php.

Referenced by createComment().

◆ $p_empty

HTMLPurifier_TokenFactory::$p_empty

Definition at line 22 of file TokenFactory.php.

Referenced by createEmpty().

◆ $p_end

HTMLPurifier_TokenFactory::$p_end

Definition at line 22 of file TokenFactory.php.

Referenced by createEnd().

◆ $p_start

HTMLPurifier_TokenFactory::$p_start
private

Prototypes that will be cloned.

Definition at line 22 of file TokenFactory.php.

Referenced by createStart().

◆ $p_text

HTMLPurifier_TokenFactory::$p_text

Definition at line 22 of file TokenFactory.php.

Referenced by createText().


The documentation for this class was generated from the following file: