protected function getLetterStringForSide($side)
{
$res = ucfirst($side) . " Eye:\n";
if ($notreatment = $this->{$side . '_no_treatment_reason'}) {
$res .= $notreatment->getLetter_string();
if ($notreatment->other) {
$other = trim($this->{$side . '_no_treatment_reason_other'});
$res .= ' ' . $other;
if (substr_compare($other, '.', strlen($other) - 1) !== 0) {
$res .= '.';
}
}
$res .= "\n";
} else {
if ($treat = $this->{$side . '_treatment'}) {
$res .= 'Treatment: ' . $treat->name . "\n";
}
$res .= 'Diagnosis: ' . $this->{'get' . ucfirst($side) . 'DiagnosisString'}() . "\n";
if ($risks = $this->{$side . '_risks'}) {
$res .= 'Risks: ';
foreach ($risks as $i => $risk) {
if ($i > 0) {
$res .= ', ';
}
$res .= $risk->name;
}
$res .= "\n";
}
if ($comments = $this->{$side . '_comments'}) {
$res .= 'Comments: ' . $comments . "\n";
}
}
return $res;
}