A simple container class for {@link Zend_Navigation_Page} pages

AbstractContainer class for Zend\Navigation\Page classes.

category Zend
package Zend_Navigation

 Methods

Magic overload: Proxy calls to finder methods

__call(string $method, array $arguments) 
Inherited

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');

inherited_from \Zend\Navigation\AbstractContainer::__call()

Parameters

$method

string

method name

$arguments

array

method arguments

Exceptions

\Zend\Navigation\Exception\BadMethodCallException if method does not exist

Creates a new navigation container

__construct(array | \Traversable $pages) 

Parameters

$pages

array\Traversable

[optional] pages to add

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $pages is invalid

Adds a page to the container

addPage(\Zend\Navigation\Page\AbstractPage | array | \Traversable $page) : \Zend\Navigation\AbstractContainer
Inherited

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

inherited_from \Zend\Navigation\AbstractContainer::addPage()

Parameters

$page

\Zend\Navigation\Page\AbstractPagearray\Traversable

page to add

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if page is invalid

Returns

\Zend\Navigation\AbstractContainerfluent interface, returns self

Adds several pages at once

addPages(array | \Traversable | \Zend\Navigation\AbstractContainer $pages) : \Zend\Navigation\AbstractContainer
Inherited

inherited_from \Zend\Navigation\AbstractContainer::addPages()

Parameters

$pages

array\Traversable\Zend\Navigation\AbstractContainer

pages to add

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $pages is not array, Traversable or AbstractContainer

Returns

\Zend\Navigation\AbstractContainerfluent interface, returns self

Returns number of pages in container

count() : int
Inherited

Implements Countable interface.

inherited_from \Zend\Navigation\AbstractContainer::count()

Returns

intnumber of pages in the container

Returns current page

current() : \Zend\Navigation\Page\AbstractPage
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::current()

Exceptions

\Zend\Navigation\Exception\OutOfBoundsException if the index is invalid

Returns

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

findAllBy(string $property, mixed $value) : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::findAllBy()

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

Returns

arrayarray containing only Page\AbstractPage instances

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

findBy(string $property, mixed $value, bool $all) : \Zend\Navigation\Page\AbstractPage | null
Inherited

inherited_from \Zend\Navigation\AbstractContainer::findBy()

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

$all

bool

[optional] whether an array of all matching pages should be returned, or only the first. If true, an array will be returned, even if not matching pages are found. If false, null will be returned if no matching page is found. Default is false.

Returns

\Zend\Navigation\Page\AbstractPagenullmatching page or null

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

findOneBy(string $property, mixed $value) : \Zend\Navigation\Page\AbstractPage | null
Inherited

inherited_from \Zend\Navigation\AbstractContainer::findOneBy()

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

Returns

\Zend\Navigation\Page\AbstractPagenullmatching page or null

Returns the child container.

getChildren() : \Zend\Navigation\Page\AbstractPage | null
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::getChildren()

Returns

Returns pages in the container

getPages() : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::getPages()

Returns

arrayarray of Page\AbstractPage instances

Proxy to hasPages()

hasChildren() : bool
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::hasChildren()

Returns

boolwhether container has any pages

Checks if the container has the given page

hasPage(\Zend\Navigation\Page\AbstractPage $page, bool $recursive) : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::hasPage()

Parameters

$page

\Zend\Navigation\Page\AbstractPage

page to look for

$recursive

bool

[optional] whether to search recursively. Default is false.

Returns

boolwhether page is in container

Returns true if container contains any pages

hasPages() : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::hasPages()

Returns

boolwhether container has any pages

Returns hash code of current page

key() : string
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::key()

Returns

stringhash code of current page

Notifies container that the order of pages are updated

notifyOrderUpdated() : void
Inherited

inherited_from \Zend\Navigation\AbstractContainer::notifyOrderUpdated()

Removes the given page from the container

removePage(\Zend\Navigation\Page\AbstractPage | int $page) : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::removePage()

Parameters

$page

\Zend\Navigation\Page\AbstractPageint

page to remove, either a page instance or a specific page order

Returns

boolwhether the removal was successful

Removes all pages in container

removePages() : \Zend\Navigation\AbstractContainer
Inherited

inherited_from \Zend\Navigation\AbstractContainer::removePages()

Returns

\Zend\Navigation\AbstractContainerfluent interface, returns self

Sets index pointer to first page in the container

rewind() : void
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::rewind()

Sets pages this container should have, removing existing pages

setPages(array $pages) : \Zend\Navigation\AbstractContainer
Inherited

inherited_from \Zend\Navigation\AbstractContainer::setPages()

Parameters

$pages

array

pages to set

Returns

\Zend\Navigation\AbstractContainerfluent interface, returns self

Returns an array representation of all pages in container

toArray() : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::toArray()

Returns

array

Checks if container index is valid

valid() : bool
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::valid()

Returns

bool

Sorts the page index according to page order

sort() : void
Inherited

inherited_from \Zend\Navigation\AbstractContainer::sort()

 Properties

 

Whether index is dirty and needs to be re-arranged

$dirtyIndex : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::$$dirtyIndex
 

An index that contains the order in which to iterate pages

$index : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::$$index
 

Contains sub pages

$pages : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::$$pages