create env access classes
there is now Env::, Session::, Get::, Post::, Cookie:: classes.
the duplication of code is awful, but is a result of the deficient PHP4 OO design.
it would be a lot better in php5 where 'self' is defined as the current class.
moreover, I used thoses classes in 3 pages for a proof of concept. code become much much clearer !
So i'll go through the entire site and remove direct accesses to POST/GET/REQUESTS/SESSION/COOKIE
note that PHP is not able to parse Session::get('log')->log(foo)
so for thoses exceptions, you have to do instead :
if (Session::has('log')) {
$_SESSION->log(foo);
}
which IMHO remains more readable than
if (isset($_SESSION['log'])) {
$_SESSION->log(foo);
}
purists would even use :
if ($logger = Session::getMixed('log')) {
$logger->log(foo);
}
or some other form that does not use $_SESSION explicitely
PS: maybe I should create a :
WIBBLE::callIfExists('log', Array('func', 'arg1', 'arg2', ...))
but I find that horrible to read. that's why I did'nt implemented it
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-94
14 files changed: