<commit_before><?php
/**
 * Create class script
 *
 * This script allows you to quickly and easily generate an empty
 * class based on a skeleton file.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @version $Id$
 */

require_once dirname(__FILE__) . '/../config/global.php';

if (!isset($argv[1])){
	echo 'Error: specify table name' . "\n";
	die();
}

$table = $argv[1];

$db = Database::Get();

$fields = $db->listTableFields(strtolower($table));
$empty_class = file_get_contents('empty_class.txt');
$empty_class = str_replace('%%table_name%%', $table, $empty_class);

$parts = explode('_', $table);
foreach ($parts as $key => $part) {
	$parts[$key] = ucfirst($part);
}

$empty_class = str_replace('%%classname%%', implode('_', $parts), $empty_class);
$directory = dirname(LIB_PATH . '/model/' . implode('/', $parts));
if (!file_exists($directory)) {
	mkdir($directory, 0755, true);
}
$filename = LIB_PATH . '/model/' . implode('/', $parts) . '.php';
file_put_contents($filename, $empty_class);
echo 'Generating ' . $filename . "\n";
<commit_msg>Improve create_class generation<commit_after><?php
/**
 * Create class script
 *
 * This script allows you to quickly and easily generate an empty
 * class based on a skeleton file.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @version $Id$
 */

require_once dirname(__FILE__) . '/../config/global.php';

if (!isset($argv[1])){
	echo 'Error: specify table name' . "\n";
	die();
}

$table = strtolower($argv[1]);

$db = Database::Get();

$fields = $db->listTableFields(strtolower($table));
$empty_class = file_get_contents(dirname(__FILE__) . '/empty_class.txt');
$empty_class = str_replace('%%table_name%%', $table, $empty_class);

$parts = explode('_', $table);
foreach ($parts as $key => $part) {
	$parts[$key] = ucfirst($part);
}

$empty_class = str_replace('%%classname%%', implode('_', $parts), $empty_class);
$directory = dirname(LIB_PATH . '/model/' . implode('/', $parts));
if (!file_exists($directory)) {
	mkdir($directory, 0755, true);
}
$filename = LIB_PATH . '/model/' . implode('/', $parts) . '.php';
file_put_contents($filename, $empty_class);
echo 'Generating ' . $filename . "\n";

{'fraction_non_alphanumeric': 0.2140560404225999, 'fraction_numerical': 0.005512172714745062, 'mean_word_length': 5.100840336134453, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '318969', 'n_tokens_mistral': 762, 'n_tokens_neox': 748, 'n_words': 183}