<commit_before><?php namespace Codesleeve\Fixture\Drivers;

abstract class BaseDriver
{
	/**
	 * Truncate a table.
	 *
	 * @return void
	 */
	public function truncate()
	{
		foreach ($this->tables as $table) {
			$this->db->query("DELETE FROM $table");
		}

		$this->tables = array();
	}

	/**
	 * Generate an integer hash of a string.
	 * We'll use this method to convert a fixture's name into the
	 * primary key of it's corresponding database table record.
	 *
	 * @param  string $value - This should be the name of the fixture.
	 * @return integer
	 */
	protected function generateKey($value)
	{
		$hash = sha1($value);
		$integerHash = base_convert($hash, 16, 10);

		return (int)substr($integerHash, 0, 10);
	}
}<commit_msg>Ensure ID within valid range<commit_after><?php namespace Codesleeve\Fixture\Drivers;

abstract class BaseDriver
{
	/**
	 * Truncate a table.
	 *
	 * @return void
	 */
	public function truncate()
	{
		foreach ($this->tables as $table) {
			$this->db->query("DELETE FROM $table");
		}

		$this->tables = array();
	}

	/**
	 * Generate an integer hash of a string.
	 * We'll use this method to convert a fixture's name into the
	 * primary key of it's corresponding database table record.
	 *
	 * @param  string $value - This should be the name of the fixture.
	 * @return integer
	 */
	protected function generateKey($value)
	{
		$hash = sha1($value);
		$integerHash = base_convert($hash, 16, 10);

		return (int)substr($integerHash, 0, 8);
	}
}
{'fraction_non_alphanumeric': 0.13297150610583447, 'fraction_numerical': 0.0101763907734057, 'mean_word_length': 3.4294294294294296, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2483', 'n_tokens_mistral': 521, 'n_tokens_neox': 457, 'n_words': 154}