Skip to content

Commit

Permalink
Merge pull request #109 from dawehner/chain_router_interface
Browse files Browse the repository at this point in the history
Add a chain router interface
  • Loading branch information
dbu committed Aug 21, 2014
2 parents 3706f27 + 99afad7 commit eaba61c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changelog
=========

* **2014-08-20**: Added an interface for the ChainRouter
* **2014-06-06**: Updated to PSR-4 autoloading

1.2.0
Expand Down
11 changes: 3 additions & 8 deletions ChainRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @author Henrik Bjornskov <[email protected]>
* @author Magnus Nordlander <[email protected]>
*/
class ChainRouter implements RouterInterface, RequestMatcherInterface, WarmableInterface
class ChainRouter implements ChainRouterInterface, WarmableInterface
{
/**
* @var \Symfony\Component\Routing\RequestContext
Expand Down Expand Up @@ -76,10 +76,7 @@ public function getContext()
}

/**
* Add a Router to the index
*
* @param RouterInterface $router The router instance
* @param integer $priority The priority
* {@inheritdoc}
*/
public function add(RouterInterface $router, $priority = 0)
{
Expand All @@ -92,9 +89,7 @@ public function add(RouterInterface $router, $priority = 0)
}

/**
* Sorts the routers and flattens them.
*
* @return RouterInterface[]
* {@inheritdoc}
*/
public function all()
{
Expand Down
41 changes: 41 additions & 0 deletions ChainRouterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2014 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing;

use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;

/**
* ChainRouterInterface
*
* Allows access to a lot of different routers.
*
* @author Henrik Bjornskov <[email protected]>
* @author Magnus Nordlander <[email protected]>
*/
interface ChainRouterInterface extends RouterInterface, RequestMatcherInterface
{
/**
* Add a Router to the index
*
* @param RouterInterface $router The router instance
* @param integer $priority The priority
*/
public function add(RouterInterface $router, $priority = 0);

/**
* Sorts the routers and flattens them.
*
* @return RouterInterface[]
*/
public function all();
}

0 comments on commit eaba61c

Please sign in to comment.