From 9261ede012d3edda638f614494df31e876e8d758 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Tue, 25 Jan 2011 16:50:22 +0100 Subject: [PATCH] Add 'set' and 'bootstrap' methods to Env/Get/Post MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- classes/env.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/classes/env.php b/classes/env.php index 57fe0d9..abfea48 100644 --- a/classes/env.php +++ b/classes/env.php @@ -75,6 +75,18 @@ class Env { return array_map(array('Env', 'v'), $keys); } + + public static function set($key, $value) + { + $_REQUEST[$key] =& $value; + } + + public static function bootstrap($key, $value) + { + if (!Env::has($key)) { + Env::set($key, $value); + } + } } class Post @@ -133,6 +145,18 @@ class Post { return array_map(array('Post', 'v'), $keys); } + + public static function set($key, $value) + { + $_POST[$key] =& $value; + } + + public static function bootstrap($key, $value) + { + if (!Post::has($key)) { + Post::set($key, $value); + } + } } class Get @@ -191,6 +215,18 @@ class Get { return array_map(array('Get', 'v'), $keys); } + + public static function set($key, $value) + { + $_GET[$key] =& $value; + } + + public static function bootstrap($key, $value) + { + if (!Get::has($key)) { + Get::set($key, $value); + } + } } class Cookie -- 2.1.4