PHP Class HTMLPurifier_Queue, yii

We don't use the SPL implementation because it's only supported on PHP 5.3 and later. Exercise: Prove that push/pop on this queue take amortized O(1) time. Exercise: Extend this queue to be a deque, while preserving amortized O(1) time. Some care must be taken on rebalancing to avoid quadratic behaviour caused by repeatedly shuffling data from the input stack to the output stack and back.
显示文件 Open project: yiisoft/yii

Public Methods

Method Description
__construct ( $input = [] )
isEmpty ( ) Checks if it's empty.
push ( $x ) Pushes an element onto the front of the queue.
shift ( ) Shifts an element off the front of the queue.

Method Details

__construct() public method

public __construct ( $input = [] )

isEmpty() public method

Checks if it's empty.
public isEmpty ( )

push() public method

Pushes an element onto the front of the queue.
public push ( $x )

shift() public method

Shifts an element off the front of the queue.
public shift ( )