$_REQUEST, 'get' => $_GET, 'post' => $_POST, 'cookie' => $_COOKIE ]; $ajax = $this->isAjax(); foreach ($list as $key => $value) { $data = new Collection(); $data->import($value); parent::set($key, $data); } $data = new Collection(); $data->import($GLOBALS['_FILES']); parent::set('files', $data); } function _get($key) { return parent::get($key); } /** * @param T $key * @return mixed */ function get($key, $default = null) { return parent::get('data')->get($key, $default); } function session(Session $value = null) { if ($value) { $this->_session = $value; } return $this->_session; } function set($key, $value/*: any*/) { parent::get('data')->set($key, $value); } function export($key = 'data') { return parent::get($key)->export(); } function clear() { return parent::get('data')->clear(); } /** * Allow access to data stored in GET, POST and COOKIE super globals. * * @param string $var * @param string $key * @return mixed */ public function getRawData($var, $key) { $data = parent::get(strtolower($var)); if ($data) { return $data->get($key); } return null; } public function setRawData($var, $key, $val) { $data = parent::get(strtolower($var)); if ($data) { return $data->set($key, $val); } } public function setAction($name) { $this->setRawData('get', 'action', $name); } public function getAction() { $result = $this->getRawData('get', 'action'); return ($result) ? $result : 'index'; } public function isAjax() { return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); } public function redirect($url) { header('location: ' . $url); exit(); } static function getProtocol() { return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; } }