<commit_before><?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of mapper
 *
 * @author JaViS
 */
class Mapper {

    static protected $driver = null;

    static protected $registered_drivers = array(
        'mysql' => 'MySQLMapperDriver',
    );

    static public function register_driver($drivername, $classname){
        self::$registered_drivers[$drivername] = $classname;
    }

    static public function set_driver(IMapperDriver $driver) {
        self::$driver = $driver;
    }

    static protected function setup() {
        if (self::$driver == null) {
            $drivername = DB::get_pdolink()->getAttribute(PDO::ATTR_DRIVER_NAME);
            
            if (array_key_exists($drivername, self::$registered_drivers)){
                $classname = self::$registered_drivers[$drivername];
                self::set_driver(new $classname());    
            }
            else{
                self::set_driver(new SQLMapperDriver());    
            }
        }
    }

    static public function save($object) {
        self::setup();
        return self::$driver->save($object);
    }

    static public function insert($object) {
        self::setup();
        return self::$driver->insert($object);
    }

    static public function update($object) {
        self::setup();
        return self::$driver->update($object);
    }

    static public function delete($object, $delete_childs=true) {
        self::setup();
        return self::$driver->delete($object, $delete_childs);
    }

    static public function count($classname, $conditions=null) {
        self::setup();
        return self::$driver->count($classname, $conditions );
    }

    static public function get_by_id($classname, $id) {
        self::setup();
        return self::$driver->get_by_id($classname, $id);
    }

    static public function get($classname, $conditions=null, $order_by=null) {
        self::setup();
        $args = func_get_args();
        return call_user_func_array(array(self::$driver, "get"), $args);
        //return self::$driver->get($classname, $conditions , $order_by );
    }

    static public function _load_relationship($object, $property_name) {
        self::setup();
        return self::$driver->_load_relationship($object, $property_name);
    }

}
?><commit_msg>Tooltip updated<commit_after><?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of mapper
 *
 * @author JaViS
 */
class Mapper {

    static protected $driver = null;

    static protected $registered_drivers = array(
        'mysql' => 'MySQLMapperDriver',
    );

    static public function register_driver($drivername, $classname){
        self::$registered_drivers[$drivername] = $classname;
    }

    static public function set_driver(IMapperDriver $driver) {
        self::$driver = $driver;
    }

    static protected function setup() {
        if (self::$driver == null) {
            $drivername = DB::get_pdolink()->getAttribute(PDO::ATTR_DRIVER_NAME);
            
            if (array_key_exists($drivername, self::$registered_drivers)){
                $classname = self::$registered_drivers[$drivername];
                self::set_driver(new $classname());    
            }
            else{
                self::set_driver(new SQLMapperDriver());    
            }
        }
    }

    static public function save($object) {
        self::setup();
        return self::$driver->save($object);
    }

    static public function insert($object) {
        self::setup();
        return self::$driver->insert($object);
    }

    static public function update($object) {
        self::setup();
        return self::$driver->update($object);
    }

    static public function delete($object, $delete_childs=true) {
        self::setup();
        return self::$driver->delete($object, $delete_childs);
    }

    static public function count($classname, $conditions=null) {
        self::setup();
        return self::$driver->count($classname, $conditions );
    }

    static public function get_by_id($classname, $id) {
        self::setup();
        return self::$driver->get_by_id($classname, $id);
    }

    static public function get($classname, $conditions=null, $order_by=null, $limit = null, $offset = null) {
        self::setup();
        $args = func_get_args();
        return call_user_func_array(array(self::$driver, "get"), $args);
        //return self::$driver->get($classname, $conditions , $order_by );
    }

    static public function _load_relationship($object, $property_name) {
        self::setup();
        return self::$driver->_load_relationship($object, $property_name);
    }

}
?>
{'fraction_non_alphanumeric': 0.14031413612565444, 'fraction_numerical': 0.0, 'mean_word_length': 2.702325581395349, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '326643', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1336, 'n_words': 283}