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/User.php | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'app/class/User.php') diff --git a/app/class/User.php b/app/class/User.php index 8712c72..b735309 100644 --- a/app/class/User.php +++ b/app/class/User.php @@ -5,7 +5,7 @@ namespace Wcms; use DateTimeImmutable; use DateTimeZone; -class User +class User extends Item { protected $id; protected $level = 0; @@ -26,27 +26,6 @@ class User } } - public function hydrate($datas = []) - { - foreach ($datas as $key => $value) { - $method = 'set' . $key; - - if (method_exists($this, $method)) { - $this->$method($value); - } - } - } - - public function dry() - { - $array = []; - foreach (get_class_vars(__class__) as $var => $value) { - $array[$var] = $this->$var(); - } - return $array; - } - - // _________________________ G E T _______________________ public function id() -- cgit v1.2.3