-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonne.php
58 lines (47 loc) · 1.25 KB
/
Personne.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
class Personne {
protected string $_nom;
protected string $_prenom;
protected string $_sexe;
protected DateTime $_naissance;
/*
"protected" = classe déclaré peut être utilisées par la classe et celles qui en hérite
*/
// CONSTRUCT
public function __construct(string $nom,string $prenom, string $sexe, string $naissance) {
$this->_nom = $nom;
$this->_prenom = $prenom;
$this->_sexe = $sexe;
$this->_naissance = new DateTime($naissance);
}
//GETTER
public function getNom() {
return $this->_nom;
}
public function getPrenom() {
return $this->_prenom;
}
public function getSexe() {
return $this->_sexe;
}
public function getNaissance() {
return $this->_naissance;
}
// SETTER
public function setNom(string $NewNom) {
$this->_nom = $NewNom;
}
public function setPrenom(string $NewPrenom) {
$this->_prenom = $NewPrenom;
}
public function setSexe(string $NewSexe) {
$this->_sexe = $NewSexe;
}
public function setNaissance(DateTime $NewNaissance) {
$this->_date = $NewNaissance;
}
// STRING
public function __toString() {
return $this->_prenom." ".$this->_nom;
}
}