- Added a new json.html output

- Fixed a bug where post() was defined twice in request. Added server and request too
This commit is contained in:
mcndave committed 2020-03-30 12:20:28 -04:00
1 parent 404d1f4359
commit dcb22fe086
3 files changed
+38 -8

No files matched your search

+18 -3
View File
@@ -162,11 +162,26 @@ class UrlExtension implements Extension {
$search = [];
foreach($matches as $item) {
if ( ! array_key_exists($item[1], $arguments) ) {
throw new \InvalidArgumentException("Argument `{$item[1]}` is missing within required route parameter(s)");
if (strpos($item[1], "=") !== false) {
list($variable, $default) = explode('=', $item[1]);
}
else {
$variable = $item[1];
}
if ( array_key_exists($variable, $arguments) ) {
$value = $arguments[ $item[1] ];
}
else if ( isset($default) ) {
$value = $default;
}
else {
throw new \InvalidArgumentException("Argument `$variable` is missing within required route parameter(s)");
}
$search[ $item[0] ] = $arguments[ $item[1] ];
$search[ $item[0] ] = $value;
unset($arguments[ $item[1] ]);
}