<commit_before><?php

namespace PragmaRX\Health\Checkers;

use PragmaRX\Health\Support\Result;
use Illuminate\Support\Facades\Mail as IlluminateMail;

class Mail extends Base
{
    /**
     * Store mail configuration.
     *
     * @var
     */
    private $mailConfiguration;

    /**
     * Check resource.
     *
     * @return Result
     */
    public function check()
    {
        return $this->checkMail();
    }

    /**
     * Configure mail for testing.
     */
    private function configureMail()
    {
        $this->mailConfiguration = config('mail');

        config(['mail' => $this->target->config->toArray()]);
    }

    /**
     * Send a test e-mail.
     */
    private function checkMail()
    {
        $this->configureMail();

        try {
            $this->sendMail();

            $result = $this->makeHealthyResult();
        } catch (\Exception $exception) {
            report($exception);

            $result = $this->makeResultFromException($exception);
        }

        $this->restoreMailConfiguration();

        return $result;
    }

    /**
     * Restore mail configuration.
     */
    private function restoreMailConfiguration()
    {
        config(['mail' => $this->mailConfiguration]);
    }

    /**
     * Send a test e-mail message.
     */
    private function sendMail()
    {
        IlluminateMail::send($this->target->view, [], function ($message) {
            $fromAddress = array_get($this->target->config, 'from.address');

            $message->returnPath($fromAddress);

            $message->cc($fromAddress);

            $message->bcc($fromAddress);
<commit_msg>remove call to a laravel array_ helper -remove call to array_get to make it compatible with laravel 6<commit_after><?php

namespace PragmaRX\Health\Checkers;

use PragmaRX\Health\Support\Result;
use Illuminate\Support\Facades\Mail as IlluminateMail;
use Illuminate\Support\Arr;

class Mail extends Base
{
    /**
     * Store mail configuration.
     *
     * @var
     */
    private $mailConfiguration;

    /**
     * Check resource.
     *
     * @return Result
     */
    public function check()
    {
        return $this->checkMail();
    }

    /**
     * Configure mail for testing.
     */
    private function configureMail()
    {
        $this->mailConfiguration = config('mail');

        config(['mail' => $this->target->config->toArray()]);
    }

    /**
     * Send a test e-mail.
     */
    private function checkMail()
    {
        $this->configureMail();

        try {
            $this->sendMail();

            $result = $this->makeHealthyResult();
        } catch (\Exception $exception) {
            report($exception);

            $result = $this->makeResultFromException($exception);
        }

        $this->restoreMailConfiguration();

        return $result;
    }

    /**
     * Restore mail configuration.
     */
    private function restoreMailConfiguration()
    {
        config(['mail' => $this->mailConfiguration]);
    }

    /**
     * Send a test e-mail message.
     */
    private function sendMail()
    {
        IlluminateMail::send($this->target->view, [], function ($message) {
            $fromAddress = Arr::get($this->target->config, 'from.address');

            $message->returnPath($fromAddress);

            $message->cc($fromAddress);

            $message->bcc($fromAddress);

{'fraction_non_alphanumeric': 0.14010092015434847, 'fraction_numerical': 0.00029682398337785694, 'mean_word_length': 2.044263775971093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '4401483', 'n_tokens_mistral': 935, 'n_tokens_neox': 920, 'n_words': 189}