ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_TokenFactory Class Reference

Factory for token generation. More...

+ Collaboration diagram for HTMLPurifier_TokenFactory:

Public Member Functions

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

Private Attributes

 $p_start
 HTMLPurifier_Token_Start
 $p_end
 HTMLPurifier_Token_End
 $p_empty
 HTMLPurifier_Token_Empty
 $p_text
 HTMLPurifier_Token_Text
 $p_comment
 HTMLPurifier_Token_Comment

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

HTMLPurifier_TokenFactory::__construct ( )

Generates blank prototypes for cloning.

Definition at line 46 of file TokenFactory.php.

{
$this->p_start = new HTMLPurifier_Token_Start('', array());
$this->p_end = new HTMLPurifier_Token_End('');
$this->p_empty = new HTMLPurifier_Token_Empty('', array());
$this->p_text = new HTMLPurifier_Token_Text('');
$this->p_comment = new HTMLPurifier_Token_Comment('');
}

Member Function Documentation

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 $p_comment.

{
$p = clone $this->p_comment;
$p->__construct($data);
return $p;
}
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.

{
$p = clone $this->p_empty;
$p->__construct($name, $attr);
return $p;
}
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.

{
$p = clone $this->p_end;
$p->__construct($name);
return $p;
}
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.

{
$p = clone $this->p_start;
$p->__construct($name, $attr);
return $p;
}
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 $p_text.

{
$p = clone $this->p_text;
$p->__construct($data);
return $p;
}

Field Documentation

HTMLPurifier_TokenFactory::$p_comment
private

HTMLPurifier_Token_Comment

Definition at line 41 of file TokenFactory.php.

Referenced by createComment().

HTMLPurifier_TokenFactory::$p_empty
private

HTMLPurifier_Token_Empty

Definition at line 31 of file TokenFactory.php.

Referenced by createEmpty().

HTMLPurifier_TokenFactory::$p_end
private

HTMLPurifier_Token_End

Definition at line 26 of file TokenFactory.php.

Referenced by createEnd().

HTMLPurifier_TokenFactory::$p_start
private

HTMLPurifier_Token_Start

Definition at line 21 of file TokenFactory.php.

Referenced by createStart().

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: