UnnotifyWhenCommentRemoved.php 696 Bytes
<?php

namespace FootyRoom\Core\Notification;

use FootyRoom\Core\Comment\CommentRemoved;

class UnnotifyWhenCommentRemoved
{
    /**
     * @var \FootyRoom\Core\Notification\CommentNotifier
     */
    protected $notifier;

    /**
     * Constructor.
     *
     * @param \FootyRoom\Core\Notification\CommentNotifier $notifier
     */
    public function __construct(CommentNotifier $notifier)
    {
        $this->notifier = $notifier;
    }

    /**
     * Remove notifications from databae.
     *
     * @param \FootyRoom\Core\Comment\CommentRemoved $event
     */
    public function handle(CommentRemoved $event)
    {
        $this->notifier->unnotify($event->comment->getId());
    }
}