I have implemented a request wrapper for v0.7 which is currenty works like this:
$request->get('name');
$request->get('name', 'post');
$request->get('country_id', 'get');
$request->get('HTTP_HOST', 'server');
I'm wondering which is the best way. It could also be done like this:
$request->getPost('name');
$request->getGet('country_id');
$request->getServer('HTTP_HOST');
or:
$post =& $request->get('post');
$get =& $request->get('get');
$cookie =& $request->get('cookie');
$files =& $request->get('files');
$server =& $request->get('get');
Can any one recommend which is the best method to use?
Either of the first two, I use simliar to the 1st one but it does require more typing and greater change of something going wrong.. I would like to see the 2nd one used.. Prehaps like this
$request->getGet('country_id','value if not exist');
$request->getGet('country_id','value if not exist');
Why not:
$post = $request->post;
$get = $request->get;
$cookie = $request->cookie;
$files = $request->files;
....
I think overriding the default getter method is a good idea, because you won't need to write a getter method for every possible property (and opencart is only php5 anyway).
$post = $request->post;
$get = $request->get;
$cookie = $request->cookie;
$files = $request->files;
....
I think overriding the default getter method is a good idea, because you won't need to write a getter method for every possible property (and opencart is only php5 anyway).
Who is online
Users browsing this forum: No registered users and 1 guest