web/lib/Zend/Navigation/Container.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
--- a/web/lib/Zend/Navigation/Container.php	Thu May 07 15:10:09 2015 +0200
+++ b/web/lib/Zend/Navigation/Container.php	Thu May 07 15:16:02 2015 +0200
@@ -14,9 +14,9 @@
  *
  * @category  Zend
  * @package   Zend_Navigation
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  * @license   http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Container.php 25237 2013-01-22 08:32:38Z frosch $
+ * @version    $Id$
  */
 
 /**
@@ -26,7 +26,7 @@
  *
  * @category  Zend
  * @package   Zend_Navigation
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  * @license   http://framework.zend.com/license/new-bsd     New BSD License
  */
 abstract class Zend_Navigation_Container implements RecursiveIterator, Countable
@@ -34,7 +34,7 @@
     /**
      * Contains sub pages
      *
-     * @var array
+     * @var Zend_Navigation_Page[]
      */
     protected $_pages = array();
 
@@ -143,7 +143,7 @@
     /**
      * Adds several pages at once
      *
-     * @param  array|Zend_Config|Zend_Navigation_Container  $pages  pages to add
+     * @param  Zend_Navigation_Page[]|Zend_Config|Zend_Navigation_Container  $pages  pages to add
      * @return Zend_Navigation_Container                    fluent interface,
      *                                                      returns self
      * @throws Zend_Navigation_Exception                    if $pages is not 
@@ -178,7 +178,7 @@
     /**
      * Sets pages this container should have, removing existing pages
      *
-     * @param  array $pages               pages to set
+     * @param  Zend_Navigation_Page[] $pages               pages to set
      * @return Zend_Navigation_Container  fluent interface, returns self
      */
     public function setPages(array $pages)
@@ -190,7 +190,7 @@
     /**
      * Returns pages in the container
      *
-     * @return array  array of Zend_Navigation_Page instances
+     * @return Zend_Navigation_Page[]  array of Zend_Navigation_Page instances
      */
     public function getPages()
     {
@@ -200,12 +200,12 @@
     /**
      * Removes the given page from the container
      *
-     * @param  Zend_Navigation_Page|int $page  page to remove, either a page
-     *                                         instance or a specific page order
-     * @return bool                            whether the removal was
-     *                                         successful
+     * @param  Zend_Navigation_Page|int $page      page to remove, either a page
+     *                                             instance or a specific page order
+     * @param  bool                     $recursive [optional] whether to remove recursively
+     * @return bool whether the removal was successful
      */
-    public function removePage($page)
+    public function removePage($page, $recursive = false)
     {
         if ($page instanceof Zend_Navigation_Page) {
             $hash = $page->hashCode();
@@ -225,6 +225,16 @@
             return true;
         }
 
+        if ($recursive) {
+            /** @var Zend_Navigation_Page $childPage */
+            foreach ($this->_pages as $childPage) {
+                if ($childPage->hasPage($page, true)) {
+                    $childPage->removePage($page, true);
+                    return true;
+                }
+            }
+        }
+
         return false;
     }
 
@@ -349,7 +359,7 @@
      * @param  mixed  $value     value to match property against
      * @param  bool   $useRegex  [optional] if true PHP's preg_match is used.
      *                           Default is false.
-     * @return array             array containing only Zend_Navigation_Page
+     * @return Zend_Navigation_Page[] array containing only Zend_Navigation_Page
      *                           instances
      */
     public function findAllBy($property, $value, $useRegex = false)
@@ -474,7 +484,7 @@
     /**
      * Returns an array representation of all pages in container
      *
-     * @return array
+     * @return Zend_Navigation_Page[]
      */
     public function toArray()
     {