Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 29 changed files with 329 additions and 583 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"homepage": "https://github.com/zendframework/zend-navigation",
"autoload": {
"psr-4": {
"Zend\\Navigation": "src/"
"Zend\\Navigation\\": "src/"
}
},
"require": {
Expand Down
53 changes: 21 additions & 32 deletions src/AbstractContainer.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Navigation;

use Countable,
RecursiveIterator,
RecursiveIteratorIterator,
Traversable,
Zend\Stdlib\ArrayUtils;
use Countable;
use RecursiveIterator;
use RecursiveIteratorIterator;
use Traversable;
use Zend\Stdlib\ErrorHandler;

/**
* Zend_Navigation_Container
Expand All @@ -33,10 +23,8 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class AbstractContainer implements RecursiveIterator, Countable
abstract class AbstractContainer implements Countable, RecursiveIterator
{
/**
* Contains sub pages
Expand Down Expand Up @@ -166,7 +154,7 @@ public function addPages($pages)
);
}

// Because adding a page to a container removes it from the original
// Because adding a page to a container removes it from the original
// (see {@link Page\AbstractPage::setParent()}), iteration of the
// original container will break. As such, we need to iterate the
// container into an array first.
Expand Down Expand Up @@ -249,7 +237,7 @@ public function removePages()
* Checks if the container has the given page
*
* @param Page\AbstractPage $page page to look for
* @param bool $recursive [optional] whether to search recursively.
* @param bool $recursive [optional] whether to search recursively.
* Default is false.
* @return bool whether page is in container
*/
Expand Down Expand Up @@ -360,17 +348,18 @@ public function findBy($property, $value, $all = false)
*/
public function __call($method, $arguments)
{
if (@preg_match('/(find(?:One|All)?By)(.+)/', $method, $match)) {
return $this->{$match[1]}($match[2], $arguments[0]);
}

throw new Exception\BadMethodCallException(
sprintf(
ErrorHandler::start(E_WARNING);
$result = preg_match('/(find(?:One|All)?By)(.+)/', $method, $match);
$error = ErrorHandler::stop();
if (!$result) {
throw new Exception\BadMethodCallException(sprintf(
'Bad method call: Unknown method %s::%s',
get_called_class(),
$method
)
);
), 0, $error);
}
return $this->{$match[1]}($match[2], $arguments[0]);

}

/**
Expand Down
28 changes: 7 additions & 21 deletions src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
*/

namespace Zend\Navigation\Exception;
Expand All @@ -27,10 +16,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class BadMethodCallException
extends \BadMethodCallException
implements ExceptionInterface
class BadMethodCallException extends \BadMethodCallException implements
ExceptionInterface
{}
27 changes: 6 additions & 21 deletions src/Exception/DomainException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
*/

namespace Zend\Navigation\Exception;
Expand All @@ -27,10 +16,6 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class DomainException
extends \DomainException
implements ExceptionInterface
class DomainException extends \DomainException implements ExceptionInterface
{}
22 changes: 5 additions & 17 deletions src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
*/

namespace Zend\Navigation\Exception;
Expand All @@ -25,8 +15,6 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface ExceptionInterface
{
Expand Down
28 changes: 7 additions & 21 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
*/

namespace Zend\Navigation\Exception;
Expand All @@ -27,10 +16,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements ExceptionInterface
class InvalidArgumentException extends \InvalidArgumentException implements
ExceptionInterface
{}
27 changes: 6 additions & 21 deletions src/Exception/OutOfBoundsException.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
*/

namespace Zend\Navigation\Exception;
Expand All @@ -27,10 +16,6 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Exception
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class OutOfBoundsException
extends \OutOfBoundsException
implements ExceptionInterface
class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface
{}
22 changes: 5 additions & 17 deletions src/Navigation.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
<?php
/**
* Zend Framework
* Zend Framework (http://framework.zend.com/)
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Navigation
*/

namespace Zend\Navigation;
Expand All @@ -27,8 +17,6 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Navigation extends AbstractContainer
{
Expand Down
Loading

0 comments on commit 6c02989

Please sign in to comment.