PHP 트레잇 yii\base\ArrayAccessTrait

Note that ArrayAccessTrait requires the class using it contain a property named data which should be an array. The data will be exposed by ArrayAccessTrait to support accessing the class object like an array.
부터: 2.0
저자: Qiang Xue ([email protected])
파일 보기 프로젝트 열기: yiisoft/yii2

공개 메소드들

메소드 설명
count ( ) : integer Returns the number of data items.
getIterator ( ) : ArrayIterator Returns an iterator for traversing the data.
offsetExists ( mixed $offset ) : boolean This method is required by the interface [[\ArrayAccess]].
offsetGet ( integer $offset ) : mixed This method is required by the interface [[\ArrayAccess]].
offsetSet ( integer $offset, mixed $item ) This method is required by the interface [[\ArrayAccess]].
offsetUnset ( mixed $offset ) This method is required by the interface [[\ArrayAccess]].

메소드 상세

count() 공개 메소드

This method is required by Countable interface.
public count ( ) : integer
리턴 integer number of data elements.

getIterator() 공개 메소드

This method is required by the SPL interface [[\IteratorAggregate]]. It will be implicitly called when you use foreach to traverse the collection.
public getIterator ( ) : ArrayIterator
리턴 ArrayIterator an iterator for traversing the cookies in the collection.

offsetExists() 공개 메소드

This method is required by the interface [[\ArrayAccess]].
public offsetExists ( mixed $offset ) : boolean
$offset mixed the offset to check on
리턴 boolean

offsetGet() 공개 메소드

This method is required by the interface [[\ArrayAccess]].
public offsetGet ( integer $offset ) : mixed
$offset integer the offset to retrieve element.
리턴 mixed the element at the offset, null if no element is found at the offset

offsetSet() 공개 메소드

This method is required by the interface [[\ArrayAccess]].
public offsetSet ( integer $offset, mixed $item )
$offset integer the offset to set element
$item mixed the element value

offsetUnset() 공개 메소드

This method is required by the interface [[\ArrayAccess]].
public offsetUnset ( mixed $offset )
$offset mixed the offset to unset element