<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\Notifications;

use App\Models\User;
use App\Models\UserReport;
use GuzzleHttp\RequestOptions;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;

class UserReportNotification extends Notification implements ShouldQueue
{
    use Queueable;

    const CONTENT_MAX_LENGTH = 1000;

    const HTTP_OPTIONS = [
        RequestOptions::CONNECT_TIMEOUT => 5,
        RequestOptions::TIMEOUT => 5,
    ];

    private $reporter;

    public function __construct(User $reporter)
    {
        $this->reporter = $reporter;
    }

    public function toSlack(UserReport $notifiable): SlackMessage
    {
        return (new SlackMessage())
            ->http(static::HTTP_OPTIONS)
            ->attachment(function ($attachment) use ($notifiable) {
                $reportable = $notifiable->reportable;
                $reportableUrl = null;
                if (method_exists($reportable, 'url')) {
                    $reportableUrl = $reportable->url();
                }

                $user = optional($notifiable->user)->username ?? "User {$notifiable->user_id}";
                $userUrl = route('users.show', ['user' => $notifiable->user_id]);

                $reportedText =
                    $reportableUrl !== null
                    ? "<{$reportableUrl}|{$notifiable->reportable_type} {$notifiable->reportable_id}>"
                    : "{$notifiable->reportable_type} {$notifiable->reportable_id}";

                $attachment
                    ->color('warning')
                    ->content(truncate($notifiable->comments), static::CONTENT_MAX_LENGTH)
                    ->fields([
                        'Reporter' => "<{$this->reporter->url()}|{$this->reporter->username}>",
                        'Reported' => $reportedText,
                        'User' => "<{$userUrl}|{$user}>",
                        'Reason' => $notifiable->reason,
                    ]);
            });
    }

    public function via($notifiable)
    {
        return ['slack'];
    }
}<commit_msg>wrong param position<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\Notifications;

use App\Models\User;
use App\Models\UserReport;
use GuzzleHttp\RequestOptions;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;

class UserReportNotification extends Notification implements ShouldQueue
{
    use Queueable;

    const CONTENT_MAX_LENGTH = 1000;

    const HTTP_OPTIONS = [
        RequestOptions::CONNECT_TIMEOUT => 5,
        RequestOptions::TIMEOUT => 5,
    ];

    private $reporter;

    public function __construct(User $reporter)
    {
        $this->reporter = $reporter;
    }

    public function toSlack(UserReport $notifiable): SlackMessage
    {
        return (new SlackMessage())
            ->http(static::HTTP_OPTIONS)
            ->attachment(function ($attachment) use ($notifiable) {
                $reportable = $notifiable->reportable;
                $reportableUrl = null;
                if (method_exists($reportable, 'url')) {
                    $reportableUrl = $reportable->url();
                }

                $user = optional($notifiable->user)->username ?? "User {$notifiable->user_id}";
                $userUrl = route('users.show', ['user' => $notifiable->user_id]);

                $reportedText =
                    $reportableUrl !== null
                    ? "<{$reportableUrl}|{$notifiable->reportable_type} {$notifiable->reportable_id}>"
                    : "{$notifiable->reportable_type} {$notifiable->reportable_id}";

                $attachment
                    ->color('warning')
                    ->content(truncate($notifiable->comments, static::CONTENT_MAX_LENGTH))
                    ->fields([
                        'Reporter' => "<{$this->reporter->url()}|{$this->reporter->username}>",
                        'Reported' => $reportedText,
                        'User' => "<{$userUrl}|{$user}>",
                        'Reason' => $notifiable->reason,
                    ]);
            });
    }

    public function via($notifiable)
    {
        return ['slack'];
    }
}
{'fraction_non_alphanumeric': 0.12862981286298128, 'fraction_numerical': 0.0034416003441600346, 'mean_word_length': 2.152542372881356, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 71, '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': '6636581', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1213, 'n_words': 250}