<commit_before><?php
/*
 * This file is part of the Onema ClassyFile Package.
 * For the full copyright and license information, 
 * please view the LICENSE file that was distributed 
 * with this source code.
 */

namespace Onema\ClassyFile\Template;

/**
 * BasicClassTemplate - Class to generate a basic template.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015, onema.io
 */
class BasicClassTemplate
{
    /**
     * @var string
     */
    private $topComment;

    public function __construct ($topComment = null)
    {
        if (!isset($topComment)) {
            $date = new \DateTime();
            $this->topComment = <<<EOT

/*
 * File generated by ClassyFile <https://github.com/onema/classyfile>
 * (c) {$date->format('Y')}, <NAME>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed
 * with this source code.
 */

EOT;
        } else {
            $this->topComment = $topComment;
        }
    }

    /**
     * Return a string defining a php class using the parameters defined below.
     *
     * @param $namespace
     * @param $useStatements
     * @param $comments
     * @param $code
     * @return string
     */
    public function getTemplate ($namespace, $useStatements, $comments, $code)
    {
        return '<?php'.
        $this->topComment.
        $namespace . PHP_EOL.
        $useStatements . PHP_EOL.
        $comments . PHP_EOL.<commit_msg>Update template to fix issue when an empty string is used as the top comment. see #19<commit_after><?php
/*
 * This file is part of the Onema ClassyFile Package.
 * For the full copyright and license information, 
 * please view the LICENSE file that was distributed 
 * with this source code.
 */

namespace Onema\ClassyFile\Template;

/**
 * BasicClassTemplate - Class to generate a basic template.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015, onema.io
 */
class BasicClassTemplate
{
    /**
     * @var string
     */
    private $topComment;

    public function __construct ($topComment = null)
    {
        if (!isset($topComment)) {
            $date = new \DateTime();
            $this->topComment = <<<EOT
/*
 * File generated by ClassyFile <https://github.com/onema/classyfile>
 * (c) {$date->format('Y')}, <NAME>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed
 * with this source code.
 */

EOT;
        } else {
            $this->topComment = $topComment;
        }
    }

    /**
     * Return a string defining a php class using the parameters defined below.
     *
     * @param $namespace
     * @param $useStatements
     * @param $comments
     * @param $code
     * @return string
     */
    public function getTemplate ($namespace, $useStatements, $comments, $code)
    {
        return '<?php'. PHP_EOL.
        $this->topComment.
        $namespace . PHP_EOL.
        $useStatements . PHP_EOL. PHP_EOL.
        $comments . PHP_EOL.
{'fraction_non_alphanumeric': 0.11736930860033727, 'fraction_numerical': 0.003372681281618887, 'mean_word_length': 2.4209919261822375, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, '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': '5306939', 'n_tokens_mistral': 874, 'n_tokens_neox': 856, 'n_words': 281}