Class ComponentContainer (namespace Nette)


ComponentContainer is default implementation of IComponentContainer.

Object
   |
   --Component
      |
      --ComponentContainer

Implements interfaces:

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /ComponentContainer.php (line 36)
Public Method Summary
void
addComponent (IComponent $component, string $name, [string $insertBefore = NULL])
Adds the specified component to the IComponentContainer.
IComponent|NULL
getComponent (string $name, [bool $need = TRUE])
Returns component specified by name or path.
ArrayIterator
getComponents ([bool $deep = FALSE], [string $filterType = NULL])
Iterates over a components.
void
removeComponent (IComponent $component)
Removes a component from the IComponentContainer.
void
__clone ()
Object cloning.
Protected Method Summary
protected void
createComponent (string $name)
Component factory. Descendant can override this method to enable lazy component loading.
protected void
Descendant can override this method to disallow insert a child by throwing an \InvalidStateException.
Methods Inherited From Component
__construct(), attached(), detached(), getName(), getParent(), getService(), getServiceLocator(), lookup(), lookupPath(), monitor(), setParent(), setServiceLocator(), validateParent(), __clone(), __wakeup()
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()

Method Details

line 58

addComponent

public void addComponent (IComponent $component, string $name, [string $insertBefore = NULL])

Adds the specified component to the IComponentContainer.

Overridden in child classes as:

Input
IComponent $component
string $name
string $insertBefore
Output
void  
Throws
throws InvalidStateException

line 165

createComponent

protected void createComponent (string $name)

Component factory. Descendant can override this method to enable lazy component loading.

Input
string $name component name
Output
void  

line 135

getComponent

public IComponent|NULL getComponent (string $name, [bool $need = TRUE])

Returns component specified by name or path.

Input
string $name
bool $need throw exception if component doesn't exist?
Output
IComponent|NULL  

line 177

getComponents

public ArrayIterator getComponents ([bool $deep = FALSE], [string $filterType = NULL])

Iterates over a components.

Input
bool $deep recursive?
string $filterType class types filter
Output
ArrayIterator  

line 116

removeComponent

public void removeComponent (IComponent $component)

Removes a component from the IComponentContainer.

Input
IComponent $component
Output
void  

line 199

validateChildComponent

protected void validateChildComponent (IComponent $child)

Descendant can override this method to disallow insert a child by throwing an \InvalidStateException.

Input
IComponent $child
Output
void  
Throws
throws InvalidStateException

line 212

__clone

public void __clone ()

Object cloning.

Output
void