Skip to content

Commit

Permalink
Add divider comments to index.php for readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
Potherca committed Aug 23, 2020
1 parent 28a33c0 commit e977a97
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,29 @@
session_start();
ob_start();

// =============================================================================
// Configuration
// -----------------------------------------------------------------------------
$clientIdentifier = 'PDS Interop OAuth Example App';
// =============================================================================


// =============================================================================
// Create Objects from I/O (filesystem, network, globals)
// -----------------------------------------------------------------------------
$request = ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);

$host = vsprintf('%s://%s%s', [
'Scheme' => $request->getUri()->getScheme(),
'Host' => $request->getUri()->getHost(),
'Port' => $request->getUri()->getPort() ? ':'.$request->getUri()->getPort() : '',
]);
/*/ ======================================================================== /*/


// =============================================================================
// Set up routes
// -----------------------------------------------------------------------------
$response = new Response();
$router = new Router();

Expand All @@ -41,11 +52,15 @@
ServerPrefix::RESOURCE => new ResourceRouter($response),
];

array_walk($routes, function ($handler, $route) use (&$router) {
array_walk($routes, static function ($handler, $route) use (&$router) {
$router->group($route, $handler->route());
});
/*/ ======================================================================== /*/


// =============================================================================
// Create response for requested route
// -----------------------------------------------------------------------------
try {
$response = $router->dispatch($request);
} catch (NotFoundException $exception) {
Expand All @@ -69,9 +84,12 @@
$response = $response->withStatus($statusCode);
}
}
/*/ ======================================================================== /*/


// =============================================================================
// Send the response to the browser
// -----------------------------------------------------------------------------
$emitter = new SapiEmitter();

// Any output means a developer mistake (or "bug")
Expand Down

0 comments on commit e977a97

Please sign in to comment.