diff options
Diffstat (limited to 'w/class/user.php')
-rw-r--r-- | w/class/user.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/w/class/user.php b/w/class/user.php new file mode 100644 index 0000000..3ed831d --- /dev/null +++ b/w/class/user.php @@ -0,0 +1,37 @@ +<?php + +class User +{ + protected $level = 0; + + public function __construct($datas = []) { + if(!empty($datas)) { + $this->hydrate($datas); + } + } + + public function hydrate(array $datas = []) + { + foreach ($datas as $key => $value) { + $method = 'set' . $key; + + if (method_exists($this, $method)) { + $this->$method($value); + } + } + } + + public function setlevel($level) + { + $this->level = $level; + } + + public function level() + { + return $this->level; + } +} + + + +?>
\ No newline at end of file |