<commit_before><?php

namespace App\Exceptions;

use Exception;
use Illuminate\Support\Facades\Mail;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        'Symfony\Component\HttpKernel\Exception\HttpException'
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $e
     * @return void
     */
    public function report(Exception $e)
    {
        if (env('APP_ENV', 'local')!='local') {
            Mail::raw($e, function ($message) {
                $message->subject('[ROOT] Exception Report');
                $message->from(env('MAIL_FROM_ADDRESS', 'root@localhost'), env('SYSLOG_APPNAME', ''));
                $message->to(env('ROOT_REPORT_MAIL', 'root@localhost'));
            });
        }
        return parent::report($e);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $e
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $e)
    {
        // Catch TokenMismatchException to show a friendly error message
        if ($e instanceof \Illuminate\Session\TokenMismatchException) {
            return redirect($request->fullUrl())->withErrors(trans('app.msg.invalid_token'));
        }

        return parent::render($request, $e);
    }
}<commit_msg>Enhance readability<commit_after><?php

namespace App\Exceptions;

use Exception;
use Illuminate\Support\Facades\Mail;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        'Symfony\Component\HttpKernel\Exception\HttpException'
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Exception $exception)
    {
        if (env('APP_ENV', 'local')!='local') {
            Mail::raw($exception, function ($message) {
                $message->subject('[ROOT] Exception Report');
                $message->from(env('MAIL_FROM_ADDRESS', 'root@localhost'), env('SYSLOG_APPNAME', ''));
                $message->to(env('ROOT_REPORT_MAIL', 'root@localhost'));
            });
        }
        return parent::report($exception);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        // Catch TokenMismatchException to show a friendly error message
        if ($exception instanceof \Illuminate\Session\TokenMismatchException) {
            return redirect($request->fullUrl())->withErrors(trans('app.msg.invalid_token'));
        }

        return parent::render($request, $exception);
    }
}
{'fraction_non_alphanumeric': 0.12583182093163944, 'fraction_numerical': 0.0, 'mean_word_length': 2.4664570230607965, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7628207', 'n_tokens_mistral': 917, 'n_tokens_neox': 929, 'n_words': 221}