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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
| <?php
/**
* Description of Investisseur
*
*/
class Investisseur extends Contact implements \JsonSerializable{
const MAX_SIZE_ADRESSE = 70;
const MAX_SIZE_TVA = 45;
/**
* @var string
*/
private $_num_tva;
/**
* Liste des visites de maison par l'investisseur
* @var array[VisiteMaisonInvestisseur]
*/
private $_visites;
/**
*
* @var array[LettreMission]
*/
private $_lettres_mission;
/**
*
* @var array[Offre]
*/
private $_offres;
/**
*
* @var array[Projet]
*/
private $_projets;
/**
*
* @param int $id
* @param string $nom
* @param string $prenom
* @param string $num_telephone
* @param string $num_gsm
* @param string $num_fax
* @param string $mail
* @param Adresse $adresse
* @param Etat $etat
* @param string $num_tva
* @param string $commentaire
* @param array[VisiteMaisonLocataire] $visites Liste des maisons visitées par l'investisseur
* @param array[LettreMission] $lettres_mission
* @param array[Offre] $offres
* @param array[Projet] $projets
* @throws BadTypeException
* @throws StringAttributeTooLong
*/
public function __construct($id = NULL, $nom = NULL, $prenom = NULL,
$num_telephone = NULL, $num_gsm = NULL, $mail = NULL, $adresse = NULL,
$etat = NULL, $num_tva = NULL, $commentaire = NULL, $visites = NULL,
$lettres_mission = NULL, $offres = NULL, $projets = NULL) {
parent::__construct($id, $nom, $prenom, $num_telephone, $num_gsm, $mail,
$commentaire, $etat, $adresse);
$this->setNumTva($num_tva);
$this->setVisites($visites);
$this->setLettresMission($lettres_mission);
$this->setOffres($offres);
$this->setProjets($projets);
}
/**
*
* @return string
*/
public function getNumTva() {
return $this->_num_tva;
}
/**
*
* @param string $num_tva
* @throws BadTypeException
* @throws StringAttributeTooLong
*/
public function setNumTva($num_tva) {
$_num_tva = CheckTyper::isString($num_tva, 'num_tva', __CLASS__);
if(strlen($_num_tva) > self::MAX_SIZE_TVA) {
throw new StringAttributeTooLong('num_tva', __CLASS__);
}
$this->_num_tva = $_num_tva;
}
//<editor-fold defaultstate="collapsed" desc="Visites">
/**
*
* @return array[VisiteMaisonInvestisseur]
*/
public function getVisites() {
return $this->_visites;
}
/**
*
* @param array[VisiteMaisonInvestisseur] $visites
* @throws BadTypeException
*/
public function setVisites($visites)
{
$this->_visites = CheckTyper::isArrayOfModel($visites,
VisiteMaisonInvestisseur::class, 'visites', __CLASS__);
}
/**
*
* @param int $id index de la valeur dans le tableau
* @return VisiteMaisonInvestisseur
* @throws ReadOusideArrayException
*/
public function getVisite($id) {
if($id < count($this->_visites)) {
return $this->_visites[$id];
}
throw new ReadOusideArrayException('visites', __CLASS__);
}
/**
*
* @param VisiteMaisonInvestisseur $visite
* @throws BadTypeException
*/
public function addVisite($visite) {
$this->_visites[] = CheckTyper::isModel($visite,
VisiteMaisonInvestisseur::class, 'visites', __CLASS__);
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Lettres mission">
/**
*
* @return array[LettreMission]
*/
public function getLettresMission() {
return $this->_lettres_mission;
}
/**
*
* @param array[LettreMission] $lettres_mission
* @throws BadTypeException
*/
public function setLettresMission($lettres_mission) {
$this->_lettres_mission = CheckTyper::isArrayOfModel($lettres_mission,
LettreMission::class, 'lettres mission', __CLASS__);
}
/**
*
* @param int $id index de la valeur dans le tableau
* @return LettreMission
* @throws ReadOusideArrayException
*/
public function getLettreMission($id) {
if($id < count($this->_visites)) {
return $this->_visites[$id];
}
throw new ReadOusideArrayException('lettres mission', __CLASS__);
}
/**
*
* @param LettreMission $lettre_mission
* @throws BadTypeException
*/
public function addLettreMission($lettre_mission) {
$this->_lettres_mission[] = CheckTyper::isModel($lettre_mission,
LettreMission::class, 'lettres mission', __CLASS__);
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Offres">
/**
*
* @return array[Offre]
*/
public function getOffres() {
return $this->_offres;
}
/**
*
* @param array[Offre] $offres
* @throws BadTypeException
*/
public function setOffres($offres) {
$this->_offres = CheckTyper::isArrayOfModel($offres, Offre::class,
'offres', __CLASS__);
}
/**
*
* @param int $id index de la valeur dans le tableau
* @return Offre
* @throws ReadOusideArrayException
*/
public function getOffre($id) {
if($id < count($this->_offres)) {
return $this->_offres[$id];
}
throw new ReadOusideArrayException('offres', __CLASS__);
}
/**
*
* @param Offre $offre
* @throws BadTypeException
*/
public function addOffre($offre) {
$this->_offres[] = CheckTyper::isModel($offre, Offre::class,
'offres', __CLASS__);
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Projets">
/**
*
* @return array[Projet]
*/
public function getProjets() {
return $this->_projets;
}
/**
*
* @param array[Projet] $projets
* @throws BadTypeException
*/
public function setProjets($projets) {
$this->_projets = CheckTyper::isArrayOfModel($projets, Projet::class,
'projets', __CLASS__);
}
/**
*
* @param int $id index de la valeur dans le tableau
* @return Projet
* @throws ReadOusideArrayException
*/
public function getProjet($id) {
if($id < count($this->_projets)) {
return $this->_projets[$id];
}
throw new ReadOusideArrayException('projets', __CLASS__);
}
/**
*
* @param Projet $projet
* @throws BadTypeException
*/
public function addProjet($projet) {
$this->_projets[] = CheckTyper::isModel($projet, Projet::class,
'projets', __CLASS__);
}
//</editor-fold>
public function jsonSerialize() {
return array_merge(parent::jsonSerialize(),
array(
'num_tva' => $this->getNumTva(),
));
}
} |
Partager