[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".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
|
||||||
."\n".'- Class: '.get_class($route)
|
."\n".'- Class: '.get_class($route)
|
||||||
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
|
."\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());
|
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
|
||||||
|
|
||||||
$this->write(isset($options['name'])
|
$this->write(isset($options['name'])
|
||||||
|
@ -79,7 +79,7 @@ class TextDescriptor extends Descriptor
|
|||||||
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
|
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
|
||||||
'<comment>Class</comment> '.get_class($route),
|
'<comment>Class</comment> '.get_class($route),
|
||||||
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
|
'<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()),
|
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -306,6 +306,10 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
private function formatRouterConfig(array $array)
|
private function formatRouterConfig(array $array)
|
||||||
{
|
{
|
||||||
|
if (!count($array)) {
|
||||||
|
return 'NONE';
|
||||||
|
}
|
||||||
|
|
||||||
$string = '';
|
$string = '';
|
||||||
ksort($array);
|
ksort($array);
|
||||||
foreach ($array as $name => $value) {
|
foreach ($array as $name => $value) {
|
||||||
|
@ -9,3 +9,7 @@
|
|||||||
- `name`: Joseph
|
- `name`: Joseph
|
||||||
- Requirements:
|
- Requirements:
|
||||||
- `name`: [a-z]+
|
- `name`: [a-z]+
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
@ -6,4 +6,8 @@
|
|||||||
- Method: PUT|POST
|
- Method: PUT|POST
|
||||||
- Class: Symfony\Component\Routing\Route
|
- Class: Symfony\Component\Routing\Route
|
||||||
- Defaults: NONE
|
- 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>Scheme</comment> http|https
|
||||||
<comment>Method</comment> PUT|POST
|
<comment>Method</comment> PUT|POST
|
||||||
<comment>Class</comment> Symfony\Component\Routing\Route
|
<comment>Class</comment> Symfony\Component\Routing\Route
|
||||||
<comment>Defaults</comment>
|
<comment>Defaults</comment> NONE
|
||||||
<comment>Requirements</comment>
|
<comment>Requirements</comment> NO CUSTOM
|
||||||
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
|
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
|
||||||
opt1: val1
|
opt1: val1
|
||||||
opt2: val2
|
opt2: val2
|
@ -12,6 +12,10 @@ route_1
|
|||||||
- `name`: Joseph
|
- `name`: Joseph
|
||||||
- Requirements:
|
- Requirements:
|
||||||
- `name`: [a-z]+
|
- `name`: [a-z]+
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
|
||||||
|
|
||||||
route_2
|
route_2
|
||||||
@ -25,4 +29,8 @@ route_2
|
|||||||
- Method: PUT|POST
|
- Method: PUT|POST
|
||||||
- Class: Symfony\Component\Routing\Route
|
- Class: Symfony\Component\Routing\Route
|
||||||
- Defaults: NONE
|
- Defaults: NONE
|
||||||
- Requirements: NONE
|
- Requirements: NO CUSTOM
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
Reference in New Issue
Block a user