diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-01-29 02:34:50 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-01-29 02:34:50 +0100 |
commit | 64ac1605b6fe8e997134dd57cc30f30b99ebc076 (patch) | |
tree | d4fd89c68f0f0eb7b49ea92336f8f8ab5f778e45 /app/class/Opt.php | |
parent | b6173772bdef1eaf067573373ab500d67dfc454d (diff) | |
download | wcms-64ac1605b6fe8e997134dd57cc30f30b99ebc076.tar.gz wcms-64ac1605b6fe8e997134dd57cc30f30b99ebc076.zip |
refactor : item abstract class
new Item abstract class with hydrate and dry functions to clean others
Diffstat (limited to 'app/class/Opt.php')
-rw-r--r-- | app/class/Opt.php | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/app/class/Opt.php b/app/class/Opt.php index cbbac02..60dfb65 100644 --- a/app/class/Opt.php +++ b/app/class/Opt.php @@ -2,7 +2,7 @@ namespace Wcms; -class Opt +class Opt extends Item { protected $sortby = 'id'; protected $order = 1; @@ -26,32 +26,8 @@ class Opt $this->hydrate($donnees); } - public function hydrate(array $donnees) - { - foreach ($donnees as $key => $value) { - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($value); - } - } - } - /** - * Return any asked vars and their values of an object as associative array - * - * @param array $vars list of vars - * @return array Associative array `$var => $value` - */ - public function drylist(array $vars) : array - { - $array = []; - foreach ($vars as $var) { - if (property_exists($this, $var)) - $array[$var] = $this->$var; - } - return $array; - } public function resetall() |