Files
projet_php/entities/mother_entity.php
2026-02-26 00:19:11 +01:00

29 lines
709 B
PHP

<?php
/**
* Classe d'un Mere de tout objet
* @author Yass & Laura
*/
class Entity{
protected string $_prefix = '';
public function hydrate(array $arrData){
foreach($arrData as $key=>$value){
$strMethodName = "set".ucfirst(str_replace($this->_prefix,'',$key));
if (method_exists($this,$strMethodName)){
$this->$strMethodName($value);
}
}
}
protected function nettoyer(string $strText){
$strText = trim($strText);
$strText = str_replace("<script>", "", $strText);
$strText = str_replace("</script>", "", $strText);
return $strText;
}
}