<commit_before><?php

// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Libraries;

use App\Models\BeatmapDiscussion;
use App\Models\BeatmapDiscussionPost;
use App\Models\Beatmapset;
use App\Models\Build;
use App\Models\Chat\Channel;
use App\Models\Comment;
use App\Models\Forum;
use App\Models\NewsPost;
use App\Models\Score;
use App\Models\User;

class MorphMap
{
    const MAP = [
        BeatmapDiscussion::class => 'beatmapset_discussion',
        Beatmapset::class => 'beatmapset',
        BeatmapDiscussionPost::class => 'beatmapset_discussion_post',
        Build::class => 'build',
        Channel::class => 'channel',
        Comment::class => 'comment',
        Forum\Post::class => 'forum_post',
        Forum\Topic::class => 'forum_topic',
        NewsPost::class => 'news_post',
        Score\Best\Fruits::class => 'score_best_fruits',
        Score\Best\Mania::class => 'score_best_mania',
        Score\Best\Osu::class => 'score_best_osu',
        Score\Best\Taiko::class => 'score_best_taiko',
        User::class => 'user',
    ];

    public static function getType($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        return static::MAP[$class] ?? null;
    }

    public static function getClass($type)
    {
        return static::flippedMap()[$type] ?? null;
    }

    public static function flippedMap()
    {
        static $ret;

        return $ret ??= array_flip(static::MAP);
    }
}
<commit_msg>Add mapping for legacy match score<commit_after><?php

// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Libraries;

use App\Models\BeatmapDiscussion;
use App\Models\BeatmapDiscussionPost;
use App\Models\Beatmapset;
use App\Models\Build;
use App\Models\Chat\Channel;
use App\Models\Comment;
use App\Models\Forum;
use App\Models\LegacyMatch;
use App\Models\NewsPost;
use App\Models\Score;
use App\Models\User;

class MorphMap
{
    const MAP = [
        BeatmapDiscussion::class => 'beatmapset_discussion',
        Beatmapset::class => 'beatmapset',
        BeatmapDiscussionPost::class => 'beatmapset_discussion_post',
        Build::class => 'build',
        Channel::class => 'channel',
        Comment::class => 'comment',
        Forum\Post::class => 'forum_post',
        Forum\Topic::class => 'forum_topic',
        LegacyMatch\Score::class => 'legacy_match_score',
        NewsPost::class => 'news_post',
        Score\Best\Fruits::class => 'score_best_fruits',
        Score\Best\Mania::class => 'score_best_mania',
        Score\Best\Osu::class => 'score_best_osu',
        Score\Best\Taiko::class => 'score_best_taiko',
        User::class => 'user',
    ];

    public static function getType($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        return static::MAP[$class] ?? null;
    }

    public static function getClass($type)
    {
        return static::flippedMap()[$type] ?? null;
    }

    public static function flippedMap()
    {
        static $ret;

        return $ret ??= array_flip(static::MAP);
    }
}

{'fraction_non_alphanumeric': 0.13651365136513652, 'fraction_numerical': 0.0012001200120012002, 'mean_word_length': 2.988038277511962, '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': '4707940', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1025, 'n_words': 227}