ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
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...
 

Private Attributes

 $p_start
 HTMLPurifier_Token_Start More...
 
 $p_end
 HTMLPurifier_Token_End More...
 
 $p_empty
 HTMLPurifier_Token_Empty More...
 
 $p_text
 HTMLPurifier_Token_Text More...
 
 $p_comment
 HTMLPurifier_Token_Comment 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 46 of file TokenFactory.php.

References array.

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  }
Concrete end token class.
Definition: End.php:10
Concrete start token class.
Definition: Start.php:6
Create styles array
The data for the language used.
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
string$dataData of comment token
Returns
HTMLPurifier_Token_Comment Generated HTMLPurifier_Token_Comment

Definition at line 110 of file TokenFactory.php.

References $data, and $p_comment.

111  {
112  $p = clone $this->p_comment;
113  $p->__construct($data);
114  return $p;
115  }
$p_comment
HTMLPurifier_Token_Comment

◆ createEmpty()

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

Creates a HTMLPurifier_Token_Empty.

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

Definition at line 86 of file TokenFactory.php.

References $p_empty.

87  {
88  $p = clone $this->p_empty;
89  $p->__construct($name, $attr);
90  return $p;
91  }
$p_empty
HTMLPurifier_Token_Empty

◆ createEnd()

HTMLPurifier_TokenFactory::createEnd (   $name)

Creates a HTMLPurifier_Token_End.

Parameters
string$nameTag name
Returns
HTMLPurifier_Token_End Generated HTMLPurifier_Token_End

Definition at line 73 of file TokenFactory.php.

References $p_end.

74  {
75  $p = clone $this->p_end;
76  $p->__construct($name);
77  return $p;
78  }
$p_end
HTMLPurifier_Token_End

◆ createStart()

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

Creates a HTMLPurifier_Token_Start.

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

Definition at line 61 of file TokenFactory.php.

References $p_start.

62  {
63  $p = clone $this->p_start;
64  $p->__construct($name, $attr);
65  return $p;
66  }
$p_start
HTMLPurifier_Token_Start

◆ createText()

HTMLPurifier_TokenFactory::createText (   $data)

Creates a HTMLPurifier_Token_Text.

Parameters
string$dataData of text token
Returns
HTMLPurifier_Token_Text Generated HTMLPurifier_Token_Text

Definition at line 98 of file TokenFactory.php.

References $data, and $p_text.

99  {
100  $p = clone $this->p_text;
101  $p->__construct($data);
102  return $p;
103  }
$p_text
HTMLPurifier_Token_Text

Field Documentation

◆ $p_comment

HTMLPurifier_TokenFactory::$p_comment
private

HTMLPurifier_Token_Comment

Definition at line 41 of file TokenFactory.php.

Referenced by createComment().

◆ $p_empty

HTMLPurifier_TokenFactory::$p_empty
private

HTMLPurifier_Token_Empty

Definition at line 31 of file TokenFactory.php.

Referenced by createEmpty().

◆ $p_end

HTMLPurifier_TokenFactory::$p_end
private

HTMLPurifier_Token_End

Definition at line 26 of file TokenFactory.php.

Referenced by createEnd().

◆ $p_start

HTMLPurifier_TokenFactory::$p_start
private

HTMLPurifier_Token_Start

Definition at line 21 of file TokenFactory.php.

Referenced by createStart().

◆ $p_text

HTMLPurifier_TokenFactory::$p_text
private

HTMLPurifier_Token_Text

Definition at line 36 of file TokenFactory.php.

Referenced by createText().


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