<commit_before><?php
namespace codegenerator;

use codegenerator\model\ClassEntity;

class CodeGenerator
{
    public function generateHtml(Request $request, array $modules)
    {
        $html = $this->createTabs($modules);
        $html .= $this->createContent($request, $modules);
        return $html;
    }

    protected function createTabs(array $modules)
    {
        $html = '<ul class="nav nav-tabs">';

        foreach($modules as $index => $module) {
            $obj = new $module();
            $class = $index == 0 ? ' class="active"' : '';
            $html .= '<li' . $class . '><a href="#' . $obj->getName() . '" data-toggle="tab">' . $obj->getName() . '</a></li>';
        }
        $html .= '</ul>';
        return $html;
    }

    protected function createContent(Request $request, $modules)
    {
        $class = ClassEntity::fromRequest($request);

        $html = '<div id="myTabContent" class="tab-content">';

        foreach($modules as $index => $module) {
            $generator = new $module();
            $divClass = $index == 0 ? ' active' : '';

            $html .= '
                <div class="tab-pane fade in' . $divClass . '" id="' . $generator->getName() . '">
                    ' . $generator->generateCode($class) . '
                </div>';
        }

        $html .= '</div>';
        return $html;
    }
}<commit_msg>Fixed bug after config layout change<commit_after><?php
namespace codegenerator;

use codegenerator\generator\AbstractGenerator;
use codegenerator\model\ClassEntity;

class CodeGenerator
{
    public function generateHtml(Request $request, array $modules)
    {
        $html = $this->createTabs($modules);
        $html .= $this->createContent($request, $modules);
        return $html;
    }

    protected function createTabs(array $modules)
    {
        $html = '<ul class="nav nav-tabs">';

        $index = 0;
        foreach($modules as $module => $enabled) {
            $obj = $this->createGenerator($module);
            $class = $index == 0 ? ' class="active"' : '';
            $html .= '<li' . $class . '><a href="#' . $obj->getName() . '" data-toggle="tab">' . $obj->getName() . '</a></li>';
            $index++;
        }
        $html .= '</ul>';
        return $html;
    }

    protected function createContent(Request $request, $modules)
    {
        $class = ClassEntity::fromRequest($request);

        $html = '<div id="myTabContent" class="tab-content">';

        $index = 0;
        foreach($modules as $module => $enabled) {
            $generator = $this->createGenerator($module);
            $divClass = $index == 0 ? ' active' : '';

            $html .= '
                <div class="tab-pane fade in' . $divClass . '" id="' . $generator->getName() . '">
                    ' . $generator->generateCode($class) . '
                </div>';

            $index++;
        }

        $html .= '</div>';
        return $html;
    }

    protected function createGenerator($name)
    {
        if (!class_exists($name)) {
            throw new \Exception("Cannot find codegenerator class '" . $name . "', make sure the class is available and namespace exists");
        }

        $generator = new $name();

        if (!$generator instanceof AbstractGenerator) {
            throw new \Exception("Class '" . $name . "' is not derived from AbstractGenerator");
        }

        return $generator;
    }
}
{'fraction_non_alphanumeric': 0.17170531259172292, 'fraction_numerical': 0.0017610801291458762, 'mean_word_length': 2.04014272970562, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 41, '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': '5611133', 'n_tokens_mistral': 966, 'n_tokens_neox': 932, 'n_words': 226}