<?php
namespace Claromentis\Quiz;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] ?: array()) + array();
use Claromentis\Quiz\Legacy\NotificationSender;
use Claromentis\Quiz\Repository\PollRepository;
use Claromentis\Quiz\Repository\SurveyRepository;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
class NotificationBackgroundTask
{
    
    
    
    
    private $notification_sender;
    
    
    
    
    private $survey_repository;
    
    
    
    
    private $poll_repository;
    
    
    
    
    private $logger;
    
    
    
    
    
    
    
    
    public function __construct(NotificationSender $_b2ac3a91c65e99c6cd7e3f97bafb7a42, SurveyRepository $_d788c955b64166f591e5ce0a44478441, PollRepository $poll_repository, LoggerInterface $_e9abd43fa12cace21feb1774e5f75144 = null)
    {
        $this->notification_sender = $_b2ac3a91c65e99c6cd7e3f97bafb7a42;
        $this->survey_repository = $_d788c955b64166f591e5ce0a44478441;
        $this->poll_repository = $poll_repository;
        $this->logger = $_e9abd43fa12cace21feb1774e5f75144 ?: new NullLogger();
    }
    public function ProcessBackground()
    {
        $this->SendPublishedNotifications();
        $this->SendEndedNotifications();
        $this->SendCreatedNotifications();
    }
    private function SendPublishedNotifications() : void
    {
        try {
            $this->notification_sender->SendNotificationsForAllPublishedPolls();
            $this->notification_sender->SendNotificationsForAllPublishedSurveys();
            $this->notification_sender->SendNotificationsForAllPublishedQuizzes();
        } catch (\Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->logger->error($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
    }
    private function SendEndedNotifications() : void
    {
        try {
            $this->notification_sender->SendNotificationsForAllEndedPolls();
            $this->notification_sender->SendNotificationsForAllEndedSurveys();
        } catch (\Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->logger->error($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
    }
    private function SendCreatedNotifications() : void
    {
        try {
            $this->notification_sender->SendNotificationsForCreatedPolls();
            $this->notification_sender->SendNotificationsForCreatedSurveys();
        } catch (\Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->logger->error($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        }
    }
}