<commit_before><?php

namespace BoomCMS\Core\Chunk;

use BoomCMS\Foundation\Chunk\AcceptsHtmlString;

class Timestamp extends BaseChunk
{
    use AcceptsHtmlString;

    public static $defaultFormat = 'j F Y';
    public static $formats = [
        'j F Y',
        'j F Y H:i',
        'j F Y h:i A',
        'l j F Y',
        'l j F Y H:i',
        'l j F Y h:i A',
        'H:i',
        'h:i A',
    ];

    protected $defaultHtml = "<span class='b-chunk-timestamp'>{time}</span>";

    protected function addContentToHtml($content)
    {
        $html = $this->html ?: $this->defaultHtml;

        return str_replace('{time}', $content, $html);
    }

    public function attributes()
    {
        return [
            $this->attributePrefix.'timestamp' => $this->getTimestamp(),
            $this->attributePrefix.'format'    => $this->getFormat(),
        ];
    }

    public function hasContent()
    {
        return $this->getTimestamp() > 0;
    }

    public function getFormat()
    {
        return isset($this->attrs['format']) ? $this->attrs['format'] : static::$defaultFormat;
    }

    public function getTimestamp()
    {
        return isset($this->attrs['timestamp']) ? $this->attrs['timestamp'] : 0;
    }
<commit_msg>Bugfix: Timestamp chunks need timestamp and format to have content<commit_after><?php

namespace BoomCMS\Core\Chunk;

use BoomCMS\Foundation\Chunk\AcceptsHtmlString;

class Timestamp extends BaseChunk
{
    use AcceptsHtmlString;

    public static $defaultFormat = 'j F Y';
    public static $formats = [
        'j F Y',
        'j F Y H:i',
        'j F Y h:i A',
        'l j F Y',
        'l j F Y H:i',
        'l j F Y h:i A',
        'H:i',
        'h:i A',
    ];

    protected $defaultHtml = "<span class='b-chunk-timestamp'>{time}</span>";

    protected function addContentToHtml($content)
    {
        $html = $this->html ?: $this->defaultHtml;

        return str_replace('{time}', $content, $html);
    }

    public function attributes()
    {
        return [
            $this->attributePrefix.'timestamp' => $this->getTimestamp(),
            $this->attributePrefix.'format'    => $this->getFormat(),
        ];
    }

    public function hasContent()
    {
        return $this->getFormat() && $this->getTimestamp() > 0;
    }

    public function getFormat()
    {
        return isset($this->attrs['format']) ? $this->attrs['format'] : static::$defaultFormat;
    }

    public function getTimestamp()
    {
        return isset($this->attrs['timestamp']) ? $this->attrs['timestamp'] : 0;
    }

{'fraction_non_alphanumeric': 0.1537261022239563, 'fraction_numerical': 0.0015606710885680843, 'mean_word_length': 2.3342002600780236, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 36, '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': '5508935', 'n_tokens_mistral': 801, 'n_tokens_neox': 785, 'n_words': 194}