Регистр файлов
This commit is contained in:
parent
4fd0187ea6
commit
c8958cbee0
83 changed files with 25 additions and 53 deletions
|
|
@ -1,99 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Коллекция
|
||||
*
|
||||
*/
|
||||
class Collection implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Holds collective request data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* Преобразование массива в коллекцию
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function import(array $data)
|
||||
{
|
||||
$this->data = array_merge($this->data, $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Преобразование коллекции в массив
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store "request data" in GPC order.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set(/*.string.*/$key, /*.any.*/$value)
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read stored "request data" by referencing a key.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
return isset($this->data[$key]) && $this->data[$key] != '' ? $this->data[$key] : $default;
|
||||
}
|
||||
|
||||
public function getInt($key, $default = 0)
|
||||
{
|
||||
return intval($this->get($key, $default));
|
||||
}
|
||||
|
||||
public function getString($key, $default = '')
|
||||
{
|
||||
return ((string) $this->get($key, $default));
|
||||
}
|
||||
|
||||
public function getNat($key, $default = 1)
|
||||
{
|
||||
$result = intval($this->get($key, $default));
|
||||
return (($result > 0) ? $result : $default);
|
||||
}
|
||||
|
||||
public function clear()
|
||||
{
|
||||
$this->data = array();
|
||||
}
|
||||
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return isset($this->data[$key]);
|
||||
}
|
||||
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
unset($this->data[$key]);
|
||||
}
|
||||
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return isset($this->data[$key]) ? $this->data[$key] : null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue