Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AbstractContainer Class Reference

Zend. More...

Public Member Functions

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

Protected Member Functions

 sort ()
 Sorts the page index according to page order.
 

Protected Attributes

 $pages = []
 
 $index = []
 
 $dirtyIndex = false
 

Detailed Description

Zend.

AbstractContainer class for Zend classes.

Member Function Documentation

__call (   $method,
  $arguments 
)

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

Parameters
string$methodmethod name
array$argumentsmethod arguments
Exceptions
Exception\BadMethodCallExceptionif method does not exist
addPage (   $page)

Adds a page to the container.

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

Parameters
Page\AbstractPage | array | Traversable$pagepage to add
Returns
self fluent interface, returns self
Exceptions
Exception\InvalidArgumentExceptionif page is invalid
addPages (   $pages)

Adds several pages at once.

Parameters
array | Traversable | AbstractContainer$pagespages to add
Returns
self fluent interface, returns self
Exceptions
Exception\InvalidArgumentExceptionif $pages is not array, Traversable or AbstractContainer
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 current page or null
Exceptions
Exception\OutOfBoundsExceptionif the index is invalid
findAllBy (   $property,
  $value 
)

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

Parameters
string$propertyname of property to match against
mixed$valuevalue to match property against
Returns
array array containing only Page instances
findBy (   $property,
  $value,
  $all = false 
)

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

Parameters
string$propertyname of property to match against
mixed$valuevalue to match property against
bool$all[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
Page|null matching page or null
findOneBy (   $property,
  $value 
)

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

Parameters
string$propertyname of property to match against
mixed$valuevalue to match property against
Returns
Page|null matching page or null
getChildren ( )

Returns the child container.

Implements RecursiveIterator interface.

Returns
Page|null
getPages ( )

Returns pages in the container.

Returns
array array of Page instances
hasChildren ( )

Proxy to hasPages()

Implements RecursiveIterator interface.

Returns
bool whether container has any pages
hasPage ( Page\AbstractPage  $page,
  $recursive = false 
)

Checks if the container has the given page.

Parameters
Page\AbstractPage$pagepage to look for
bool$recursive[optional] whether to search recursively. Default is false.
Returns
bool whether page is in container
hasPages (   $onlyVisible = false)

Returns true if container contains any pages.

Parameters
bool$onlyVisiblewhether to check only visible pages
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
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 ( array  $pages)

Sets pages this container should have, removing existing pages.

Parameters
array$pagespages to set
Returns
self fluent interface, returns self
sort ( )
protected

Sorts the page index according to page order.

Returns
void
toArray ( )

Returns an array representation of all pages in container.

Returns
array
valid ( )

Checks if container index is valid.

Implements RecursiveIterator interface.

Returns
bool

Member Data Documentation

$dirtyIndex = false
protected
$index = []
protected
$pages = []
protected