[FrameworkBundle] fix routing descriptor for options
This commit is contained in:
parent
8d07449414
commit
b0c29a0c18
|
@ -56,7 +56,7 @@ class MarkdownDescriptor extends Descriptor
|
|||
."\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'])
|
||||
|
|
|
@ -79,7 +79,7 @@ class TextDescriptor extends Descriptor
|
|||
'<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()),
|
||||
);
|
||||
|
||||
|
@ -306,6 +306,10 @@ class TextDescriptor extends Descriptor
|
|||
*/
|
||||
private function formatRouterConfig(array $array)
|
||||
{
|
||||
if (!count($array)) {
|
||||
return 'NONE';
|
||||
}
|
||||
|
||||
$string = '';
|
||||
ksort($array);
|
||||
foreach ($array as $name => $value) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
Reference in New Issue