<commit_before><?php

	namespace b2db;
	
	/**
	 * B2DB Saveable class, active record implementation for B2DB
	 *
	 * @author <NAME> <<EMAIL>>
	 * @version 2.0
	 * @license http://www.opensource.org/licenses/mozilla1.1.php Mozilla Public License 1.1 (MPL 1.1)
	 * @package b2db
	 * @subpackage core
	 */

	/**
	 * B2DB Saveable class, active record implementation for B2DB
	 * Can be implemented by objects to allow them to be passed to a B2DB table 
	 * class for saving
	 *
	 * @package b2db
	 * @subpackage core
	 */
	class Saveable
	{

		/**
		 * Return the B2DB table name for this class
		 * 
		 * @return string
		 */
		public function getB2DBTableName()
		{
			if (!isset(static::$_b2dbtablename))
			{
				$b2dbtablename = get_class($this).'Table';
				if (!class_exists($b2dbtablename))
				{
					throw new \Exception("Cannot find B2DB table class. Please create or generate the '{$b2dbtablename}' class, or specify a B2DB table name for class " . get_class($this) . ' via the static \$_b2dbtablename property');
				}
			}
			else
			{
				$b2dbtablename = static::$_b2dbtablename;
			}
			return static::$_b2dbtablename;
		}
		
		/**
		 * Return the associated B2DBTable for this class
		 * 
		 * @return Table
		 */
		public function getB2DBTable()
		{
			$b2dbtablename = $this->getB2DBTableName();
			return $b2dbtablename::getTable();
		}

		protected function _getForeignClassForProperty($property_name)
		{
			if (!$foreign_type = Core::getCachedClassPropertyForeignClass(\get_class($this), $property_name))
			{
				$reflection = new \ReflectionProperty(\get_class($this), $property_name);
				$docblock = $reflection->getDocComment();
				if ($docblock)
				{
					$has_b2dbtype = \mb_strpos($docblock, '@Class', 3);
					$no_autopopulate = \mb_strpos($docblock, '@NoAutoPopulation', 3);

					if ($has_b2dbtype !== false && !$no_autopopulate)
					{
						$type_details = \mb_substr($docblock, $has_b2dbtype + 7);
						$type_details = \explode(' ', $type_details);
						$foreign_type = \trim($type_details[0]);
						Core::addCachedClassPropertyForeignClass(\get_class($this), $property_name, $foreign_type);
					}<commit_msg>fix undefined b2dbtablename when not defined<commit_after><?php

	namespace b2db;
	
	/**
	 * B2DB Saveable class, active record implementation for B2DB
	 *
	 * @author <NAME> <<EMAIL>>
	 * @version 2.0
	 * @license http://www.opensource.org/licenses/mozilla1.1.php Mozilla Public License 1.1 (MPL 1.1)
	 * @package b2db
	 * @subpackage core
	 */

	/**
	 * B2DB Saveable class, active record implementation for B2DB
	 * Can be implemented by objects to allow them to be passed to a B2DB table 
	 * class for saving
	 *
	 * @package b2db
	 * @subpackage core
	 */
	class Saveable
	{

		/**
		 * Return the B2DB table name for this class
		 * 
		 * @return string
		 */
		public function getB2DBTableName()
		{
			if (!isset(static::$_b2dbtablename))
			{
				$b2dbtablename = get_class($this).'Table';
				if (!class_exists($b2dbtablename))
				{
					throw new \Exception("Cannot find B2DB table class. Please create or generate the '{$b2dbtablename}' class, or specify a B2DB table name for class " . get_class($this) . ' via the static \$_b2dbtablename property');
				}
			}
			else
			{
				$b2dbtablename = static::$_b2dbtablename;
			}
			return $b2dbtablename;
		}
		
		/**
		 * Return the associated B2DBTable for this class
		 * 
		 * @return Table
		 */
		public function getB2DBTable()
		{
			$b2dbtablename = $this->getB2DBTableName();
			return $b2dbtablename::getTable();
		}

		protected function _getForeignClassForProperty($property_name)
		{
			if (!$foreign_type = Core::getCachedClassPropertyForeignClass(\get_class($this), $property_name))
			{
				$reflection = new \ReflectionProperty(\get_class($this), $property_name);
				$docblock = $reflection->getDocComment();
				if ($docblock)
				{
					$has_b2dbtype = \mb_strpos($docblock, '@Class', 3);
					$no_autopopulate = \mb_strpos($docblock, '@NoAutoPopulation', 3);

					if ($has_b2dbtype !== false && !$no_autopopulate)
					{
						$type_details = \mb_substr($docblock, $has_b2dbtype + 7);
						$type_details = \explode(' ', $type_details);
						$foreign_type = \trim($type_details[0]);
						Core::addCachedClassPropertyForeignClass(\get_class($this), $property_name, $foreign_type);
					}
{'fraction_non_alphanumeric': 0.13003239241092088, 'fraction_numerical': 0.018741323461360482, 'mean_word_length': 3.4844398340248963, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7121802', 'n_tokens_mistral': 1755, 'n_tokens_neox': 1443, 'n_words': 339}