Class Collection (namespace Nette\Collections)


SPL ArrayObject customization.

ArrayObject
   |
   --Collection

Implements interfaces:

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Abstract:
Located: in /Collections/Collection.php (line 34)
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().
string
Returns the name of the class of this object.
ArrayIterator
Returns the iterator.
void
import (array|\Traversable $arr)
Import from array or any traversable object.
bool
Returns a value indicating whether collection is read-only.
bool
remove (mixed $item)
Removes the first occurrence of the specified element.
void
Prevent any more modifications.
void
__call ($name, $args)
Call to undefined method.
static void
__callStatic ($name, $args)
Call to undefined static method.
& 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 void
Responds when an item is about to be removed from the collection.
protected int|FALSE
search (mixed $item)
Returns the index of the first occurrence of the specified element,.
protected void
setArray (array $array)
Protected exchangeArray().
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
Variable Summary
protected string $checkFunc

line 40

function to verify type
protected string $itemType

line 37

type (class, interface, PHP type)
protected bool $readOnly FALSE

line 43


Method Details

line 52

__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 85

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 192

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 219

beforeRemove

protected void beforeRemove ()

Responds when an item is about to be removed from the collection.

Output
void  
Throws
throws NotSupportedException

line 131

clear

public void clear ()

Removes all of the elements from this collection.

Implementation of:

Output
void  
Throws
throws NotSupportedException

line 144

contains

public bool contains (mixed $item)

Returns true if this collection contains the specified item.

Implementation of:

Input
mixed $item
Output
bool  

line 246

exchangeArray

public void exchangeArray ($array)

Not supported. Use import().

Input
$array
Output
void  

line 274

getClass

public string getClass ()

Returns the name of the class of this object.

Output
string  

line 236

getIterator

public ArrayIterator getIterator ()

Returns the iterator.

Output
ArrayIterator  

line 157

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 175

isReadOnly

public bool isReadOnly ()

Returns a value indicating whether collection is read-only.

Implementation of:

Output
bool  

line 99

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 119

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 258

setArray

protected void setArray (array $array)

Protected exchangeArray().

Input
array $array new array
Output
void  

line 72

setReadOnly

public void setReadOnly ()

Prevent any more modifications.

Output
void  

line 286

__call

public void __call ($name, $args)

Call to undefined method.

Input
$name
$args
Output
void  
Throws
throws MemberAccessException

line 298

__callStatic

public static void __callStatic ($name, $args)

Call to undefined static method.

Input
$name
$args
Output
void  
Throws
throws MemberAccessException

line 311

__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 336

__isset

public bool __isset (string $name)

Is property defined?

Overridden in child classes as:

Input
string $name property name
Output
bool  

line 323

__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 348

__unset

public void __unset ($name)

Access to undeclared property.

Overridden in child classes as:

Input
$name
Output
void  
Throws
throws MemberAccessException