<commit_before><?php namespace Archon\IO;

/**
 * @link https://github.com/HWGehring/Archon for the canonical source repository
 * @license https://github.com/HWGehring/Archon/blob/master/LICENSE BSD 3-Clause
 */
final class HTML {

    private $defaultOptions = [
        'readable' => false
    ];

    public function __construct(array $data) {
        $this->data = $data;
    }

    public function render(array $options) {
        $data = $this->data;
        $options = Options::setDefaultOptions($options, $this->defaultOptions);
        $readableOpt = $options['readable'];

        $columns = current($data);
        $columns = array_keys($columns);
        $columns = $this->wrapTRTH($columns);

        $header = $this->wrapTHead($columns);
        $footer = $this->wrapTFoot($columns);

        foreach($data as &$row) {
            $row = $this->wrapTRTH($row);
        }

        $data = implode('', $data);
        $data = $this->wrapTBody($data);
        $data = $header.$footer.$data;
        $data = $this->wrapTable($data);
        return $data;
    }

    private function wrapTRTH(array $data) {
        return '<tr><th>'.implode('</th><th>', $data).'</th></tr>';
    }

    private function wrapTHead($data) {
        return '<thead>'.$data.'</thead>';
    }

    private function wrapTFoot($data) {
        return '<tfoot>'.$data.'</tfoot>';
    }

    private function wrapTBody($data) {
        return '<tbody>'.$data.'</tbody>';
    }

    private function wrapTable($data) {
        return '<table>'.$data.'</table>';
    }

}<commit_msg>Code style fixes<commit_after><?php namespace Archon\IO;

use Archon\Exceptions\NotYetImplementedException;

/**
 * @link https://github.com/HWGehring/Archon for the canonical source repository
 * @license https://github.com/HWGehring/Archon/blob/master/LICENSE BSD 3-Clause
 */
final class HTML
{

    private $defaultOptions = [
        'readable' => false
    ];

    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public function render(array $options)
    {
        $data = $this->data;
        $options = Options::setDefaultOptions($options, $this->defaultOptions);
        $readableOpt = $options['readable'];

        $columns = current($data);
        $columns = array_keys($columns);
        $columns = $this->wrapTRTH($columns);

        $header = $this->wrapTHead($columns);
        $footer = $this->wrapTFoot($columns);

        foreach ($data as &$row) {
            $row = $this->wrapTRTH($row);
        }

        $data = implode('', $data);
        $data = $this->wrapTBody($data);
        $data = $header.$footer.$data;
        $data = $this->wrapTable($data);

        if ($readableOpt === false) {
            return $data;
        }

        throw new NotYetImplementedException('Pretty HTML not yet implemented');
    }

    private function wrapTRTH(array $data)
    {
        return '<tr><th>'.implode('</th><th>', $data).'</th></tr>';
    }

    private function wrapTHead($data)
    {
        return '<thead>'.$data.'</thead>';
    }

    private function wrapTFoot($data)
    {
        return '<tfoot>'.$data.'</tfoot>';
    }

    private function wrapTBody($data)
    {
        return '<tbody>'.$data.'</tbody>';
    }

    private function wrapTable($data)
    {
        return '<table>'.$data.'</table>';
    }
}
{'fraction_non_alphanumeric': 0.17318602567930724, 'fraction_numerical': 0.0005971931919976113, 'mean_word_length': 2.4643226473629785, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 51, 'https://': 4, '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': '1496135', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1007, 'n_words': 197}