PHP 클래스 HTMLPurifier_Zipper, yii

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.
파일 보기 프로젝트 열기: yiisoft/yii 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$back
$front

공개 메소드들

메소드 설명
__construct ( $front, $back )
advance ( $t, $n ) : Original Iterated hole advancement.
delete ( ) : Original Delete contents of current hole, shifting hole to next element.
done ( ) : boolean Returns true if we are at the end of the list.
fromArray ( $array ) : Tuple Creates a zipper from an array, with a hole in the 0-index position.
insertAfter ( $t ) Insert element after hole.
insertBefore ( $t ) Insert element before hole.
next ( $t ) : Original Move hole to the next element.
prev ( $t ) : Original Move hole to the previous element
splice ( $t, $delete, $replacement ) Splice in multiple elements at hole. Functional specification in terms of array_splice:
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.)

메소드 상세

__construct() 공개 메소드

public __construct ( $front, $back )

advance() 공개 메소드

Iterated hole advancement.
public advance ( $t, $n ) : Original
$t Element to fill hole with
리턴 Original contents of new hole, i away

delete() 공개 메소드

Delete contents of current hole, shifting hole to next element.
public delete ( ) : Original
리턴 Original contents of new hole.

done() 공개 메소드

Returns true if we are at the end of the list.
public done ( ) : boolean
리턴 boolean

fromArray() 공개 정적인 메소드

Creates a zipper from an array, with a hole in the 0-index position.
public static fromArray ( $array ) : Tuple
리턴 Tuple of zipper and element of first position.

insertAfter() 공개 메소드

Insert element after hole.
public insertAfter ( $t )

insertBefore() 공개 메소드

Insert element before hole.
public insertBefore ( $t )

next() 공개 메소드

Move hole to the next element.
public next ( $t ) : Original
$t Element to fill hole with
리턴 Original contents of new hole.

prev() 공개 메소드

Move hole to the previous element
public prev ( $t ) : Original
$t Element to fill hole with
리턴 Original contents of new hole.

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!*
public splice ( $t, $delete, $replacement )

toArray() 공개 메소드

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.)
public toArray ( $t = NULL )

프로퍼티 상세

$back 공개적으로 프로퍼티

public $back

$front 공개적으로 프로퍼티

public $front