Skip to content

Commit

Permalink
[FrameworkBundle] fix routing descriptor for options
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Jan 15, 2015
1 parent 8d07449 commit b0c29a0
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
Expand Up @@ -56,7 +56,7 @@ protected function describeRoute(Route $route, array $options = array())
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
."\n".'- Class: '.get_class($route)
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
."\n".'- Requirements: '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM')
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());

$this->write(isset($options['name'])
Expand Down
Expand Up @@ -79,7 +79,7 @@ protected function describeRoute(Route $route, array $options = array())
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
'<comment>Class</comment> '.get_class($route),
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
'<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
'<comment>Requirements</comment> '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM'),
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
);

Expand Down Expand Up @@ -306,6 +306,10 @@ protected function describeContainerParameter($parameter, array $options = array
*/
private function formatRouterConfig(array $array)
{
if (!count($array)) {
return 'NONE';
}

$string = '';
ksort($array);
foreach ($array as $name => $value) {
Expand Down
Expand Up @@ -8,4 +8,8 @@
- Defaults:
- `name`: Joseph
- Requirements:
- `name`: [a-z]+
- `name`: [a-z]+
- Options:
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
- `opt1`: val1
- `opt2`: val2
Expand Up @@ -9,4 +9,4 @@
<comment>Requirements</comment> name: [a-z]+
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
opt1: val1
opt2: val2
opt2: val2
Expand Up @@ -6,4 +6,8 @@
- Method: PUT|POST
- Class: Symfony\Component\Routing\Route
- Defaults: NONE
- Requirements: NONE
- Requirements: NO CUSTOM
- Options:
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
- `opt1`: val1
- `opt2`: val2
Expand Up @@ -5,8 +5,8 @@
<comment>Scheme</comment> http|https
<comment>Method</comment> PUT|POST
<comment>Class</comment> Symfony\Component\Routing\Route
<comment>Defaults</comment>
<comment>Requirements</comment>
<comment>Defaults</comment> NONE
<comment>Requirements</comment> NO CUSTOM
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
opt1: val1
opt2: val2
opt2: val2
Expand Up @@ -12,6 +12,10 @@ route_1
- `name`: Joseph
- Requirements:
- `name`: [a-z]+
- Options:
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
- `opt1`: val1
- `opt2`: val2


route_2
Expand All @@ -25,4 +29,8 @@ route_2
- Method: PUT|POST
- Class: Symfony\Component\Routing\Route
- Defaults: NONE
- Requirements: NONE
- Requirements: NO CUSTOM
- Options:
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
- `opt1`: val1
- `opt2`: val2

0 comments on commit b0c29a0

Please sign in to comment.