|
|
| __construct ($front, $back) |
| |
| | advance ($t, $n) |
| | Iterated hole advancement.
|
| |
| | delete () |
| | Delete contents of current hole, shifting hole to next element.
|
| |
| | done () |
| | Returns true if we are at the end of the list.
|
| |
| | insertAfter ($t) |
| | Insert element after hole.
|
| |
| | insertBefore ($t) |
| | Insert element before hole.
|
| |
| | next ($t) |
| | Move hole to the next element.
|
| |
| | prev ($t) |
| | Move hole to the previous element.
|
| |
| | splice ($t, $delete, $replacement) |
| | Splice in multiple elements at hole.
|
| |
| | toArray ($t=NULL) |
| | Convert zipper back into a normal array, optionally filling in the hole with a value.
|
| |
|
| static | fromArray ($array) |
| | Creates a zipper from an array, with a hole in the 0-index position.
|
| |
◆ advance()
| HTMLPurifier_Zipper::advance |
( |
| $t, |
|
|
| $n ) |
Iterated hole advancement.
- Parameters
-
| $t | Element to fill hole with |
| $i | How many forward to advance hole |
- Return values
-
| Original | contents of new hole, i away |
◆ delete()
| HTMLPurifier_Zipper::delete |
( |
| ) |
|
Delete contents of current hole, shifting hole to next element.
- Return values
-
| Original | contents of new hole. |
◆ done()
| HTMLPurifier_Zipper::done |
( |
| ) |
|
Returns true if we are at the end of the list.
- Return values
-
◆ fromArray()
| static HTMLPurifier_Zipper::fromArray |
( |
| $array | ) |
|
|
static |
Creates a zipper from an array, with a hole in the 0-index position.
- Parameters
-
- Return values
-
| Tuple | of zipper and element of first position. |
◆ insertAfter()
| HTMLPurifier_Zipper::insertAfter |
( |
| $t | ) |
|
Insert element after hole.
- Parameters
-
◆ insertBefore()
| HTMLPurifier_Zipper::insertBefore |
( |
| $t | ) |
|
Insert element before hole.
- Parameters
-
◆ next()
| HTMLPurifier_Zipper::next |
( |
| $t | ) |
|
Move hole to the next element.
- Parameters
-
| $t | Element to fill hole with |
- Return values
-
| Original | contents of new hole. |
◆ prev()
| HTMLPurifier_Zipper::prev |
( |
| $t | ) |
|
Move hole to the previous element.
- Parameters
-
| $t | Element to fill hole with |
- Return values
-
| Original | contents of new hole. |
◆ splice()
| HTMLPurifier_Zipper::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!
- Parameters
-
◆ toArray()
| HTMLPurifier_Zipper::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.)
The documentation for this class was generated from the following file:
- lib/htmlpurifier/HTMLPurifier/Zipper.php