/home/comitemissci/htdocs/www/vendor/horizom/routing/Router.php
public function handle(ServerRequestInterface $request): ResponseInterface
{
$routeInfo = $this->dispatcher->dispatch(
$request->getMethod(),
$request->getUri()->getPath()
);
switch ($routeInfo[0]) {
case \FastRoute\Dispatcher::FOUND:
[, $route, $routeArgs] = $routeInfo;
$request = $request
->withAttribute(RouteInterface::class, $route)
->withAttribute(self::ROUTE_ARGS, $routeArgs);
return $route->getPipe()->handle($request);
case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
throw new \Horizom\Routing\Exception\MethodNotAllowedException($routeInfo[1]);
case \FastRoute\Dispatcher::NOT_FOUND:
throw new \Horizom\Routing\Exception\NotFoundException();
default:
throw new \Horizom\Routing\Exception\NotFoundException();
}
}
}
Arguments
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
* @see RequestHandlerInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$step = $this->middlewares[$this->currentStep] ?? null;
if ($step === null) {
throw new RequestHandlerException("Step {$this->currentStep} not found");
}
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
*/
public function __invoke(ServerRequestInterface $request): ResponseInterface
{
return $this->dispatch($request);
}
}
/home/comitemissci/htdocs/www/vendor/middlewares/whoops/src/Whoops.php
$whoops->sendHttpCode(false);
//Catch errors means register whoops globally
if ($this->catchErrors) {
$whoops->register();
$shutdown = function () use ($whoops) {
$whoops->allowQuit(true);
$whoops->writeToOutput(true);
$whoops->sendHttpCode(true);
$method = Run::SHUTDOWN_HANDLER;
$whoops->$method();
};
register_shutdown_function($shutdown);
}
try {
$response = $handler->handle($request);
} catch (\Throwable $exception) {
$response = $this->responseFactory->createResponse(500);
$response->getBody()->write($whoops->$method($exception));
$response = self::updateResponseContentType($response, $whoops);
} finally {
while (ob_get_level() >= $level) {
ob_end_clean();
}
}
if ($this->catchErrors) {
$whoops->unregister();
}
return $response;
}
/**
* Returns the whoops instance or create one.
*/
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
public function add($middleware)
{
$this->middlewares[] = $this->resolver->resolve($middleware);
}
/**
* @see RequestHandlerInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$step = $this->middlewares[$this->currentStep] ?? null;
if ($step === null) {
throw new RequestHandlerException("Step {$this->currentStep} not found");
}
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
/home/comitemissci/htdocs/www/vendor/middlewares/negotiation/src/ContentType.php
if ($format === null) {
if ($this->responseFactory) {
return $this->responseFactory->createResponse(406);
}
$format = $this->defaultFormat;
}
$contentType = $this->formats[$format]['mime-type'][0];
$charset = $this->detectCharset($request) ?: current($this->charsets);
$request = $request
->withHeader('Accept', $contentType)
->withHeader('Accept-Charset', $charset);
if ($this->attribute) {
$request = $request->withAttribute($this->attribute, $format);
}
$response = $handler->handle($request);
if (!$response->hasHeader('Content-Type')) {
$needCharset = !empty($this->formats[$format]['charset']);
if ($needCharset) {
$contentType .= '; charset='.$charset;
}
$response = $response->withHeader('Content-Type', $contentType);
}
if ($this->nosniff && !$response->hasHeader('X-Content-Type-Options')) {
$response = $response->withHeader('X-Content-Type-Options', 'nosniff');
}
return $response;
}
/**
* Returns the format using the file extension.
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
public function add($middleware)
{
$this->middlewares[] = $this->resolver->resolve($middleware);
}
/**
* @see RequestHandlerInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$step = $this->middlewares[$this->currentStep] ?? null;
if ($step === null) {
throw new RequestHandlerException("Step {$this->currentStep} not found");
}
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
/home/comitemissci/htdocs/www/vendor/middlewares/https/src/Https.php
return $this;
}
/**
* Process a request and return a response.
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$uri = $request->getUri();
if (strtolower($uri->getScheme()) !== 'https') {
if ($this->mustRedirect($request)) {
return $this->responseFactory->createResponse(301)
->withHeader('Location', (string) self::withHttps($uri));
}
$request = $request->withUri(self::withHttps($uri));
}
$response = $handler->handle($request);
if (!empty($this->maxAge)) {
$header = sprintf(
'max-age=%d%s%s',
$this->maxAge,
$this->includeSubdomains ? ';includeSubDomains' : '',
$this->preload ? ';preload' : ''
);
$response = $response
->withHeader(self::HEADER, $header);
}
if ($response->hasHeader('Location')) {
$location = parse_url($response->getHeaderLine('Location'));
if (!empty($location['host']) && $location['host'] === $uri->getHost()) {
$location['scheme'] = 'https';
unset($location['port']);
return $response->withHeader('Location', self::unParseUrl($location));
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
public function add($middleware)
{
$this->middlewares[] = $this->resolver->resolve($middleware);
}
/**
* @see RequestHandlerInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$step = $this->middlewares[$this->currentStep] ?? null;
if ($step === null) {
throw new RequestHandlerException("Step {$this->currentStep} not found");
}
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
/home/comitemissci/htdocs/www/vendor/middlewares/www/src/Www.php
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$uri = $request->getUri();
$host = $uri->getHost();
if ($this->www) {
if (self::wwwCanBeAdded($host)) {
$host = sprintf('www.%s', $host);
}
} elseif (strpos($host, 'www.') === 0) {
$host = substr($host, 4);
}
if ($uri->getHost() !== $host) {
return $this->responseFactory->createResponse(301)
->withHeader('Location', (string) $uri->withHost($host));
}
return $handler->handle($request);
}
/**
* Check whether the domain can add a www. subdomain.
*/
private static function wwwCanBeAdded(string $host): bool
{
//is an ip?
if (empty($host) || filter_var($host, FILTER_VALIDATE_IP)) {
return false;
}
//is "localhost" or similar?
$pieces = explode('.', $host);
return count($pieces) > 1 && $pieces[0] !== 'www';
}
}
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
public function add($middleware)
{
$this->middlewares[] = $this->resolver->resolve($middleware);
}
/**
* @see RequestHandlerInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$step = $this->middlewares[$this->currentStep] ?? null;
if ($step === null) {
throw new RequestHandlerException("Step {$this->currentStep} not found");
}
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
/home/comitemissci/htdocs/www/vendor/middlewares/trailing-slash/src/TrailingSlash.php
{
$this->responseFactory = $responseFactory ?: Factory::getResponseFactory();
return $this;
}
/**
* Process a request and return a response.
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$uri = $request->getUri();
$path = $this->normalize($uri->getPath());
if ($this->responseFactory && ($uri->getPath() !== $path)) {
return $this->responseFactory->createResponse(301)
->withHeader('Location', (string) $uri->withPath($path));
}
return $handler->handle($request->withUri($uri->withPath($path)));
}
/**
* Normalize the trailing slash.
*/
private function normalize(string $path): string
{
if ($path === '') {
return '/';
}
if (strlen($path) > 1) {
if ($this->trailingSlash) {
if (substr($path, -1) !== '/' && !pathinfo($path, PATHINFO_EXTENSION)) {
return $path.'/';
}
} else {
return rtrim($path, '/');
}
}
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
public function add($middleware)
{
$this->middlewares[] = $this->resolver->resolve($middleware);
}
/**
* @see RequestHandlerInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$step = $this->middlewares[$this->currentStep] ?? null;
if ($step === null) {
throw new RequestHandlerException("Step {$this->currentStep} not found");
}
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
/home/comitemissci/htdocs/www/vendor/horizom/dispatcher/Dispatcher.php
$this->currentStep++;
if ($step instanceof MiddlewareInterface) {
return $step->process($request, $this);
}
if ($step instanceof RequestHandlerInterface) {
$this->currentStep = 0;
return $step->handle($request);
}
}
/**
* Dispatch the request, return a response.
*/
public function dispatch(ServerRequestInterface $request): ResponseInterface
{
reset($this->middlewares);
return $this->handle($request);
}
/**
* Magic method to execute the dispatcher as a callable
*/
public function __invoke(ServerRequestInterface $request): ResponseInterface
{
return $this->dispatch($request);
}
}
/home/comitemissci/htdocs/www/vendor/horizom/core/App.php
if (config('app.pretty_debug') === true) {
$accepts = $request->getHeader('Accept');
$whoops = new \Whoops\Run();
if (
!empty($accepts) && $accepts[0] === 'application/json' ||
\Whoops\Util\Misc::isAjaxRequest()
) {
$whoops->pushHandler(new \Whoops\Handler\JsonResponseHandler());
} else {
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
}
$this->add(new \Middlewares\Whoops($whoops));
} elseif ($this->errorHandler !== null) {
$this->add(new ErrorHandlingMiddleware($this->errorHandler));
}
$this->add($this->router->getRouter());
$response = $this->dispatcher->dispatch($request);
$this->emit($response);
}
private function emit(ResponseInterface $response)
{
$http_line = sprintf(
'HTTP/%s %s %s',
$response->getProtocolVersion(),
$response->getStatusCode(),
$response->getReasonPhrase()
);
header($http_line, true, $response->getStatusCode());
foreach ($response->getHeaders() as $name => $values) {
foreach ($values as $value) {
header("$name: $value", false);
}
}
/home/comitemissci/htdocs/www/public/index.php
| of the application / container and bootstraps the application so it
| is ready to receive HTTP / Console requests from the environment.
|
*/
$app = require __DIR__ . '/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();