<commit_before><?php

class Model_User {
    private $_id, $_name, $_password;
    private static $_manager;
    
    function __construct($id = null) {
        self::init();
        if(is_null($id)) {
            $this->_id = null;
            $this->_name=null;
            $this->_password=<PASSWORD>;
        }
        else {
            $user = self::$_manager->getUser($id);
            $this->_id = $user['id'];
            $this->_name=$user['username'];
            $this->_password=$user['password'];
        }
    }

    private static function init() {
        if(!is_object(self::$_manager)) self::$_manager = new Pdo_User();
    }
    
    public function getId() {
        return $this->_id;
    }

    public function setId($id) {
        $this->_id = $id;
    }

    public function getName() {
        return $this->_name;
    }

    public function setName($name) {
        $this->_name = $name;
    }

    public function getPassword() {
        return $this->_password;
    }

    public function setPassword($password) {
        $this->_password = $password;
    }

    public function login($name, $password) {
        return self::$_manager->login($name, $password);
    }
}

?>
<commit_msg>Ajout de la fonction Save<commit_after><?php

class Model_User {
    private $_id, $_name, $_password;
    private static $_manager;
    
    function __construct($id = null) {
        self::init();
        if(is_null($id)) {
            $this->_id = null;
            $this->_name=null;
            $this->_password=<PASSWORD>;
        }
        else {
            $user = self::$_manager->getUser($id);
            $this->_id = $user['id'];
            $this->_name=$user['username'];
            $this->_password=$user['password'];
        }
    }

    private static function init() {
        if(!is_object(self::$_manager)) self::$_manager = new Pdo_User();
    }
    
    public function getId() {
        return $this->_id;
    }

    public function setId($id) {
        $this->_id = $id;
    }

    public function getName() {
        return $this->_name;
    }

    public function setName($name) {
        $this->_name = $name;
    }

    public function getPassword() {
        return $this->_password;
    }

    public function setPassword($password) {
        $this->_password = $password;
    }

    public function login($name, $password) {
        return self::$_manager->login($name, $password);
    }
    
    public function save() {
        if(is_null($this->_id))
            $this->_id = self::$_manager->add_user($this);
        else
            self::$_manager->edit_user($this);
    }
}

?>

{'fraction_non_alphanumeric': 0.15609570831750855, 'fraction_numerical': 0.0, 'mean_word_length': 1.9830124575311439, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '732533', 'n_tokens_mistral': 789, 'n_tokens_neox': 776, 'n_words': 154}