HTMLPurifier_Zipper Klassenreferenz

HTMLPurifier_Zipper Klassenreferenz

Öffentliche Methoden

 __construct ($front, $back)
 
 toArray ($t=NULL)
 
 next ($t)
 
 advance ($t, $n)
 
 prev ($t)
 
 delete ()
 
 done ()
 
 insertBefore ($t)
 
 insertAfter ($t)
 
 splice ($t, $delete, $replacement)
 

Öffentliche, statische Methoden

static fromArray ($array)
 

Datenfelder

 $front
 
 $back
 

Ausführliche Beschreibung

A zipper is a purely-functional data structure which contains a focus that can be efficiently manipulated. It is known as a "one-hole context". This mutable variant implements a zipper for a list as a pair of two arrays, laid out as follows:

 Base list: 1 2 3 4 [ ] 6 7 8 9
 Front list: 1 2 3 4
 Back list: 9 8 7 6

User is expected to keep track of the "current element" and properly fill it back in as necessary. (ToDo: Maybe it's more user friendly to implicitly track the current element?)

Nota bene: the current class gets confused if you try to store NULLs in the list.

Definiert in Zeile 21 der Datei Zipper.php.

Beschreibung der Konstruktoren und Destruktoren

__construct (   $front,
  $back 
)

Definiert in Zeile 25 der Datei Zipper.php.

Benutzt $back und $front.

Dokumentation der Elementfunktionen

advance (   $t,
  $n 
)

Iterated hole advancement.

Parameter
$tElement to fill hole with
$iHow many forward to advance hole
Rückgabe
Original contents of new hole, i away

Definiert in Zeile 72 der Datei Zipper.php.

Benutzt next().

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

delete ( )

Delete contents of current hole, shifting hole to next element.

Rückgabe
Original contents of new hole.

Definiert in Zeile 94 der Datei Zipper.php.

done ( )

Returns true if we are at the end of the list.

Rückgabe
bool

Definiert in Zeile 102 der Datei Zipper.php.

static fromArray (   $array)
static

Creates a zipper from an array, with a hole in the 0-index position.

Parameter
Arrayto zipper-ify.
Rückgabe
Tuple of zipper and element of first position.

Definiert in Zeile 36 der Datei Zipper.php.

Wird benutzt von HTMLPurifier_Strategy_MakeWellFormed\execute().

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

insertAfter (   $t)

Insert element after hole.

Parameter
Elementto insert

Definiert in Zeile 118 der Datei Zipper.php.

Wird benutzt von splice().

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

insertBefore (   $t)

Insert element before hole.

Parameter
Elementto insert

Definiert in Zeile 110 der Datei Zipper.php.

next (   $t)

Move hole to the next element.

Parameter
$tElement to fill hole with
Rückgabe
Original contents of new hole.

Definiert in Zeile 61 der Datei Zipper.php.

Wird benutzt von advance().

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

prev (   $t)

Move hole to the previous element

Parameter
$tElement to fill hole with
Rückgabe
Original contents of new hole.

Definiert in Zeile 84 der Datei Zipper.php.

splice (   $t,
  $delete,
  $replacement 
)

Splice in multiple elements at hole. Functional specification in terms of array_splice:

 $arr1 = $arr;
 $old1 = array_splice($arr1, $i, $delete, $replacement);

 list($z, $t) = HTMLPurifier_Zipper::fromArray($arr);
 $t = $z->advance($t, $i);
 list($old2, $t) = $z->splice($t, $delete, $replacement);
 $arr2 = $z->toArray($t);

 assert($old1 === $old2);
 assert($arr1 === $arr2);

NB: the absolute index location after this operation is unchanged!

Parameter
Currentcontents of hole.

Definiert in Zeile 142 der Datei Zipper.php.

Benutzt insertAfter().

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

toArray (   $t = NULL)

Convert zipper back into a normal array, optionally filling in the hole with a value. (Usually you should supply a $t, unless you are at the end of the array.)

Definiert in Zeile 47 der Datei Zipper.php.

Benutzt $front.

Dokumentation der Datenelemente

$back

Definiert in Zeile 23 der Datei Zipper.php.

Wird benutzt von __construct().

$front

Definiert in Zeile 23 der Datei Zipper.php.

Wird benutzt von __construct() und toArray().


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.