/**
* Creates a detailed response array for the given notifications.
*
* param array $httpResponse
* param array $notificationContentModels
*
* @return array
*/
public function handleHttpResponse(
array $httpResponse,
array $notificationContentModels
): array
{
foreach ($httpResponse as $key => $httpResponseDetails) {
// Being pessimistic here.
$wasSuccessful = false;
if ($httpResponseDetails['status'] != 'error') {
$wasSuccessful = true;
} else {
// Set the response message if there is one.
if ($httpResponseDetails['message']
&& strlen($httpResponseDetails['message']) > 0
) {
$notificationContentModels[$key]->setResponseMessage($httpResponseDetails['message']);
}
// Set the response detail if there is one.
if ($httpResponseDetails['details']
&& count($httpResponseDetails['details']) > 0
) {
$notificationContentModels[$key]->setResponseDetails($httpResponseDetails['details']);
}
}
$notificationContentModels[$key]->setWasSuccessful($wasSuccessful);
}
return $notificationContentModels;
}