function app($key = null, $value = null)
{
if (null !== $key && null !== $value) {
$GLOBALS['__app'][$key] = $value;
}
return (object) $GLOBALS['__app'];
}
So, I usually have a function like this and I store things like the Request and Session objects to use them anywhere in my application. For example:
app('req', new Request);
and then I use it like this:
app()->req->getMethod();
My question is, what exactly is this? Does this function act as a Service Locator and/or Service Container? I'm trying to document my code and I'm having trouble explaining this code.