<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\Models\Chat;

use App\Events\ChatChannelEvent;
use App\Exceptions\API;
use App\Exceptions\InvariantException;
use App\Jobs\Notifications\ChannelAnnouncement;
use App\Jobs\Notifications\ChannelMessage;
use App\Libraries\AuthorizationResult;
use App\Libraries\Chat\MessageTask;
use App\Models\LegacyMatch\LegacyMatch;
use App\Models\Multiplayer\Room;
use App\Models\User;
use App\Traits\Memoizes;
use App\Traits\Validatable;
use Carbon\Carbon;
use ChaseConey\LaravelDatadogHelper\Datadog;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Str;
use LaravelRedis as Redis;

/**
 * @property int[] $allowed_groups
 * @property int $channel_id
 * @property \Carbon\Carbon $creation_time
 * @property-read string $creation_time_json
 * @property string $description
 * @property-read \Illuminate\Database\Eloquent\Collection<Message> $messages
 * @property int|null $match_id
 * @property bool $moderated
 * @property string $name
 * @property int|null $room_id
 * @property string $type
 * @property int|null $last_message_id
 * @property-read \App\Models\LegacyMatch\LegacyMatch|null $multiplayerMatch
 * @property-read \Illuminate\Database\Eloquent\Collection<UserChannel> $userChannels
 */
class Channel extends Model
{
    use Memoizes {
        Memoizes::resetMemoized as origResetMemoized;
    }

    use Validatable;

    const ANNOUNCE_MESSAGE_LENGTH_LIMIT = 1024; // limited by column length
    const CHAT_ACTIVITY_TIMEOUT = 60; // in seconds.

    public ?string $uuid = null;

    protected $primaryKey = 'channel_id';

    protected $casts = [
        'moderated' => 'boolean',
    ];

    protected $dates = [
        'creation_time',
    ];
<commit_msg>add builder methods to doc<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\Models\Chat;

use App\Events\ChatChannelEvent;
use App\Exceptions\API;
use App\Exceptions\InvariantException;
use App\Jobs\Notifications\ChannelAnnouncement;
use App\Jobs\Notifications\ChannelMessage;
use App\Libraries\AuthorizationResult;
use App\Libraries\Chat\MessageTask;
use App\Models\LegacyMatch\LegacyMatch;
use App\Models\Multiplayer\Room;
use App\Models\User;
use App\Traits\Memoizes;
use App\Traits\Validatable;
use Carbon\Carbon;
use ChaseConey\LaravelDatadogHelper\Datadog;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Str;
use LaravelRedis as Redis;

/**
 * @property int[] $allowed_groups
 * @property int $channel_id
 * @property \Carbon\Carbon $creation_time
 * @property-read string $creation_time_json
 * @property string $description
 * @property-read \Illuminate\Database\Eloquent\Collection<Message> $messages
 * @property int|null $match_id
 * @property bool $moderated
 * @property string $name
 * @property int|null $room_id
 * @property string $type
 * @property int|null $last_message_id
 * @property-read \App\Models\LegacyMatch\LegacyMatch|null $multiplayerMatch
 * @property-read \Illuminate\Database\Eloquent\Collection<UserChannel> $userChannels
 * @method static \Illuminate\Database\Eloquent\Builder PM()
 * @method static \Illuminate\Database\Eloquent\Builder public()
 */
class Channel extends Model
{
    use Memoizes {
        Memoizes::resetMemoized as origResetMemoized;
    }

    use Validatable;

    const ANNOUNCE_MESSAGE_LENGTH_LIMIT = 1024; // limited by column length
    const CHAT_ACTIVITY_TIMEOUT = 60; // in seconds.

    public ?string $uuid = null;

    protected $primaryKey = 'channel_id';

    protected $casts = [
        'moderated' => 'boolean',
    ];

    protected $dates = [
        'creation_time',
    ];

{'fraction_non_alphanumeric': 0.10432114548708771, 'fraction_numerical': 0.004091025313219126, 'mean_word_length': 4.486676016830295, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1177796', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1228, 'n_words': 302}