/** * Runs the request by by dispaching the request via the web core service. * This method will print the resulting output and set http status codes accordingly. * Exceptions will be caught and rendered. */ public function run() { try { $request = $this->getLoops()->getService("request"); $response = $this->getLoops()->getService("response"); $web_core = $this->getLoops()->getService("web_core"); //dispatch request echo $web_core->dispatch($this->url, $request, $response); } catch (Throwable $exception) { http_response_code(500); try { $renderer = $this->getLoops()->getService("renderer"); echo $renderer->render($exception); } catch (Throwable $render_exception) { Misc::displayException($exception); } } }
<?php /** * This file is part of the loops framework. * * @author Lukas <*****@*****.**> * @license https://raw.githubusercontent.com/loopsframework/base/master/LICENSE * @link https://github.com/loopsframework/base */ use Loops\Misc; use Loops\Application\WebApplication; try { $root_dir = realpath(__DIR__ . "/.."); require_once "{$root_dir}/vendor/autoload.php"; $url = $_GET["_url"]; unset($_GET["_url"]); $app = new WebApplication("{$root_dir}/app/", $url); $app->run(); } catch (Exception $e) { Misc::displayException($e); }
<?php use Loops\Misc; use Loops\Application\CliApplication; use Doctrine\ORM\Tools\Console\ConsoleRunner; require_once __DIR__ . "/vendor/autoload.php"; class HelperSetCreator extends CliApplication { public function exec($params) { $entity_manager = $this->getLoops()->getService("doctrine"); return ConsoleRunner::createHelperSet($entity_manager); } } try { return (new HelperSetCreator(__DIR__ . "/../app/"))->run(); } catch (Exception $e) { Misc::displayException($e, FALSE); }