<commit_before><?php

abstract class CM_Paging_ContentList_Abstract extends CM_Paging_Abstract implements CM_Typed, CM_ArrayConvertible {

    /**
     * @var int
     */
    private $_type;

    /**
     * @param int $type
     */
    public function __construct($type) {
        $this->_type = (int) $type;
        $source = new CM_PagingSource_Sql_Deferred('string', 'cm_string', '`type`=' . $this->_type, 'string ASC');
        $source->enableCache();
        parent::__construct($source);
    }

    /**
     * @param string $string
     */
    public function add($string) {
        $this->addMultiple([$string]);
    }

    /**
     * @param string[] $stringList
     */
    public function addMultiple(array $stringList) {
        $data = [];
        foreach ($stringList as $string) {
            $data[] = ['type' => $this->_type, 'string' => (string) $string];
        }
        CM_Db_Db::replace('cm_string', ['type', 'string'], $data);
        $this->_change();
    }
<commit_msg>Use map for addMutliple<commit_after><?php

abstract class CM_Paging_ContentList_Abstract extends CM_Paging_Abstract implements CM_Typed, CM_ArrayConvertible {

    /**
     * @var int
     */
    private $_type;

    /**
     * @param int $type
     */
    public function __construct($type) {
        $this->_type = (int) $type;
        $source = new CM_PagingSource_Sql_Deferred('string', 'cm_string', '`type`=' . $this->_type, 'string ASC');
        $source->enableCache();
        parent::__construct($source);
    }

    /**
     * @param string $string
     */
    public function add($string) {
        $this->addMultiple([$string]);
    }

    /**
     * @param string[] $stringList
     */
    public function addMultiple(array $stringList) {
        $data = \Functional\map($stringList, function ($string) {
            return ['type' => $this->_type, 'string' => (string) $string];
        });
        CM_Db_Db::replace('cm_string', ['type', 'string'], $data);
        $this->_change();
    }

{'fraction_non_alphanumeric': 0.16466466466466467, 'fraction_numerical': 0.0, 'mean_word_length': 2.5131810193321615, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '3301755', 'n_tokens_mistral': 614, 'n_tokens_neox': 607, 'n_words': 126}