mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 17:42:29 -04:00
Enable strict exception type hint checking in PHPStan and add exception type hints
This commit is contained in:
parent
559e4a5e05
commit
c4c8e7353f
26 changed files with 300 additions and 82 deletions
|
@ -2,6 +2,7 @@
|
|||
use function Safe\preg_replace;
|
||||
|
||||
$page = HttpInput::Int(GET, 'page') ?? 1;
|
||||
$pages = 0;
|
||||
$perPage = HttpInput::Int(GET, 'per-page') ?? EBOOKS_PER_PAGE;
|
||||
$query = HttpInput::Str(GET, 'query') ?? '';
|
||||
$tags = HttpInput::GetArray('tags') ?? [];
|
||||
|
@ -9,6 +10,7 @@ $view = ViewType::tryFrom(HttpInput::Str(GET, 'view') ?? '');
|
|||
$sort = EbookSort::tryFrom(HttpInput::Str(GET, 'sort') ?? '');
|
||||
$queryString = '';
|
||||
$queryStringParams = [];
|
||||
$queryStringWithoutPage = '';
|
||||
|
||||
try{
|
||||
if($page <= 0){
|
||||
|
@ -96,6 +98,12 @@ catch(Exceptions\PageOutOfBoundsException){
|
|||
header('Location: ' . $url);
|
||||
exit();
|
||||
}
|
||||
catch(Exceptions\AppException $ex){
|
||||
// Something very unexpected happened, log and emit 500
|
||||
http_response_code(500); // Internal server error
|
||||
Log::WriteErrorLogEntry($ex);
|
||||
exit();
|
||||
}
|
||||
?><?= Template::Header(['title' => $pageTitle, 'highlight' => 'ebooks', 'description' => $pageDescription, 'canonicalUrl' => $canonicalUrl]) ?>
|
||||
<main class="ebooks">
|
||||
<h1><?= $pageHeader ?></h1>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue