119 lines
1.9 KiB
PHP
119 lines
1.9 KiB
PHP
<?php
|
|
|
|
class Personne
|
|
{
|
|
/**
|
|
* @var integer $id Identifiant de la personne
|
|
*/
|
|
protected $id;
|
|
|
|
/**
|
|
* @var string $nom Nom
|
|
*/
|
|
protected $nom;
|
|
|
|
/**
|
|
* @var string $prenom Prenom
|
|
*/
|
|
protected $prenom;
|
|
|
|
/**
|
|
* @var DateTime $date Date
|
|
*/
|
|
protected $date;
|
|
|
|
/**
|
|
* @param string $nom Nom du pays
|
|
* @param string $prenom Prenom du pays
|
|
*/
|
|
public function __construct($nom, $prenom)
|
|
{
|
|
$this->setNom($nom);
|
|
$this->setPrenom($prenom);
|
|
}
|
|
|
|
/**
|
|
* @param integer|null $id
|
|
* @return Personne
|
|
*/
|
|
public function setId($id)
|
|
{
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return integer|null
|
|
*/
|
|
public function getId()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @param string $nom
|
|
* @return Personne
|
|
*/
|
|
public function setNom($nom)
|
|
{
|
|
if ('' === trim((string) $nom)) {
|
|
throw new InvalidArgumentException('Le nom ne peut pas être vide.');
|
|
}
|
|
|
|
$this->nom = $nom;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getNom()
|
|
{
|
|
return $this->nom;
|
|
}
|
|
|
|
/**
|
|
* @param string $prenom
|
|
* @return Personne
|
|
*/
|
|
public function setPrenom($prenom)
|
|
{
|
|
if ('' === trim((string) $prenom)) {
|
|
throw new InvalidArgumentException('Le prénom ne peut pas être vide.');
|
|
}
|
|
|
|
$this->prenom = $prenom;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
*/
|
|
public function getPrenom()
|
|
{
|
|
return $this->prenom;
|
|
}
|
|
|
|
/**
|
|
* @param DateTime $date
|
|
* @return Personne
|
|
*/
|
|
public function setDate(DateTime $date)
|
|
{
|
|
$this->date = $date;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return DateTime|null
|
|
*/
|
|
public function getDate()
|
|
{
|
|
return $this->date;
|
|
}
|
|
}
|