chore: Аннотации к типам
This commit is contained in:
parent
1e27648a12
commit
e2ba6bd46e
2 changed files with 20 additions and 11 deletions
|
|
@ -7,12 +7,8 @@ namespace ctiso;
|
|||
*/
|
||||
class Collection implements \ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Holds collective request data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array();
|
||||
/** @var array */
|
||||
protected $data = [];
|
||||
|
||||
/**
|
||||
* Преобразование массива в коллекцию
|
||||
|
|
@ -34,8 +30,7 @@ class Collection implements \ArrayAccess
|
|||
}
|
||||
|
||||
/**
|
||||
* Store "request data" in GPC order.
|
||||
*
|
||||
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
|
|
@ -50,7 +45,6 @@ class Collection implements \ArrayAccess
|
|||
* Read stored "request data" by referencing a key.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
|
|
@ -58,12 +52,22 @@ class Collection implements \ArrayAccess
|
|||
return isset($this->data[$key]) && $this->data[$key] != '' ? $this->data[$key] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param int $default
|
||||
* @return int
|
||||
*/
|
||||
public function getInt($key, $default = 0)
|
||||
{
|
||||
return (int)$this->get($key, $default);
|
||||
}
|
||||
|
||||
public function getString($key, $default = '')
|
||||
/**
|
||||
* @param string $key
|
||||
* @param string $default
|
||||
* @return string
|
||||
*/
|
||||
public function getString(string $key, string $default = ''): string
|
||||
{
|
||||
return (string)$this->get($key, $default);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class HttpRequest extends Collection
|
|||
}
|
||||
|
||||
/**
|
||||
* @param T $key
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
function get($key, $default = null)
|
||||
|
|
@ -56,6 +56,11 @@ class HttpRequest extends Collection
|
|||
return parent::get('data')->get($key, $default);
|
||||
}
|
||||
|
||||
function getString(string $key, string $default = ''): string
|
||||
{
|
||||
return parent::get('data')->getString($key, $default);
|
||||
}
|
||||
|
||||
function session(?Session $value = null)
|
||||
{
|
||||
if ($value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue