<commit_before><?php

/*
 * README plugin for HiDev
 *
 * @link      https://github.com/hiqdev/hidev-readme
 * @package   hidev-readme
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
 */

namespace hidev\readme\controllers;

use hidev\helpers\Helper;
use Yii;

/**
 * Goal for README.file generation.
 * @author <NAME> <<EMAIL>>
 */
class ReadmeController extends \hidev\controllers\TemplateController
{
    /**
     * @var \Twig_Environment
     */
    protected $_twig;

    /**
     * @var array list of sections to render
     */
    protected $_sections;

    /**
     * Get charset.
     * @return string
     */
    public function getCharset()
    {
        return (isset(Yii::$app->charset) ? Yii::$app->charset : null) ?: mb_internal_encoding();
    }

    public function renderH($title, $char)
    {
        $res = $title . "\n";
        $res .= str_repeat($char, mb_strlen($title, $this->getCharset()));

        return $res . "\n";
    }

    public function renderH1($title)
    {
        return $this->renderH($title, '=');
    }

    public function renderH2($title)
    {
        return $this->renderH($title, '-');
    }

    public function renderText($text)
    {
        $text = trim($text);
<commit_msg>changed rendering headers to #-prefix style<commit_after><?php

/*
 * README plugin for HiDev
 *
 * @link      https://github.com/hiqdev/hidev-readme
 * @package   hidev-readme
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
 */

namespace hidev\readme\controllers;

use hidev\helpers\Helper;
use Yii;

/**
 * Goal for README.file generation.
 * @author <NAME>ev <<EMAIL>>
 */
class ReadmeController extends \hidev\controllers\TemplateController
{
    /**
     * @var \Twig_Environment
     */
    protected $_twig;

    /**
     * @var array list of sections to render
     */
    protected $_sections;

    /**
     * Get charset.
     * @return string
     */
    public function getCharset()
    {
        return (isset(Yii::$app->charset) ? Yii::$app->charset : null) ?: mb_internal_encoding();
    }

    public function renderH($title, $prefix)
    {
        return $prefix . ' ' . $title . "\n";
    }

    public function renderH1($title)
    {
        return $this->renderH($title, '#');
    }

    public function renderH2($title)
    {
        return $this->renderH($title, '##');
    }

    public function renderText($text)
    {
        $text = trim($text);

{'fraction_non_alphanumeric': 0.1537535126455239, 'fraction_numerical': 0.008831794460056202, 'mean_word_length': 2.423076923076923, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 18, 'https://': 2, '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': '2348160', 'n_tokens_mistral': 835, 'n_tokens_neox': 812, 'n_words': 175}