<commit_before><?php

class JORK_Mapper_Entity {

    /**
     * @var array
     */
    protected $_table_aliases = array();

    /**
     * @var JORK_Mapping_Schema
     */
    protected $_entity_schema;

    /**
     * @var string
     */
    protected $_entity_alias;

    /**
     *
     * @var DB_Query_Select
     */
    protected $_db_query;

    /**
     * @var JORK_Query_Select
     */
    protected $_jork_query;

    /**
     * The naming service to be used and passed on to the next mappers
     *
     * @var JORK_Naming_Service
     */
    protected $_naming_srv;

    /**
     * the next mappers to be executed on the same row
     *
     * @var array<JORK_Mapper_Component>
     */
    protected $_next_mappers = array();

    public function map_row($db_row) {
        //TODO implement
    }
    

    public function  __construct(JORK_Naming_Service $naming_srv
            , JORK_Query_Select $jork_query
            , DB_Query_Select $db_query
            , $select_item = NULL) {
        $this->_naming_srv = $naming_srv;
        $this->_jork_query = $jork_query;
        $this->_db_query = $db_query;

        $this->_entity_alias = $select_item;

        $this->_entity_schema = $this->_naming_srv->get_schema($this->_entity_alias);

    }

    /**
     * @param string $tbl_name
     * @return string the generated alias
     */
    protected function add_table($tbl_name) {
        $tbl_alias = $this->_table_aliases[$tbl_name]
                = $this->_naming_srv->table_alias($this->_entity_alias, $tbl_name);
        $this->_db_query->tables []= array($tbl_name, $tbl_alias);
        return $tbl_alias;
    }


    /**
     * Adds an atomic property join to the db query
     *
     * @param string $property
     */
    protected  function add_atomic_property($prop_name, &$prop_schema) {
        $tbl_name = array_key_exists('table', $prop_schema)
                ? $prop_schema['table']
                : $this->_entity_schema->table;

        if ( !array_key_exists($tbl_name, $this->_table_aliases)) {
            $tbl_alias = $this->add_table($tbl_name);
        } else {<commit_msg>added helper method JORK_Mapper_Entity::table_alias()<commit_after><?php

class JORK_Mapper_Entity {

    /**
     * @var array
     */
    protected $_table_aliases = array();

    /**
     * @var JORK_Mapping_Schema
     */
    protected $_entity_schema;

    /**
     * @var string
     */
    protected $_entity_alias;

    /**
     *
     * @var DB_Query_Select
     */
    protected $_db_query;

    /**
     * @var JORK_Query_Select
     */
    protected $_jork_query;

    /**
     * The naming service to be used and passed on to the next mappers
     *
     * @var JORK_Naming_Service
     */
    protected $_naming_srv;

    /**
     * the next mappers to be executed on the same row
     *
     * @var array<JORK_Mapper_Component>
     */
    protected $_next_mappers = array();

    public function map_row($db_row) {
        //TODO implement
    }
    

    public function  __construct(JORK_Naming_Service $naming_srv
            , JORK_Query_Select $jork_query
            , DB_Query_Select $db_query
            , $select_item = NULL) {
        $this->_naming_srv = $naming_srv;
        $this->_jork_query = $jork_query;
        $this->_db_query = $db_query;

        $this->_entity_alias = $select_item;

        $this->_entity_schema = $this->_naming_srv->get_schema($this->_entity_alias);

    }

    /**
     * @param string $tbl_name
     * @return string the generated alias
     */
    protected function add_table($tbl_name) {
        $tbl_alias = $this->_table_aliases[$tbl_name]
                = $this->_naming_srv->table_alias($this->_entity_alias, $tbl_name);
        $this->_db_query->tables []= array($tbl_name, $tbl_alias);
        return $tbl_alias;
    }

    /**
     *
     * @param string $tbl_name
     * @return string
     * @see JORK_Naming_Service::table_alias($tbl_name)
     */
    protected function table_alias($tbl_name) {
        return $this->_naming_srv->table_alias($this->_entity_alias, $tbl_name);
    }


    /**
     * Adds an atomic property join to the db query
     *
     * @param string $property
     */
    protected  function add_atomic_property($prop_name, &$prop_schema) {
        $tbl_name = array_key_exists('table', $prop_schema)
                ? $prop_schema['table']
                : $this->_entity_schema->table;

        if ( !array_key_exists($tbl_name, $this->_table_aliases)) {
            $tbl_alias = $this->add_table($tbl_name);
        } else {
{'fraction_non_alphanumeric': 0.12015845070422536, 'fraction_numerical': 0.0, 'mean_word_length': 2.2188385269121813, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 44, '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': '7476535', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1446, 'n_words': 272}