<commit_before><?php

abstract class CM_Migration_Script extends CM_Provision_Script_Abstract {

    use CM_Provision_Script_IsLoadedTrait;

    /** @var CM_Migration_Model|null */
    private $_record;

    public function __construct(CM_Service_Manager $serviceManager) {
        $this->_record = null;
        parent::__construct($serviceManager);
    }

    /**
     * @param CM_OutputStream_Interface|null $output
     */
    public function load(CM_OutputStream_Interface $output = null) {
        $this->up();
        $this->_getRecord()->setExecStamp((new DateTime())->setTimestamp(time()));
    }

    abstract public function up();

    protected function _isLoaded() {
        return $this->_getRecord()->hasExecStamp();
    }

    /**
     * @return CM_Migration_Model
     */
    protected function _getRecord() {
        if (!$this->_record) {
            $this->_record = $this->_fetchRecord();
        }
        return $this->_record;
    }

    /**
     * @return CM_Migration_Model
     */
    protected function _fetchRecord() {
        $record = CM_Migration_Model::findByName($this->getName());
        if (!$record) {
            $record = CM_Migration_Model::create($this->getName());
        }
        return $record;
    }
}
<commit_msg>Get description from CM_Migration_Script::up docu<commit_after><?php

abstract class CM_Migration_Script extends CM_Provision_Script_Abstract {

    use CM_Provision_Script_IsLoadedTrait;

    /** @var CM_Migration_Model|null */
    private $_record;

    public function __construct(CM_Service_Manager $serviceManager) {
        $this->_record = null;
        parent::__construct($serviceManager);
    }

    abstract public function up();

    /**
     * @param CM_OutputStream_Interface|null $output
     */
    public function load(CM_OutputStream_Interface $output = null) {
        $this->up();
        $this->_getRecord()->setExecStamp((new DateTime())->setTimestamp(time()));
    }

    /**
     * @return string|null
     */
    public function getDescription() {
        $reflector = new ReflectionClass(get_class($this));
        $doc = $reflector->getMethod('up')->getDocComment();
        if ($doc && preg_match('/\*[ ]+([\S ]+)/', $doc, $matches)) {
            return $matches[1];
        }
        return null;
    }

    protected function _isLoaded() {
        return $this->_getRecord()->hasExecStamp();
    }

    /**
     * @return CM_Migration_Model
     */
    protected function _getRecord() {
        if (!$this->_record) {
            $this->_record = $this->_fetchRecord();
        }
        return $this->_record;
    }

    /**
     * @return CM_Migration_Model
     */
    protected function _fetchRecord() {
        $record = CM_Migration_Model::findByName($this->getName());
        if (!$record) {
            $record = CM_Migration_Model::create($this->getName());
        }
        return $record;
    }
}

{'fraction_non_alphanumeric': 0.13882190837065106, 'fraction_numerical': 0.0003444712366517396, 'mean_word_length': 2.607453416149068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '4800118', 'n_tokens_mistral': 826, 'n_tokens_neox': 827, 'n_words': 150}