<commit_before><?php

/*
 * (c) Smalte - 2012 ~ Until the end of the world...
 *
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 *
 * Thanks a lot to our community!
 *
 * Read LICENSE.md file for more information.
 */

/*
 * Additional note:
 * This file is just used during alpha development
 */

define('INSTALL', true);

require __DIR__.'/bootstrap.php';

define('EOL', '<br />'.PHP_EOL);

// Dump schema in database
$queries = explode(';', file_get_contents(__DIR__.'/db_schema.sql'));
$database = $container->get('database');
$database->exec('SET foreign_key_checks = 0');
foreach ($queries as $query)
{
	$query = trim($query);
	if ($query)
	{
		$database->exec($query);
	}
}

echo '- Dump schema to database'.EOL;

// Add application data
$applications = array(
	array(
		'name'		=> 'FrontOffice',
		'prefix'	=> '',
	),
	array(
		'name'		=> 'BackOffice',
		'prefix'	=> 'admin',

	),
);
foreach ($applications AS $applicationData)
{
	$application = new \Entities\Application();
	foreach ($applicationData as $field => $value)
	{
		$method = 'set'.ucfirst(strtolower($field));
		$application->$method($value);
	}
	$application->setDateCreated(new \DateTime());
	$em->insert($application);

	echo '- Create application "'.$applicationData['name'].'"'.EOL;
}

// Add language data
$languages = array(
	array(
		'id'		=> 'en',
		'name'		=> 'English',
		'isMain'	=> true,
	),
	array(
		'id'		=> 'fr',
		'name'		=> 'French',
		'isMain'	=> false,
	),
);
foreach ($languages AS $languageData)
{
	$language = new \Entities\Language();
	foreach ($languageData as $field => $value)
	{
		$method = 'set'.ucfirst(strtolower($field));
		$language->$method($value);
	}
	$language->setDateCreated(new \DateTime());
	$em->insert($language);

	echo '- Create language "'.$languageData['name'].'"'.EOL;
}

// Add route data
$routes = array(
	array(
		'name'			=> 'foHome',
		'pattern'		=> '/',
		'module'		=> NULL,
		'application'	=> 'FrontOffice',
		'controller'	=> 'Home',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
	),
	array(
		'name'			=> 'foLogin',
		'pattern'		=> '/login',
		'module'		=> NULL,
		'application'	=> 'FrontOffice',
		'controller'	=> 'Login',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
	),
	array(
		'name'			=> 'boHome',
		'pattern'		=> '/',
		'module'		=> NULL,
		'application'	=> 'BackOffice',
		'controller'	=> 'Home',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
	),
	array(
		'name'			=> 'boLogin',
		'pattern'		=> '/login',
		'module'		=> NULL,
		'application'	=> 'BackOffice',
		'controller'	=> 'Login',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
	),
	array(
		'name'			=> 'moSmalteSampleHello',
		'pattern'		=> '/hello',
		'module'		=> 'Smalte\Sample',
		'application'	=> 'FrontOffice',
		'controller'	=> 'Hello',
		'action'		=> 'display',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
	),
	array(
		'name'			=> 'moSmalteSampleComplex',
		'pattern'		=> '/complex/{year}/{number}',
		'module'		=> 'Smalte\Sample',
		'application'	=> 'FrontOffice',
		'controller'	=> 'Complex',
		'action'		=> 'display',
		'requirements'	=> '{"year":"[0-9]{4}","number":"\\\d"}',
		'methods'		=> 'GET',
	),<commit_msg>Add default values<commit_after><?php

/*
 * (c) Smalte - 2012 ~ Until the end of the world...
 *
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 *
 * Thanks a lot to our community!
 *
 * Read LICENSE.md file for more information.
 */

/*
 * Additional note:
 * This file is just used during alpha development
 */

define('INSTALL', true);

require __DIR__.'/bootstrap.php';

define('EOL', '<br />'.PHP_EOL);

// Dump schema in database
$queries = explode(';', file_get_contents(__DIR__.'/db_schema.sql'));
$database = $container->get('database');
$database->exec('SET foreign_key_checks = 0');
foreach ($queries as $query)
{
	$query = trim($query);
	if ($query)
	{
		$database->exec($query);
	}
}

echo '- Dump schema to database'.EOL;

// Add application data
$applications = array(
	array(
		'name'		=> 'FrontOffice',
		'prefix'	=> '',
		'default'	=> true,
	),
	array(
		'name'		=> 'BackOffice',
		'prefix'	=> 'admin',
		'default'	=> false,

	),
);
foreach ($applications AS $applicationData)
{
	$application = new \Entities\Application();
	foreach ($applicationData as $field => $value)
	{
		$method = 'set'.ucfirst(strtolower($field));
		$application->$method($value);
	}
	$application->setDateCreated(new \DateTime());
	$em->insert($application);

	echo '- Create application "'.$applicationData['name'].'"'.EOL;
}

// Add language data
$languages = array(
	array(
		'id'		=> 'en',
		'name'		=> 'English',
		'isMain'	=> true,
	),
	array(
		'id'		=> 'fr',
		'name'		=> 'French',
		'isMain'	=> false,
	),
);
foreach ($languages AS $languageData)
{
	$language = new \Entities\Language();
	foreach ($languageData as $field => $value)
	{
		$method = 'set'.ucfirst(strtolower($field));
		$language->$method($value);
	}
	$language->setDateCreated(new \DateTime());
	$em->insert($language);

	echo '- Create language "'.$languageData['name'].'"'.EOL;
}

// Add route data
$routes = array(
	array(
		'name'			=> 'foHome',
		'pattern'		=> '/',
		'module'		=> NULL,
		'application'	=> 'FrontOffice',
		'controller'	=> 'Home',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
		'default'		=> true,
	),
	array(
		'name'			=> 'foLogin',
		'pattern'		=> '/login',
		'module'		=> NULL,
		'application'	=> 'FrontOffice',
		'controller'	=> 'Login',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
		'default'		=> false,
	),
	array(
		'name'			=> 'boHome',
		'pattern'		=> '/',
		'module'		=> NULL,
		'application'	=> 'BackOffice',
		'controller'	=> 'Home',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
		'default'		=> true,
	),
	array(
		'name'			=> 'boLogin',
		'pattern'		=> '/login',
		'module'		=> NULL,
		'application'	=> 'BackOffice',
		'controller'	=> 'Login',
		'action'		=> 'index',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
		'default'		=> false,
	),
	array(
		'name'			=> 'moSmalteSampleHello',
		'pattern'		=> '/hello',
		'module'		=> 'Smalte\Sample',
		'application'	=> 'FrontOffice',
		'controller'	=> 'Hello',
		'action'		=> 'display',
		'requirements'	=> NULL,
		'methods'		=> 'GET',
		'default'		=> false,
	),
	array(
		'name'			=> 'moSmalteSampleComplex',
		'pattern'		=> '/complex/{year}/{number}',
		'module'		=> 'Smalte\Sample',
		'application'	=> 'FrontOffice',
		'controller'	=> 'Complex',
		'action'		=> 'display',
		'requirements'	=> '{"year":"[0-9]{4}","number":"\\\d"}',
		'methods'		=> 'GET',
		'default'		=> false,
	),
{'fraction_non_alphanumeric': 0.23402366863905325, 'fraction_numerical': 0.002366863905325444, 'mean_word_length': 3.7916371367824238, 'pattern_counts': {'":': 4, '<': 37, '<?xml version=': 0, '>': 181, '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': '1911675', 'n_tokens_mistral': 2801, 'n_tokens_neox': 2660, 'n_words': 532}