Skip to content

Commit

Permalink
avoid referencing undefined parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Jun 23, 2024
1 parent 554e59a commit 07714fa
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/AnniversaryCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,20 @@ private function initParameterData()
? (string) self::ALLOWED_RETURN_TYPES[array_search(self::$acceptHeader, self::ALLOWED_ACCEPT_HEADERS)]
: (string) self::ALLOWED_RETURN_TYPES[0]
);
$this->RESPONSE->Messages[] = sprintf(
'Return parameter set to \'%1$s\', response content type set to \'%2$s\'',
$this->parameterData["RETURN"],
self::$responseContentType
);
if (isset($this->parameterData["RETURN"])) {
$message = 'Return parameter set to \'%1$s\', response content type set to \'%2$s\'';
$this->RESPONSE->Messages[] = sprintf(
$message,
$this->parameterData["RETURN"],
self::$responseContentType
);
} else {
$message = 'No return parameter received in the request, response content type set to \'%1$s\'';
$this->RESPONSE->Messages[] = sprintf(
$message,
self::$responseContentType
);
}

if (!isset($this->parameterData["YEAR"]) || $this->parameterData["YEAR"] === "") {
$this->parameterData["YEAR"] = (int)date("Y");
Expand Down

0 comments on commit 07714fa

Please sign in to comment.