Fixed conflicts added since latest commits

This commit is contained in:
Dave M. 2020-03-31 11:03:02 -04:00
parent 3044b919bc
commit bf3816c3db
3 changed files with 16 additions and 5 deletions

View File

@ -22,7 +22,7 @@ class JsonExtension implements Extension {
switch ($token) { switch ($token) {
case "json.pretty": case "json.pretty":
$flag = \JSON_PRETTY_PRINT; $flag |= \JSON_PRETTY_PRINT;
break; break;
case "json.html": case "json.html":

View File

@ -170,6 +170,17 @@ class UrlExtension implements Extension {
} }
if ( array_key_exists($variable, $arguments) ) {
$value = $arguments[ $item[1] ];
}
else if ( isset($default) ) {
$value = $default;
}
else {
$variable = $item[1];
}
if ( array_key_exists($variable, $arguments) ) { if ( array_key_exists($variable, $arguments) ) {
$value = $arguments[ $item[1] ]; $value = $arguments[ $item[1] ];
} }

View File

@ -49,12 +49,12 @@ class Request implements Extension {
return $variableName === null ? $this->request->getParsedBody() : static::arrayGet($this->request->getParsedBody(), $variableName) ?? $default; return $variableName === null ? $this->request->getParsedBody() : static::arrayGet($this->request->getParsedBody(), $variableName) ?? $default;
} }
public function request(? string $variableName = null) public function request(? string $variableName = null, $default = null)
{ {
return $variableName === null ? array_merge(get(null), post(null)) : $this->post($variableName) ?? $this->get($variableName); return $variableName === null ? array_merge(get(null), post(null)) : $this->post($variableName) ?? $this->get($variableName) ?? $default;
} }
public function server(? string $variableName = null) public function server(? string $variableName = null, $default = null)
{ {
return $variableName === null ? $this->request->getServerParams() : static::arrayGet($this->request->getServerParams(), $variableName) ?? $default; return $variableName === null ? $this->request->getServerParams() : static::arrayGet($this->request->getServerParams(), $variableName) ?? $default;
} }