fix: HttpRequest
This commit is contained in:
parent
74aa44bdc0
commit
aa667d2489
2 changed files with 12 additions and 2 deletions
|
|
@ -61,7 +61,7 @@ class Collection implements \ArrayAccess
|
|||
* @param int $default
|
||||
* @return int
|
||||
*/
|
||||
public function getInt($key, $default = 0)
|
||||
public function getInt(string $key, int $default = 0): int
|
||||
{
|
||||
return (int)$this->get($key, $default);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ class Collection implements \ArrayAccess
|
|||
* @param int $default
|
||||
* @return int
|
||||
*/
|
||||
public function getNat($key, $default = 1)
|
||||
public function getNat(string $key, int $default = 1): int
|
||||
{
|
||||
$result = (int)$this->get($key, $default);
|
||||
return (($result > 0) ? $result : $default);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,16 @@ class HttpRequest extends Collection
|
|||
return parent::get('data')->getString($key, $default);
|
||||
}
|
||||
|
||||
function getInt(string $key, int $default = 0): int
|
||||
{
|
||||
return parent::get('data')->getInt($key, $default);
|
||||
}
|
||||
|
||||
function getNat(string $key, int $default = 1): int
|
||||
{
|
||||
return parent::get('data')->getNat($key, $default);
|
||||
}
|
||||
|
||||
function session(?Session $value = null): ?Session
|
||||
{
|
||||
if ($value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue