// Ajout du toast à l'élément du conteneur de toasts
toastContainer.appendChild(toast);
classPersonne
{
protectedstring$nom='Dupont';
protectedstring$prenom='Robert';
protectedint$age=42;
protectedAdresse$adresse;
publicfunction__construct()
{
$this->adresse=newAdresse();
}
publicfunctiongetNom():string
{
return$this->nom;
}
// Affichage du toast
//const bsToast = new bootstrap.Toast(toast);
//bsToast.show();
publicfunctiongetPrenom():string
{
return$this->prenom;
// Masquage du toast si ce n'est pas une erreur
if (severity!=='error'){
// setTimeout(() => {
// toast.classList.remove('show');
// }, 3000);
}
publicfunctiongetAge():int
{
return$this->age;
}
publicfunctionisMajeur():bool
{
return$this->age>=18;
}
publicfunctiongetAdresse():Adresse
{
return$this->adresse;
}
}
$personnes=[newPersonne(),newPersonne()];
$(()=>{
toast('mon success est phénoménal et j\'ai envie d\'en parler tout le temps mais ce serait bien trop long à expliquer et patati et patatta','success');
toast('Et voici une info à ne pas rater!!','info');