/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php
$this->handleException($e);
}
if ($methodNotAllowed === true) {
$message = sprintf('Route "%s" or method "%s" not allowed.', $this->request->getUrl()->getPath(), $this->request->getMethod());
$this->handleException(new NotFoundHttpException($message, 403));
}
if (\count($this->request->getLoadedRoutes()) === 0) {
$rewriteUrl = $this->request->getRewriteUrl();
if ($rewriteUrl !== null) {
$message = sprintf('Route not found: "%s" (rewrite from: "%s")', $rewriteUrl, $this->request->getUrl()->getPath());
} else {
$message = sprintf('Route not found: "%s"', $this->request->getUrl()->getPath());
}
$this->debug($message);
return $this->handleException(new NotFoundHttpException($message, 404));
}
return null;
}
/**
* Handle route-rewrite
*
* @param string $key
* @param string $url
* @return string|null
* @throws HttpException
* @throws \Exception
*/
protected function handleRouteRewrite($key, string $url): ?string
{
/* If the request has changed */
if ($this->request->hasPendingRewrite() === false) {
return null;
}
/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php
* @throws \Exception
*/
public function start(): ?string
{
$this->debug('Router starting');
$this->fireEvents(EventHandler::EVENT_INIT);
$this->loadRoutes();
if ($this->csrfVerifier !== null) {
$this->fireEvents(EventHandler::EVENT_RENDER_CSRF, [
'csrfVerifier' => $this->csrfVerifier,
]);
/* Verify csrf token for request */
$this->csrfVerifier->handle($this->request);
}
$output = $this->routeRequest();
$this->fireEvents(EventHandler::EVENT_LOAD, [
'loadedRoutes' => $this->getRequest()->getLoadedRoutes(),
]);
$this->debug('Routing complete');
return $output;
}
/**
* Routes the request
*
* @return string|null
* @throws HttpException
* @throws \Exception
*/
public function routeRequest(): ?string
{
$this->debug('Routing request');
/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/SimpleRouter.php
*/
protected static $response;
/**
* Router instance
* @var Router
*/
protected static $router;
/**
* Start routing
*
* @throws \Pecee\SimpleRouter\Exceptions\NotFoundHttpException
* @throws \Pecee\Http\Middleware\Exceptions\TokenMismatchException
* @throws HttpException
* @throws \Exception
*/
public static function start(): void
{
echo static::router()->start();
}
/**
* Start the routing an return array with debugging-information
*
* @return array
*/
public static function startDebug(): array
{
$routerOutput = null;
try {
ob_start();
static::router()->setDebugEnabled(true)->start();
$routerOutput = ob_get_contents();
ob_end_clean();
} catch (\Exception $e) {
}
// Try to parse library version
/var/www/aikonia/html/index.php
// ABOUT
SimpleRouter::get('/about', 'About@index')->setName('about');
SimpleRouter::get('/cast', 'About@index')->setName('about');
// LINKS
SimpleRouter::get('/links', 'Links@index')->setName('links');
});
// API
SimpleRouter::group(['prefix' => '/api', 'namespace' => 'library\controllers'], function()
{
// PAGE
SimpleRouter::post('/buffer/post', 'Page@post')->setName('postbuffer');
SimpleRouter::post('/page/images', 'Page@getImages')->setName('getimages');
// COMMENT
SimpleRouter::post('/comment/post', 'Comment@post')->setName('postcomment');
});
SimpleRouter::start();