<?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;
		}

    }