public function getLetterAddress($params = array())
{
if (!isset($params['patient'])) {
throw new Exception('Patient must be passed for GP contacts.');
}
$contact = $address = null;
if ($params['patient']->practice) {
if (@$params['contact']) {
$contactRelation = $params['contact'];
$contact = $params['patient']->practice->{$contactRelation};
} else {
$contact = $params['patient']->practice->contact;
}
$address = $contact->address;
}
return $this->formatLetterAddress($contact, $address, $params);
}