/** * Factory pattern to load needed Classes * @param string $filename name of file without extension * @param int $id optional ID of row we want to select * @return \Database This object */ public static function factory($filename, $id = NULL) { Data::newInstance(); $db = new Database(); $db->_data = new Data(); $db->set_informations($filename, $id); $db->xml = simplexml_load_file($db->file); return $db; }