<commit_before><?php
class Kwc_Chained_CopyTarget_PagesGenerator extends Kwc_Root_Category_Cc_Generator
{
    protected function _getChainedGenerator()
    {
        return Kwf_Component_Generator_Abstract::getInstance('Kwc_Root_Category_Component', 'page');
    }

    protected function _getChainedData($data)
    {
        $parentClasses = Kwc_Abstract::getParentClasses($data->componentClass);
        if (in_array('Kwc_Chained_CopyTarget_Component' , $parentClasses)) {
            return $data->getComponent()->getTargetComponent();
        } else {
            return parent::_getChainedData($data);
        }
    }

    protected function _formatConfig($parentData, $row)
    {
        $ret = parent::_formatConfig($parentData, $row);
        $parentClasses = Kwc_Abstract::getParentClasses($parentData->componentClass);
        if (in_array('Kwc_Chained_CopyTarget_Component' , $parentClasses)) {
            $ret['parent'] = $parentData;
        }
        return $ret;
    }
}<commit_msg>CopyTarget_PagesGenerator must be able to handle empty data in _getChainedData()<commit_after><?php
class Kwc_Chained_CopyTarget_PagesGenerator extends Kwc_Root_Category_Cc_Generator
{
    protected function _getChainedGenerator()
    {
        return Kwf_Component_Generator_Abstract::getInstance('Kwc_Root_Category_Component', 'page');
    }

    protected function _getChainedData($data)
    {
        if ($data) {
            $parentClasses = Kwc_Abstract::getParentClasses($data->componentClass);
            if (in_array('Kwc_Chained_CopyTarget_Component' , $parentClasses)) {
                return $data->getComponent()->getTargetComponent();
            }
        }
        return parent::_getChainedData($data);
    }

    protected function _formatConfig($parentData, $row)
    {
        $ret = parent::_formatConfig($parentData, $row);
        $parentClasses = Kwc_Abstract::getParentClasses($parentData->componentClass);
        if (in_array('Kwc_Chained_CopyTarget_Component' , $parentClasses)) {
            $ret['parent'] = $parentData;
        }
        return $ret;
    }
}
{'fraction_non_alphanumeric': 0.1086644327429392, 'fraction_numerical': 0.0, 'mean_word_length': 3.4946236559139785, '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': '6426515', 'n_tokens_mistral': 589, 'n_tokens_neox': 586, 'n_words': 90}