<?php
declare(strict_types=1);
use Authentication\Exception\AuthenticationException;
use Authentication\UserAuthentication;
use Html\AppWebPage;
$authentication = new UserAuthentication();
$p = new AppWebPage('Authentification');
try {
$user = $authentication->getUserFromAuth();
$p->appendContent(<<<HTML
<div>Bonjour {$user->getFirstName()}</div>
HTML
);
} catch (AuthenticationException $e) {
$p->appendContent("Échec d'authentification : {$e->getMessage()}");
} catch (Exception $e) {
$p->appendContent("Un problème est survenu : {$e->getMessage()}");
}
echo $p->toHTML();