Maarten Bday 2019
Code
class Whoops
{
private $sorry = 'Sorry sorry sorry sorry sorry';
private $finish = 'Alsnog van harte gefeliciteerd!';
private $name;
public function __construct( string $name ) {
$this->name = $name;
}
public function get_forgot_lines( string $reason ) {
$lines = [
$this->name . '!',
$this->sorry,
'Ik was door ' . $reason . ' helemaal vergeten dat je jarig was geweest!',
$this->finish,
];
return $lines;
}
public function display_lines( array $lines ) {
foreach ( $lines as $line_index => $line ) {
if ( $line_index > 0 ) {
echo '<br/>';
}
echo $line;
}
}
}
$whoops_class = new Whoops( 'Maarten' );
$lines = $whoops_class->get_forgot_lines( 'wat medisch gedoe' );
$whoops_class->display_lines( $lines );
Result
Maarten!
Sorry sorry sorry sorry sorry
Ik was door wat medisch gedoe helemaal vergeten dat je jarig was geweest!
Alsnog van harte gefeliciteerd!