mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Fix short URL not being produced when some parameters are empty strings
This commit is contained in:
parent
290f467ddd
commit
9fdfd34516
2 changed files with 53 additions and 13 deletions
|
|
@ -147,6 +147,39 @@ class Request
|
|||
return $this->_route_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a request argument.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string|array $value
|
||||
* @return void
|
||||
*/
|
||||
public function set(string $name, $value): void
|
||||
{
|
||||
if ($value === null || $value === '')
|
||||
{
|
||||
unset($this->args[$name]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->args[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all request arguments.
|
||||
*
|
||||
* @param array $args
|
||||
* @return void
|
||||
*/
|
||||
public function setAll(array $args): void
|
||||
{
|
||||
$this->args = array_filter($args, function($item) {
|
||||
return $item !== null && $item !== '';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set route status.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue