<commit_before><?php
abstract class Vpc_News_List_Abstract_Component extends Vpc_Abstract_Composite_Component implements Vpc_Paging_ParentInterface
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['childComponentClasses']['paging'] = 'Vpc_News_List_Abstract_Paging_Component';
        $ret['childComponentClasses']['view'] = 'Vpc_News_List_Abstract_View_Component';
        return $ret;
    }

    abstract public function getNewsComponent();

    protected function _getNewsTable()
    {
        return $this->getNewsComponent()->getComponent()->getTable();
    }


    protected function _selectNews()
    {
        $select = $this->_getNewsTable()->select()
            ->from($this->_getNewsTable())
            ->where('component_id = ?', $this->getNewsComponent()->db_id)
            ->where('publish_date <= NOW()');
        if (Vpc_Abstract::getSetting($this->getNewsComponent()->component_class, 'enableExpireDate')) {
            $select->where('expiry_date >= NOW()');
        }
        if (!$this->_showInvisible()) {
            $select->where('visible = 1');
        }
        return $select;
    }

    public function getNews($limit = null, $start = null)
    {
        $select = $this->_selectNews();
        if (!$limit && !$start) {
            $l = $this->getTreeCacheRow()->findChildComponent('-paging')
                ->current()->getComponent()->getLimit();
            $limit = $l['limit'];
            $start = $l['start'];
        }
        $select->limit($limit, $start);
        $select->order('publish_date DESC');
        return $this->_getNewsTable()->fetchAll($select);
    }

    public function getNewsRow($news_id)
    {
        return $this->_getNewsTable()->find($news_id)->current();
    }

    public function getPagingCount()
    {
        $select = $this->_selectNews();
        $select->setIntegrityCheck(false);<commit_msg>möglichkeit bei getNewsComponent null urückzugeben<commit_after><?php
abstract class Vpc_News_List_Abstract_Component extends Vpc_Abstract_Composite_Component
            implements Vpc_Paging_ParentInterface
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['childComponentClasses']['paging'] = 'Vpc_News_List_Abstract_Paging_Component';
        $ret['childComponentClasses']['view'] = 'Vpc_News_List_Abstract_View_Component';
        return $ret;
    }

    abstract public function getNewsComponent();

    protected function _getNewsTable()
    {
        return $this->getNewsComponent()->getComponent()->getTable();
    }


    protected function _selectNews()
    {
        $newsComponent = $this->getNewsComponent();
        if (!$newsComponent) return null;
        $select = $this->_getNewsTable()->select()
            ->from($this->_getNewsTable())
            ->where('component_id = ?', $newsComponent->db_id)
            ->where('publish_date <= NOW()');
        if (Vpc_Abstract::getSetting($this->getNewsComponent()->component_class, 'enableExpireDate')) {
            $select->where('expiry_date >= NOW()');
        }
        if (!$this->_showInvisible()) {
            $select->where('visible = 1');
        }
        return $select;
    }

    public function getNews($limit = null, $start = null)
    {
        $select = $this->_selectNews();
        if (!$select) return array();
        if (!$limit && !$start) {
            $l = $this->getTreeCacheRow()->findChildComponent('-paging')
                ->current()->getComponent()->getLimit();
            $limit = $l['limit'];
            $start = $l['start'];
        }
        $select->limit($limit, $start);
        $select->order('publish_date DESC');
        return $this->_getNewsTable()->fetchAll($select);
    }

    public function getNewsRow($news_id)
    {
        return $this->_getNewsTable()->find($news_id)->current();
    }

    public function getPagingCount()
    {
        $select = $this->_selectNews();
        if (!$select) return 0;
        $select->setIntegrityCheck(false);
{'fraction_non_alphanumeric': 0.15527488855869243, 'fraction_numerical': 0.0007429420505200594, 'mean_word_length': 2.7818352059925093, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 67, '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': '6942528', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1119, 'n_words': 187}