From 64ac1605b6fe8e997134dd57cc30f30b99ebc076 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Wed, 29 Jan 2020 02:34:50 +0100 Subject: refactor : item abstract class new Item abstract class with hydrate and dry functions to clean others --- app/class/Media.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'app/class/Media.php') diff --git a/app/class/Media.php b/app/class/Media.php index 0be2013..5d61bf1 100644 --- a/app/class/Media.php +++ b/app/class/Media.php @@ -2,7 +2,7 @@ namespace Wcms; -class Media +class Media extends Item { private $id; private $path; @@ -27,18 +27,6 @@ class Media $this->hydrate($donnees); } - public function hydrate(array $donnees) - { - foreach ($donnees as $key => $value) { - $method = 'set' . $key; - - if (method_exists($this, $method)) { - $this->$method($value); - } - } - } - - public function analyse() { $this->settype(); -- cgit v1.2.3