Class AbstractContainer

Summary

Fully Qualified Name: Zend\Navigation\AbstractContainer
Implements: Countable, RecursiveIterator

Description

Zend\Navigation\Container

AbstractContainer class for Zend\Navigation\Page classes.

Methods

Name Description Defined By
__call() Magic overload: Proxy calls to finder methods AbstractContainer
addPage() Adds a page to the container AbstractContainer
addPages() Adds several pages at once AbstractContainer
count() Returns number of pages in container AbstractContainer
current() Returns current page AbstractContainer
findAllBy() Returns all child pages matching $property == $value, or an empty array if no pages are found AbstractContainer
findBy() Returns page(s) matching $property == $value AbstractContainer
findOneBy() Returns a child page matching $property == $value, or null if not found AbstractContainer
getChildren() Returns the child container. AbstractContainer
getPages() Returns pages in the container AbstractContainer
hasChildren() Proxy to hasPages() AbstractContainer
hasPage() Checks if the container has the given page AbstractContainer
hasPages() Returns true if container contains any pages AbstractContainer
key() Returns hash code of current page AbstractContainer
next() Moves index pointer to next page in the container AbstractContainer
notifyOrderUpdated() Notifies container that the order of pages are updated AbstractContainer
removePage() Removes the given page from the container AbstractContainer
removePages() Removes all pages in container AbstractContainer
rewind() Sets index pointer to first page in the container AbstractContainer
setPages() Sets pages this container should have, removing existing pages AbstractContainer
toArray() Returns an array representation of all pages in container AbstractContainer
valid() Checks if container index is valid AbstractContainer

Method Details

__call()

Magic overload: Proxy calls to finder methods

Examples of finder calls: // METHOD // SAME AS $nav->findByLabel('foo'); // $nav->findOneBy('label', 'foo'); $nav->findOneByLabel('foo'); // $nav->findOneBy('label', 'foo'); $nav->findAllByClass('foo'); // $nav->findAllBy('class', 'foo');

Parameter Name Type Description
$method string method
$arguments array method

Returns:

addPage()

Adds a page to the container

This method will inject the container as the given page's parent by calling {@link Page\AbstractPage::setParent()}.

Parameter Name Type Description
$page \Page\AbstractPage|array|\Traversable page

Returns: self fluent interface, returns self

addPages()

Adds several pages at once

Parameter Name Type Description
$pages array|\Traversable|\AbstractContainer pages

Returns: self fluent interface, returns self

count()

Returns number of pages in container

Implements Countable interface.

Returns: int number of pages in the container

current()

Returns current page

Implements RecursiveIterator interface.

Returns: \Page\AbstractPage current page or null

findAllBy()

Returns all child pages matching $property == $value, or an empty array if no pages are found

Parameter Name Type Description
$property string name
$value mixed value

Returns: array array containing only Page\AbstractPage instances

findBy()

Returns page(s) matching $property == $value

Parameter Name Type Description
$property string name
$value mixed value
$all bool [optional]

Returns: \Page\AbstractPage|null matching page or null

findOneBy()

Returns a child page matching $property == $value, or null if not found

Parameter Name Type Description
$property string name
$value mixed value

Returns: \Page\AbstractPage|null matching page or null

getChildren()

Returns the child container.

Implements RecursiveIterator interface.

Returns: \Page\AbstractPage|null

getPages()

Returns pages in the container

Returns: array array of Page\AbstractPage instances

hasChildren()

Proxy to hasPages()

Implements RecursiveIterator interface.

Returns: bool whether container has any pages

hasPage()

Checks if the container has the given page

Parameter Name Type Description
$page \Page\AbstractPage page
$recursive bool [optional]

Returns: bool whether page is in container

hasPages()

Returns true if container contains any pages

Parameter Name Type Description
$onlyVisible bool whether

Returns: bool whether container has any pages

key()

Returns hash code of current page

Implements RecursiveIterator interface.

Returns: string hash code of current page

next()

Moves index pointer to next page in the container

Implements RecursiveIterator interface.

Returns: void

notifyOrderUpdated()

Notifies container that the order of pages are updated

Returns: void

removePage()

Removes the given page from the container

Parameter Name Type Description
$page \Page\AbstractPage|int page
$recursive bool [optional]

Returns: bool whether the removal was successful

removePages()

Removes all pages in container

Returns: self fluent interface, returns self

rewind()

Sets index pointer to first page in the container

Implements RecursiveIterator interface.

Returns: void

setPages()

Sets pages this container should have, removing existing pages

Parameter Name Type Description
$pages array pages

Returns: self fluent interface, returns self

toArray()

Returns an array representation of all pages in container

Returns: array

valid()

Checks if container index is valid

Implements RecursiveIterator interface.

Returns: bool

Top