Tweak a session variable name and update comments

This commit is contained in:
Alex Cabal 2024-11-20 16:38:47 -06:00
parent 3050ab7219
commit 11d9d0f44a
12 changed files with 25 additions and 37 deletions

View file

@ -30,7 +30,7 @@ catch(Exceptions\AppException){
<div aria-hidden="true">
<p><?= number_format($pollItem->VoteCount) ?></p>
</div>
<? /* @max must be at least 1, otherwise 0/0 will appear as 100% */ ?>
<? /* `@max` must be at least 1, otherwise 0/0 will appear as 100%. */ ?>
<meter min="0" max="<?= $poll->VoteCount ?: 1 ?>" value="<?= $pollItem->VoteCount ?>"></meter>
</div>
</td>

View file

@ -28,11 +28,11 @@ try{
try{
$vote = PollVote::Get($poll->UrlName, Session::$User->UserId);
// Vote was found, don't allow another vote
// Vote was found, don't allow another vote.
throw new Exceptions\PollVoteExistsException($vote);
}
catch(Exceptions\PollVoteNotFoundException){
// Vote was not found, user is OK to vote
// Vote was not found, user is OK to vote.
}
if($exception){

View file

@ -22,7 +22,7 @@ try{
header('Location: ' . $vote->Url);
}
else{
// Access via Enums\HttpRequestType::Rest api; 201 CREATED with location
// Access via REST API; output `201 Created` with location.
http_response_code(Enums\HttpCode::Created->value);
header('Location: ' . $vote->Url);
}
@ -32,12 +32,12 @@ catch(Exceptions\InvalidPollVoteException $ex){
$_SESSION['vote'] = $vote;
$_SESSION['exception'] = $ex;
// Access via form; 303 redirect to the form, which will emit a 422 Unprocessable Entity
// Access via form; output 303 redirect to the form, which will emit a `422 Unprocessable Entity`.
http_response_code(Enums\HttpCode::SeeOther->value);
header('Location: /polls/' . (HttpInput::Str(GET, 'pollurlname') ?? '') . '/votes/new');
}
else{
// Access via Enums\HttpRequestType::Rest api; 422 Unprocessable Entity
// Access via REST api; `422 Unprocessable Entity`.
http_response_code(Enums\HttpCode::UnprocessableContent->value);
}
}