<commit_before><?php
abstract class Kwc_Abstract extends Kwf_Component_Abstract
{
    private $_data;
    protected $_row;
    private $_pdfWriter;
    const LOREM_IPSUM = 'Lorem ipsum vix at error vocibus, sit at autem liber? Qui eu odio moderatius, populo pericula ex his. Mea hinc decore tempor ei, postulant honestatis eum ut. Eos te assum elaboraret, in ius fastidii officiis electram.';

    /**
     * Constructor; don't create component objects directly, always use Kwf_Component_Data::getComponent()
     */
    public function __construct(Kwf_Component_Data $data)
    {
        $this->_data = $data;
        parent::__construct();
        Kwf_Benchmark::count('components', $data->componentClass.' '.$data->componentId);
    }

    public static function validateSettings($settings, $componentClass)
    {
        if (isset($settings['throwHasContentChangedOnRowColumnsUpdate'])
            && $settings['throwHasContentChangedOnRowColumnsUpdate'] === true
        ) {
            throw new Kwf_Exception("throwHasContentChangedOnRowColumnsUpdate for '$componentClass' has to match column");
        }

        if (isset($settings['componentIcon']) && !is_string($settings['componentIcon'])) {
            throw new Kwf_Exception("componentIcon must be string");
        }
    }

    /**
     * Returns the data object of this component
     *
     * @return Kwf_Component_Data
     */
    public function getData()
    {
        return $this->_data;
    }

    /**
     * Returns the dbId of this component
     *
     * shortcut for ::getData()->dbId;
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getDbId()
    {
        return $this->getData()->dbId;
    }

    /**
     * Returns the componentId of this component
     *
     * shortcut for ::getData()->componentId;
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getComponentId()
    {
        return $this->getData()->componentId;
    }

    /**
     * Returns url of this component in the component tree
     *
     * shortcut for ::getData->getPage()->url
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getUrl()
    {
        return $this->getData()->getPage()->url;
    }

    /**
     * Returns page name of this component in the component tree
     *
     * shortcut for ::getData->getPage()->name
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getName()
    {
        return $this->getData()->getPage()->name;
    }

    /**
     * Returns static settings of this component
     *
     * Override to change settings
     *
     * @return array
     */
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['viewCache'] = true;
        $ret['contentSender'] = 'Kwf_Component_Abstract_ContentSender_Default';
        return $ret;
    }

    /**
     * Returns child component classes of a componentclass or a componentData
     *
     * @param string|Kwf_Component_Data if data inherited generators are returned as well
     * @param array Optional filtering (string to get for one generator)
     */
    public static function getChildComponentClasses($class, $select = array())
    {
        $selectType = gettype($select);
        if ($selectType == 'string' && is_string($class)) {
            //simple case no. 1: get from specific generator
            $g = Kwc_Abstract::getSetting($class, 'generators');
            return $g[$select]['component'];
        } else if (!$select && is_string($class)) {
            //simple case no. 2: get 'em all<commit_msg>Return empty array if generator doesn't exist<commit_after><?php
abstract class Kwc_Abstract extends Kwf_Component_Abstract
{
    private $_data;
    protected $_row;
    private $_pdfWriter;
    const LOREM_IPSUM = 'Lorem ipsum vix at error vocibus, sit at autem liber? Qui eu odio moderatius, populo pericula ex his. Mea hinc decore tempor ei, postulant honestatis eum ut. Eos te assum elaboraret, in ius fastidii officiis electram.';

    /**
     * Constructor; don't create component objects directly, always use Kwf_Component_Data::getComponent()
     */
    public function __construct(Kwf_Component_Data $data)
    {
        $this->_data = $data;
        parent::__construct();
        Kwf_Benchmark::count('components', $data->componentClass.' '.$data->componentId);
    }

    public static function validateSettings($settings, $componentClass)
    {
        if (isset($settings['throwHasContentChangedOnRowColumnsUpdate'])
            && $settings['throwHasContentChangedOnRowColumnsUpdate'] === true
        ) {
            throw new Kwf_Exception("throwHasContentChangedOnRowColumnsUpdate for '$componentClass' has to match column");
        }

        if (isset($settings['componentIcon']) && !is_string($settings['componentIcon'])) {
            throw new Kwf_Exception("componentIcon must be string");
        }
    }

    /**
     * Returns the data object of this component
     *
     * @return Kwf_Component_Data
     */
    public function getData()
    {
        return $this->_data;
    }

    /**
     * Returns the dbId of this component
     *
     * shortcut for ::getData()->dbId;
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getDbId()
    {
        return $this->getData()->dbId;
    }

    /**
     * Returns the componentId of this component
     *
     * shortcut for ::getData()->componentId;
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getComponentId()
    {
        return $this->getData()->componentId;
    }

    /**
     * Returns url of this component in the component tree
     *
     * shortcut for ::getData->getPage()->url
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getUrl()
    {
        return $this->getData()->getPage()->url;
    }

    /**
     * Returns page name of this component in the component tree
     *
     * shortcut for ::getData->getPage()->name
     *
     * @return string
     * @internal
     * @deprecated
     */
    public function getName()
    {
        return $this->getData()->getPage()->name;
    }

    /**
     * Returns static settings of this component
     *
     * Override to change settings
     *
     * @return array
     */
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['viewCache'] = true;
        $ret['contentSender'] = 'Kwf_Component_Abstract_ContentSender_Default';
        return $ret;
    }

    /**
     * Returns child component classes of a componentclass or a componentData
     *
     * @param string|Kwf_Component_Data if data inherited generators are returned as well
     * @param array Optional filtering (string to get for one generator)
     */
    public static function getChildComponentClasses($class, $select = array())
    {
        $selectType = gettype($select);
        if ($selectType == 'string' && is_string($class)) {
            //simple case no. 1: get from specific generator
            $g = Kwc_Abstract::getSetting($class, 'generators');
            if (!isset($g[$select])) return array();
            return $g[$select]['component'];
        } else if (!$select && is_string($class)) {
            //simple case no. 2: get 'em all
{'fraction_non_alphanumeric': 0.11446676553862747, 'fraction_numerical': 0.0005393016044222731, 'mean_word_length': 2.420009220839096, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2046029', 'n_tokens_mistral': 2054, 'n_tokens_neox': 2020, 'n_words': 567}