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 35)
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 name of the class of this object.
string
Returns the item type.
ArrayIterator
Returns the iterator.
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 53

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

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 202

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 121

clear

public void clear ()

Removes all of the elements from this collection.

Implementation of:

Output
void  
Throws
throws NotSupportedException

line 134

contains

public bool contains (mixed $item)

Returns true if this collection contains the specified item.

Implementation of:

Input
mixed $item
Output
bool  

line 240

exchangeArray

public void exchangeArray ($array)

Not supported. Use import().

Input
$array
Output
void  

line 358

freeze

public void freeze ()

Makes the object unmodifiable.

Overridden in child classes as:

Output
void  

line 269

getClass

public string getClass ()

Returns the name of the class of this object.

Output
string  

line 165

getItemType

public string getItemType ()

Returns the item type.

Output
string  

line 230

getIterator

public ArrayIterator getIterator ()

Returns the iterator.

Output
ArrayIterator  

line 147

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 369

isFrozen

public bool isFrozen ()

Is the object unmodifiable?

Output
bool  

line 185

isReadOnly

public void isReadOnly ()

Output
void  
Tags
Deprecated

line 89

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 109

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 252

setArray

protected Collection setArray (array $array)

Protected exchangeArray().

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

line 175

setReadOnly

public void setReadOnly ()

Output
void  
Tags
Deprecated

line 390

updating

protected void updating ()

Output
void  

line 281

__call

public void __call ($name, $args)

Call to undefined method.

Input
$name
$args
Output
void  
Throws
throws MemberAccessException

line 293

__callStatic

public static void __callStatic ($name, $args)

Call to undefined static method.

Input
$name
$args
Output
void  
Throws
throws MemberAccessException

line 380

__clone

public void __clone ()

Creates a modifiable clone of the object.

Overridden in child classes as:

Output
void  

line 306

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

__isset

public bool __isset (string $name)

Is property defined?

Overridden in child classes as:

Input
string $name property name
Output
bool  

line 318

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

__unset

public void __unset ($name)

Access to undeclared property.

Overridden in child classes as:

Input
$name
Output
void  
Throws
throws MemberAccessException