From a25fd4dbf42e0efb7e8526f0745b04b856097c07 Mon Sep 17 00:00:00 2001 From: SofianeLasri <alasri250@gmail.com> Date: Mon, 3 Oct 2022 09:14:29 +0200 Subject: [PATCH] Constructeurs. --- TP4/ex1/modele/Adherent.php | 20 ++++++++++++++++++++ TP4/ex1/modele/Categorie.php | 12 ++++++++++++ TP4/ex1/modele/Genre.php | 10 ++++++++++ TP4/ex1/modele/Livre.php | 14 ++++++++++++++ TP4/ex1/modele/Nationalite.php | 12 ++++++++++++ 5 files changed, 68 insertions(+) diff --git a/TP4/ex1/modele/Adherent.php b/TP4/ex1/modele/Adherent.php index f3fb2d3..4441f93 100644 --- a/TP4/ex1/modele/Adherent.php +++ b/TP4/ex1/modele/Adherent.php @@ -13,6 +13,26 @@ class Adherent private DateTime $dateAdhesion; private int $numCategorie; + /** + * @param string $login + * @param string $mdp + * @param string $nomAdherent + * @param string $prenomAdherent + * @param string $email + * @param DateTime $dateAdhesion + * @param int $numCategorie + */ + public function __construct(string $login, string $mdp, string $nomAdherent, string $prenomAdherent, string $email, DateTime $dateAdhesion, int $numCategorie) + { + $this->login = $login; + $this->mdp = $mdp; + $this->nomAdherent = $nomAdherent; + $this->prenomAdherent = $prenomAdherent; + $this->email = $email; + $this->dateAdhesion = $dateAdhesion; + $this->numCategorie = $numCategorie; + } + /** * @return string */ diff --git a/TP4/ex1/modele/Categorie.php b/TP4/ex1/modele/Categorie.php index 7764096..cc90eab 100644 --- a/TP4/ex1/modele/Categorie.php +++ b/TP4/ex1/modele/Categorie.php @@ -9,6 +9,18 @@ class Categorie private string $libelle; private int $nbLivresAutorises; + /** + * @param int $numCategorie + * @param string $libelle + * @param int $nbLivresAutorises + */ + public function __construct(int $numCategorie, string $libelle, int $nbLivresAutorises) + { + $this->numCategorie = $numCategorie; + $this->libelle = $libelle; + $this->nbLivresAutorises = $nbLivresAutorises; + } + /** * @return int */ diff --git a/TP4/ex1/modele/Genre.php b/TP4/ex1/modele/Genre.php index 947ebf3..2c953d4 100644 --- a/TP4/ex1/modele/Genre.php +++ b/TP4/ex1/modele/Genre.php @@ -5,6 +5,16 @@ class Genre private int $numGenre; private string $intitule; + /** + * @param int $numGenre + * @param string $intitule + */ + public function __construct(int $numGenre, string $intitule) + { + $this->numGenre = $numGenre; + $this->intitule = $intitule; + } + /** * @return int */ diff --git a/TP4/ex1/modele/Livre.php b/TP4/ex1/modele/Livre.php index 6e0d8e0..0cccdf3 100644 --- a/TP4/ex1/modele/Livre.php +++ b/TP4/ex1/modele/Livre.php @@ -7,6 +7,20 @@ class Livre private int $anneeParution; private int $numGenre; + /** + * @param int $numLivre + * @param string $titre + * @param int $anneeParution + * @param int $numGenre + */ + public function __construct(int $numLivre, string $titre, int $anneeParution, int $numGenre) + { + $this->nulLibre = $numLivre; + $this->titre = $titre; + $this->anneeParution = $anneeParution; + $this->numGenre = $numGenre; + } + /** * @return int */ diff --git a/TP4/ex1/modele/Nationalite.php b/TP4/ex1/modele/Nationalite.php index dc8063f..aee6ad6 100644 --- a/TP4/ex1/modele/Nationalite.php +++ b/TP4/ex1/modele/Nationalite.php @@ -6,6 +6,18 @@ class Nationalite private string $pays; private string $abrege; + /** + * @param int $numNationalite + * @param string $pays + * @param string $abrege + */ + public function __construct(int $numNationalite, string $pays, string $abrege) + { + $this->numNationalite = $numNationalite; + $this->pays = $pays; + $this->abrege = $abrege; + } + /** * @return int */ -- GitLab