X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=inc%2Fpoche%2FUser.class.php;h=eaadd3e5bcc7ed343c4617f62a3663e456a0d0bf;hb=44b95cb81deae35f58e0058910afde2f2ffb9a60;hp=ef47730f46a401c2fc2060aecde55eeaf9c7a2ed;hpb=7ce7ec4c942e0a3567858ad0ec8e654000b49a3f;p=github%2Fwallabag%2Fwallabag.git diff --git a/inc/poche/User.class.php b/inc/poche/User.class.php index ef47730f..eaadd3e5 100644 --- a/inc/poche/User.class.php +++ b/inc/poche/User.class.php @@ -1,11 +1,11 @@ + * @category wallabag + * @author Nicolas Lœuillet * @copyright 2013 - * @license http://www.wtfpl.net/ see COPYING file + * @license http://opensource.org/licenses/MIT see COPYING file */ class User @@ -17,17 +17,41 @@ class User public $email; public $config; - function __construct($user) + function __construct($user = array()) { - $this->id = $user['id']; - $this->username = $user['username']; - $this->name = $user['name']; - $this->password = $user['password']; - $this->email = $user['email']; - $this->config = $user['config']; + if ($user != array()) { + $this->id = $user['id']; + $this->username = $user['username']; + $this->name = $user['name']; + $this->password = $user['password']; + $this->email = $user['email']; + $this->config = $user['config']; + } } - function getConfigValue($name) { + public function getId() + { + return $this->id; + } + + public function getUsername() + { + return $this->username; + } + + public function setConfig($config) + { + $this->config = $config; + } + + /** + * Returns configuration entry for a user + * + * @param $name + * @return bool + */ + public function getConfigValue($name) + { return (isset($this->config[$name])) ? $this->config[$name] : FALSE; } } \ No newline at end of file