<commit_before><?php
/**
 * Instantiate a model.
 *
 * @param  string $modelSuffix
 * @return Garp_Model_Db
 */
function model(string $modelSuffix) {
    return instance("Model_{$modelSuffix}");
}

/**
 * Grab the rendered output of a snippet.
 *
 * @param  string $identifier
 * @return string
 */
function snippet(string $identifier): string {
    $snippet = model('Snippet')->fetchByIdentifier($identifier);
    if (!$snippet) {
        return $identifier;
    }
    return strval(
        $snippet->has_html
        ? $snippet->html
        : $snippet->text
    );
}

/**
 * Quick access to the view.
 *
 * @return Zend_View_Abstract
 */
function view(): Zend_View_Abstract {
    return Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
}

/**
 * Render a partial.
 *
 * @param  string $filename
 * @param  array  $params
 * @param  string $module
 * @return string
 */
function partial(string $filename, array $params = [], string $module = 'default'): string {
    return view()->partial($filename, $module, $params);<commit_msg>Fix for snippet function in case of multilinguality<commit_after><?php
/**
 * Instantiate a model.
 *
 * @param  string $modelSuffix
 * @return Garp_Model_Db
 */
function model(string $modelSuffix) {
    return instance("Model_{$modelSuffix}");
}

/**
 * Grab the rendered output of a snippet.
 *
 * @param  string $identifier
 * @return string
 */
function snippet(string $identifier): string {
    $model = model('Snippet');
    if ($model->isMultilingual()) {
        $model = (new Garp_I18n_ModelFactory())->getModel('Snippet');
    }
    $snippet = $model->fetchByIdentifier($identifier);
    if (!$snippet) {
        return $identifier;
    }
    return strval(
        $snippet->has_html
        ? $snippet->html
        : $snippet->text
    );
}

/**
 * Quick access to the view.
 *
 * @return Zend_View_Abstract
 */
function view(): Zend_View_Abstract {
    return Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
}

/**
 * Render a partial.
 *
 * @param  string $filename
 * @param  array  $params
 * @param  string $module
 * @return string
 */
function partial(string $filename, array $params = [], string $module = 'default'): string {
    return view()->partial($filename, $module, $params);
{'fraction_non_alphanumeric': 0.1456607064980375, 'fraction_numerical': 0.0008722197993894462, 'mean_word_length': 3.5425742574257426, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '6405095', 'n_tokens_mistral': 706, 'n_tokens_neox': 693, 'n_words': 173}