PHP 클래스 Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject

This is a helper class for working with arrays.
상속: extends Webiny\Component\StdLib\StdObject\AbstractStdObject, implements IteratorAggregate, implements ArrayAccess, implements Countable, use trait ManipulatorTrait, use trait ValidatorTrait
파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$value Current array.

공개 메소드들

메소드 설명
__construct ( null | array | ArrayObject | ArrayAccess $array = null, null | array $values = null ) Constructor.
__get ( $name ) Get key
__set ( $name, $value ) Set array object value
__toString ( ) : mixed To string implementation.
count ( ) : integer Get the number of elements inside the array.
countValues ( ) : ArrayObject Counts the occurrences of the same array values and groups them into an associate array.
first ( ) : StringObject | ArrayObject | StdObjectWrapper Get the first element in the array.
getIterator ( ) : Traversable (PHP 5 >= 5.0.0)
Retrieve an external iterator
keys ( ) : ArrayObject Get only the keys of current array.
last ( ) : StringObject | ArrayObject | StdObjectWrapper Get the last element in the array.
offsetExists ( mixed $offset ) : boolean (PHP 5 >= 5.0.0)
Whether a offset exists
offsetGet ( mixed $offset ) : mixed (PHP 5 >= 5.0.0)
Offset to retrieve
offsetSet ( mixed $offset, mixed $value ) : void (PHP 5 >= 5.0.0)
Offset to set
offsetUnset ( mixed $offset ) : void (PHP 5 >= 5.0.0)
Offset to unset
sum ( ) : number Get the sum of all elements inside the array.
values ( ) : ArrayObject Get only the values of current array.

메소드 상세

__construct() 공개 메소드

Set standard object value.
public __construct ( null | array | ArrayObject | ArrayAccess $array = null, null | array $values = null )
$array null | array | ArrayObject | ArrayAccess Array or ArrayAccess from which to create an ArrayObject.
$values null | array Array of values that will be combined with $array. See http://www.php.net/manual/en/function.array-combine.php for more info. $array param is used as key array.

__get() 공개 메소드

Get key
public __get ( $name )
$name

__set() 공개 메소드

Set array object value
public __set ( $name, $value )
$name
$value

__toString() 공개 메소드

To string implementation.
public __toString ( ) : mixed
리턴 mixed String 'Array'.

count() 공개 메소드

Get the number of elements inside the array.
public count ( ) : integer
리턴 integer Number of elements inside the current array.

countValues() 공개 메소드

NOTE: This function can only count array values that are type of STRING of INTEGER.
public countValues ( ) : ArrayObject
리턴 ArrayObject An ArrayObject containing the array values as keys and number of their occurrences as values.

first() 공개 메소드

If the element is array, ArrayObject is returned, else StringObject is returned.
public first ( ) : StringObject | ArrayObject | StdObjectWrapper
리턴 Webiny\Component\StdLib\StdObject\StringObject\StringObject | ArrayObject | StdObjectWrapper The first element in the array.

getIterator() 공개 메소드

(PHP 5 >= 5.0.0)
Retrieve an external iterator
public getIterator ( ) : Traversable
리턴 Traversable An instance of an object implementing Iterator or Traversable

keys() 공개 메소드

Get only the keys of current array.
public keys ( ) : ArrayObject
리턴 ArrayObject An ArrayObject containing only the keys of current array.

last() 공개 메소드

If the element is array, ArrayObject is returned, else StringObject is returned.
public last ( ) : StringObject | ArrayObject | StdObjectWrapper
리턴 Webiny\Component\StdLib\StdObject\StringObject\StringObject | ArrayObject | StdObjectWrapper The last element in the array.

offsetExists() 공개 메소드

(PHP 5 >= 5.0.0)
Whether a offset exists
public offsetExists ( mixed $offset ) : boolean
$offset mixed

An offset to check for.

리턴 boolean true on success or false on failure.

The return value will be casted to boolean if non-boolean was returned.

offsetGet() 공개 메소드

(PHP 5 >= 5.0.0)
Offset to retrieve
public offsetGet ( mixed $offset ) : mixed
$offset mixed

The offset to retrieve.

리턴 mixed Can return all value types.

offsetSet() 공개 메소드

(PHP 5 >= 5.0.0)
Offset to set
public offsetSet ( mixed $offset, mixed $value ) : void
$offset mixed

The offset to assign the value to.

$value mixed

The value to set.

리턴 void

offsetUnset() 공개 메소드

(PHP 5 >= 5.0.0)
Offset to unset
public offsetUnset ( mixed $offset ) : void
$offset mixed

The offset to unset.

리턴 void

sum() 공개 메소드

Get the sum of all elements inside the array.
public sum ( ) : number
리턴 number The sum of all elements from within the current array.

values() 공개 메소드

Get only the values of current array.
public values ( ) : ArrayObject
리턴 ArrayObject An ArrayObject containing only the values of current array.

프로퍼티 상세

$value 보호되어 있는 프로퍼티

Current array.
protected $value