Class Collection (namespace Nette\Collections)


SPL ArrayObject customization.

ArrayObject
   |
   --Collection

Implements interfaces:

Direct Known Sub-classes:

Copyright: Copyright (c) 2004, 2010 David Grudl
Abstract:
Located: in /Collections/Collection.php (line 23)
Public Method Summary
Collection
__construct ([array $arr = NULL], [string $type = NULL])
void
append (mixed $item)
Appends the specified element to the end of this collection.
void
clear ()
Removes all of the elements from this collection.
bool
contains (mixed $item)
Returns true if this collection contains the specified item.
void
exchangeArray ($array)
Not supported. Use import().
void
freeze ()
Makes the object unmodifiable.
string
Returns the item type.
ArrayIterator
Returns the iterator.
ClassReflection
void
import (array|\Traversable $arr)
Import from array or any traversable object.
bool
Is the object unmodifiable?
void
bool
remove (mixed $item)
Removes the first occurrence of the specified element.
void
void
__call ($name, $args)
Call to undefined method.
static void
__callStatic ($name, $args)
Call to undefined static method.
void
__clone ()
Creates a modifiable clone of the object.
& void
__get ($name)
Returns property value. Do not call directly.
bool
__isset (string $name)
Is property defined?
void
__set ($name, $value)
Sets value of a property. Do not call directly.
void
__unset ($name)
Access to undeclared property.
Protected Method Summary
protected void
beforeAdd (mixed $item)
Responds when the item is about to be added to the collection.
protected int|FALSE
search (mixed $item)
Returns the index of the first occurrence of the specified element,.
protected Collection
setArray (array $array)
Protected exchangeArray().
protected void
Methods Inherited From ArrayObject (Internal Class)
constructor __construct ( $array ), append ( $value ), asort ( ), count ( ), exchangeArray ( $array ), getArrayCopy ( ), getFlags ( ), getIterator ( ), getIteratorClass ( ), ksort ( ), natcasesort ( ), natsort ( ), offsetExists ( $index ), offsetGet ( $index ), offsetSet ( $index, $newval ), offsetUnset ( $index ), setFlags ( $flags ), setIteratorClass ( $iteratorClass ), uasort ( $cmp_function ), uksort ( $cmp_function )
Constant Summary
Constants Inherited From ArrayObject (Internal Class)
ARRAY_AS_PROPS = 2, STD_PROP_LIST = 1

Method Details

line 41

__construct

public Collection __construct ([array $arr = NULL], [string $type = NULL])

Overridden in child classes as:

Input
array $arr to wrap
string $type class/interface name or ':type'
Output
Collection  
Throws
throws InvalidArgumentException

line 63

append

public void append (mixed $item)

Appends the specified element to the end of this collection.

Overridden in child classes as:

Implementation of:

Input
mixed $item
Output
void  
Throws
throws InvalidArgumentException

line 190

beforeAdd

protected void beforeAdd (mixed $item)

Responds when the item is about to be added to the collection.

Input
mixed $item
Output
void  
Throws
throws InvalidArgumentException, \NotSupportedException

line 109

clear

public void clear ()

Removes all of the elements from this collection.

Implementation of:

Output
void  
Throws
throws NotSupportedException

line 122

contains

public bool contains (mixed $item)

Returns true if this collection contains the specified item.

Implementation of:

Input
mixed $item
Output
bool  

line 228

exchangeArray

public void exchangeArray ($array)

Not supported. Use import().

Input
$array
Output
void  

line 344

freeze

public void freeze ()

Makes the object unmodifiable.

Overridden in child classes as:

Output
void  

line 153

getItemType

public string getItemType ()

Returns the item type.

Output
string  

line 218

getIterator

public ArrayIterator getIterator ()

Returns the iterator.

Output
ArrayIterator  

line 255

getReflection

public ClassReflection getReflection ()

Output
ClassReflection  

line 135

import

public void import (array|\Traversable $arr)

Import from array or any traversable object.

Overridden in child classes as:

Input
array|\Traversable $arr
Output
void  
Throws
throws InvalidArgumentException

line 355

isFrozen

public bool isFrozen ()

Is the object unmodifiable?

Output
bool  

line 173

isReadOnly

public void isReadOnly ()

Output
void  
Tags
Deprecated

line 77

remove

public bool remove (mixed $item)

Removes the first occurrence of the specified element.

Overridden in child classes as:

Implementation of:

Input
mixed $item
Output
bool true if this collection changed as a result of the call
Throws
throws NotSupportedException

line 97

search

protected int|FALSE search (mixed $item)

Returns the index of the first occurrence of the specified element,.

or FALSE if this collection does not contain this element.

Overridden in child classes as:

Input
mixed $item
Output
int|FALSE  

line 240

setArray

protected Collection setArray (array $array)

Protected exchangeArray().

Input
array $array new array
Output
Collection provides a fluent interface

line 163

setReadOnly

public void setReadOnly ()

Output
void  
Tags
Deprecated

line 376

updating

protected void updating ()

Output
void  

line 267

__call

public void __call ($name, $args)

Call to undefined method.

Input
$name
$args
Output
void  
Throws
throws MemberAccessException

line 279

__callStatic

public static void __callStatic ($name, $args)

Call to undefined static method.

Input
$name
$args
Output
void  
Throws
throws MemberAccessException

line 366

__clone

public void __clone ()

Creates a modifiable clone of the object.

Overridden in child classes as:

Output
void  

line 292

__get

public void & __get ($name)

Returns property value. Do not call directly.

Overridden in child classes as:

Input
$name
Output
& void  
Throws
throws MemberAccessException if the property is not defined.

line 317

__isset

public bool __isset (string $name)

Is property defined?

Overridden in child classes as:

Input
string $name property name
Output
bool  

line 304

__set

public void __set ($name, $value)

Sets value of a property. Do not call directly.

Overridden in child classes as:

Input
$name
$value
Output
void  
Throws
throws MemberAccessException if the property is not defined or is read-only

line 329

__unset

public void __unset ($name)

Access to undeclared property.

Overridden in child classes as:

Input
$name
Output
void  
Throws
throws MemberAccessException