<commit_before><?php

/*
 * This file is part of Hifone.
 *
 * (c) H<EMAIL> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Hifone\Handlers\Listeners\Notification;

use Auth;
use Hifone\Events\Reply\ReplyEventInterface;
use Hifone\Models\Reply;
use Hifone\Models\Thread;
use Hifone\Models\User;
use Hifone\Services\Notifier\Notifier;

class SendReplyNotificationHandler
{
    /**
     * Handle the thread.
     */
    public function handle(ReplyEventInterface $event)
    {
        $this->newReplyNotify(Auth::user(), $event->reply);
    }

    protected function newReplyNotify(User $fromUser, Reply $reply)
    {
        $thread = $reply->thread;
        // Notify the author
        app(Notifier::class)->batchNotify(
                    'new_reply',
                    $fromUser,
                    [$thread->user],
                    $reply->id,
                    $reply->body
                    );

        // Notify followed users
        
        app(Notifier::class)->batchNotify(
                    'follow',
                    $fromUser,
                    $thread->follows()->get(),<commit_msg>Applied fixes from StyleCI<commit_after><?php

/*
 * This file is part of Hifone.
 *
 * (c) Hifone.<EMAIL> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Hifone\Handlers\Listeners\Notification;

use Auth;
use Hifone\Events\Reply\ReplyEventInterface;
use Hifone\Models\Reply;
use Hifone\Models\Thread;
use Hifone\Models\User;
use Hifone\Services\Notifier\Notifier;

class SendReplyNotificationHandler
{
    /**
     * Handle the thread.
     */
    public function handle(ReplyEventInterface $event)
    {
        $this->newReplyNotify(Auth::user(), $event->reply);
    }

    protected function newReplyNotify(User $fromUser, Reply $reply)
    {
        $thread = $reply->thread;
        // Notify the author
        app(Notifier::class)->batchNotify(
                    'new_reply',
                    $fromUser,
                    [$thread->user],
                    $reply->id,
                    $reply->body
                    );

        // Notify followed users

        app(Notifier::class)->batchNotify(
                    'follow',
                    $fromUser,
                    $thread->follows()->get(),
{'fraction_non_alphanumeric': 0.11436711436711437, 'fraction_numerical': 0.0, 'mean_word_length': 1.965018094089264, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, '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': '2277097', 'n_tokens_mistral': 694, 'n_tokens_neox': 668, 'n_words': 158}