Removing super globals+case insensitiv get

This commit is contained in:
Dennis Eichhorn 2015-12-27 18:45:03 +01:00
parent 1abd8c271a
commit 95a390f701
2 changed files with 5 additions and 2 deletions

View File

@ -132,11 +132,12 @@ class Request extends RequestAbstract
$this->uri->set($uri['uri']);
}
$this->data = array_change_key_case($this->data, CASE_LOWER);
unset($_FILES);
unset($_GET);
unset($_POST);
unset($_PUT);
unset($_HEAD);
unset($_REQUEST);
$this->path = explode('/', $this->uri->getPath());
$this->l11n->setLanguage($this->path[0]);

View File

@ -175,6 +175,7 @@ abstract class RequestAbstract implements RequestInterface
*/
public function getData($key = null)
{
$key = mb_strtolower($key);
return !isset($key) ? $this->data : $this->data[$key] ?? null;
}
@ -183,6 +184,7 @@ abstract class RequestAbstract implements RequestInterface
*/
public function setData($key, $value, $overwrite = true)
{
$key = mb_strtolower($key);
if ($overwrite || !isset($this->data[$key])) {
$this->data[$key] = $value;
}