PHP 클래스 Prado\Collections\TStack

TStack implements a stack. The typical stack operations are implemented, which include {@link push()}, {@link pop()} and {@link peek()}. In addition, {@link contains()} can be used to check if an item is contained in the stack. To obtain the number of the items in the stack, check the {@link getCount Count} property. Items in the stack may be traversed using foreach as follows, foreach($stack as $item) ...
부터: 3.0
저자: Qiang Xue ([email protected])
상속: extends Prado\TComponent, implements IteratorAggregate, implements Countable
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( $data = null ) Constructor.
clear ( ) Removes all items in the stack.
contains ( $item ) : boolean
copyFrom ( $data ) Copies iterable data into the stack.
count ( ) : integer Returns the number of items in the stack.
getCount ( ) : integer
getIterator ( ) : Iterator Returns an iterator for traversing the items in the stack.
peek ( ) : mixed Returns the item at the top of the stack.
pop ( ) : mixed Pops up the item at the top of the stack.
push ( $item ) Pushes an item into the stack.
toArray ( ) : array

메소드 상세

__construct() 공개 메소드

Initializes the stack with an array or an iterable object.
public __construct ( $data = null )

clear() 공개 메소드

Removes all items in the stack.
public clear ( )

contains() 공개 메소드

public contains ( $item ) : boolean
리턴 boolean whether the stack contains the item

copyFrom() 공개 메소드

Note, existing data in the list will be cleared first.
public copyFrom ( $data )

count() 공개 메소드

This method is required by \Countable interface.
public count ( ) : integer
리턴 integer number of items in the stack.

getCount() 공개 메소드

public getCount ( ) : integer
리턴 integer the number of items in the stack

getIterator() 공개 메소드

This method is required by the interface \IteratorAggregate.
public getIterator ( ) : Iterator
리턴 Iterator an iterator for traversing the items in the stack.

peek() 공개 메소드

Unlike {@link pop()}, this method does not remove the item from the stack.
public peek ( ) : mixed
리턴 mixed item at the top of the stack

pop() 공개 메소드

Pops up the item at the top of the stack.
public pop ( ) : mixed
리턴 mixed the item at the top of the stack

push() 공개 메소드

Pushes an item into the stack.
public push ( $item )

toArray() 공개 메소드

public toArray ( ) : array
리턴 array the list of items in stack