Commit b510e5a0 authored by Fabien Potencier's avatar Fabien Potencier

moved logic to an internal method

parent 401674e9
......@@ -186,14 +186,15 @@ class ControllerCollection
*
* @return RouteCollection A RouteCollection instance
*/
public function flush($prefix = '', $routes = null)
public function flush($prefix = '')
{
if ($prefix !== '') {
$prefix = '/'.trim(trim($prefix), '/');
return $this->doFlush($prefix, new RouteCollection());
}
if (null === $routes) {
$routes = new RouteCollection();
private function doFlush($prefix, RouteCollection $routes)
{
if ($prefix !== '') {
$prefix = '/'.trim(trim($prefix), '/');
}
foreach ($this->controllers as $controller) {
......@@ -209,7 +210,7 @@ class ControllerCollection
$routes->add($name, $controller->getRoute());
$controller->freeze();
} else {
$routes->addCollection($controller->flush($prefix.$controller->prefix, $routes));
$routes->addCollection($controller->doFlush($prefix.$controller->prefix, $routes));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment