salaire; } public function getPaySlipDate(): string { return $this->date_bulletin_paie; } public function getAllWithWindowFields(): array { $common_data = parent::getAllWithWindowFields(); return array_merge($common_data, [ "Tâche effectuée:" => $this->taches, "Durée du travail:" => $this->duree_travail, "Salaire:" => $this->salaire]); } // setters public function set(string $entry, string $input): void { $input = $this->cleanSpecialChars($input); // possibilité que $input devienne une chaîne vide switch($entry) { case "Tâche effectuée:": $this->setTaches($input); break; case "Durée du travail:": $this->setDureeTravail($input); break; case "Salaire:": $this->setSalaire($input); break; default: // gérer les champ dans Prestation parent::set($entry, $input); } } public function setTaches(string $value): CESU { $this->taches = $value; return($this); } public function setDureeTravail(string $value): CESU { $this->duree_travail = $value; return($this); } public function setSalaire(string $value): CESU { $value = str_replace(',', '.', $value); $this->salaire = (float) $value; return($this); } public function setPaySlipDate(string $date): void // date 'aaaa-mm-jj' (sans heure) { $this->date_bulletin_paie = $date; } private function setAll(array $input): void { $this->taches = $input[0]; $this->duree_travail = $input[1]; $this->salaire = (float)$input[2]; } public function validateForm(array $data_array): bool { if(count($data_array) === 4){ return true; } else{ echo "erreur de CESU::validateForm(), le tableau \$data_array n'a pas la taille attendue.\n"; return false; } } // à mettre plus tard dans une classe mère public function hydrate(array $data_array): void { $this->setModePaiement($data_array[3]); //array_pop($data_array); // supprime la dernière case unset($data_array[3]); $this->setAll($data_array); } }