<commit_before><?php

class View
{
    public static function timeline($lines)
    {
        foreach ($lines as $l) {
            self::extractDisplayData($l);
        }
    }

    public static function status($l)
    {
        self::extractDisplayData($l);
    }

    private static function extractDisplayData($line)
    {
        $data = [
            'displayName' => self::getDisplayName($line),
            'acct' => self::getTargetObject($line)->account->acct,
            'createdAt' => self::getTargetObject($line)->created_at,
            'rebloggedBy' => is_null($line->reblog) ? null : $line->account->acct,
            'reblogsCount' => self::getTargetObject($line)->reblogs_count,
            'favouritesCount' => self::getTargetObject($line)->favourites_count,
            'content' => self::rmHtmlTags(self::getTargetObject($line)->content),
        ];
        self::outputLine($data);
    }

    private static function getDisplayName($line)
    {
        if(is_null($line->reblog)) {
            return $line->account->display_name ?: $line->account->username;
        } else {
            return $line->reblog->account->display_name ?: $line->reblog->account->username;
        }
    }

    private static function getTargetObject($line)
    {
        return $line->reblog ?: $line;
    }

    private static function rmHtmlTags($txt)
    {
        return preg_replace('/<("[^"]*"|\'[^\']*\'|[^\'">])*>/', '', $txt);
    }

    private static function outputLine($data)
    {
        $result = self::color("{$data['displayName']} ", '33');
        $result .= "(@{$data['acct']}) ";
        $result .= "[{$data['createdAt']}] ";
        if (!is_null($data['rebloggedBy'])) $result .= "(reblogged by @{$data['rebloggedBy']}) ";
        $result .= self::color("{$data['reblogsCount']}Boosts ", '32');
        $result .= self::color("{$data['favouritesCount']}Favs ", '31');
        $result .= PHP_EOL;
        // displayName (@acct) [createAt] (reblogged by @acct) reblogsCount favouritesCount

        $result .= "{$data['content']}";
        $result .= PHP_EOL.PHP_EOL;
        // content

        echo $result;<commit_msg>Show status id in timeline.<commit_after><?php

class View
{
    public static function timeline($lines)
    {
        foreach ($lines as $l) {
            self::extractDisplayData($l);
        }
    }

    public static function status($l)
    {
        self::extractDisplayData($l);
    }

    private static function extractDisplayData($line)
    {
        $data = [
            'displayName' => self::getDisplayName($line),
            'acct' => self::getTargetObject($line)->account->acct,
            'createdAt' => self::getTargetObject($line)->created_at,
            'rebloggedBy' => is_null($line->reblog) ? null : $line->account->acct,
            'reblogsCount' => self::getTargetObject($line)->reblogs_count,
            'favouritesCount' => self::getTargetObject($line)->favourites_count,
            'id' => self::getTargetObject($line)->id,
            'content' => self::rmHtmlTags(self::getTargetObject($line)->content),
        ];
        self::outputLine($data);
    }

    private static function getDisplayName($line)
    {
        if(is_null($line->reblog)) {
            return $line->account->display_name ?: $line->account->username;
        } else {
            return $line->reblog->account->display_name ?: $line->reblog->account->username;
        }
    }

    private static function getTargetObject($line)
    {
        return $line->reblog ?: $line;
    }

    private static function rmHtmlTags($txt)
    {
        return preg_replace('/<("[^"]*"|\'[^\']*\'|[^\'">])*>/', '', $txt);
    }

    private static function outputLine($data)
    {
        $result = self::color("{$data['displayName']} ", '33');
        $result .= "(@{$data['acct']}) ";
        $result .= "[{$data['createdAt']}] ";
        if (!is_null($data['rebloggedBy'])) $result .= "(reblogged by @{$data['rebloggedBy']}) ";
        $result .= self::color("{$data['reblogsCount']}Boosts ", '32');
        $result .= self::color("{$data['favouritesCount']}Favs ", '31');
        $result .= PHP_EOL;
        // displayName (@acct) [createAt] (reblogged by @acct) reblogsCount favouritesCount

        $result .= self::color("[ID:{$data['id']}] ", '36');
        $result .= "{$data['content']}";
        $result .= PHP_EOL.PHP_EOL;
        // content

        echo $result;
{'fraction_non_alphanumeric': 0.19170632222977566, 'fraction_numerical': 0.0031724450487196918, 'mean_word_length': 2.629934210526316, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 65, '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': '4572691', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1333, 'n_words': 218}