/** * Get post value * * @param array $keys * @return string */ public function post(...$keys) { if (!$keys) { return $this->request->values; } elseif (count($keys) === 1) { return $this->request->value($keys[0]); } $values = []; foreach ($keys as $key) { $values[] = $this->request->value($key); } return $values; }
/** * Generate context * * @return Context */ public function context() { $this->logger->debug('kernel.context: generate Context instance'); $request = Request::globals(); $response = new Response(); return new Context($request, $response); }
/** * Generate context * * @return Context */ public static function context() { $request = Http\Request::current(); $response = new Http\Response(); return new Context($request, $response); }
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL & ~E_NOTICE); require 'instance.php'; /** * Authentication setup */ use Colorium\Stateful\Auth; use Pictobox\Model\User; Auth::factory(function ($id) { return User::one(['id' => $id]); }); /** * Debug mode */ use Colorium\Http; $request = Http\Request::globals(); $request->local[] = '10.0.2.2'; if ($request->local()) { $app->catch = false; $handler = new Whoops\Handler\PrettyPageHandler(); $handler->addDataTableCallback('App Request', function () use($request) { return (array) $request; }); $whoops = new Whoops\Run(); $whoops->pushHandler($handler)->register(); } /** * Execute default context */ $app->run()->end();