<commit_before><?php

namespace AppBundle\Service;

use AppBundle\Document\Episode;
use AppBundle\Document\Show;
use Doctrine\ODM\MongoDB\DocumentManager;
use Psr\Log\LoggerInterface;
use Symfony\Bridge\Twig\TwigEngine;

class MailSender
{
    private $swiftMailer;
    private $twig;
    private $logger;
    private $dm;
    private $fromEmail;
    private $fromEmailSender;

    public function __construct(
        \Swift_Mailer $swiftMailer,
        TwigEngine $twig,
        LoggerInterface $logger,
        DocumentManager $dm,
        $fromEmail,
        $fromEmailSender
    ) {
        $this->swiftMailer = $swiftMailer;
        $this->twig = $twig;
        $this->logger = $logger;
        $this->dm = $dm;
        $this->fromEmail = $fromEmail;
        $this->fromEmailSender = $fromEmailSender;
    }

    public function sendNewEpisodeNotifications()
    {
        $showRepository = $this->dm->getRepository('AppBundle:Show');

        $shows = $showRepository->findWithNewEpisodes();

        foreach ($shows as $show) {
            $newEpisodes = $show->getNewEpisodes();
            foreach ($newEpisodes as $newEpisode) {
                $mail = $this->twig->render(
                    'mail/notification.html.twig',
                    [
                        'show' => $show,
                        'episode' => $newEpisode,
                    ]
                );

                $this->sendEmail($show, $mail, $newEpisode);

                $newEpisode->setIsNotificationSended(true);<commit_msg>bug fix<commit_after><?php

namespace AppBundle\Service;

use AppBundle\Document\Episode;
use AppBundle\Document\Show;
use Doctrine\ODM\MongoDB\DocumentManager;
use Psr\Log\LoggerInterface;
use Symfony\Bridge\Twig\TwigEngine;

class MailSender
{
    private $swiftMailer;
    private $twig;
    private $logger;
    private $dm;
    private $fromEmail;
    private $fromEmailSender;

    public function __construct(
        \Swift_Mailer $swiftMailer,
        TwigEngine $twig,
        LoggerInterface $logger,
        DocumentManager $dm,
        $fromEmail,
        $fromEmailSender
    ) {
        $this->swiftMailer = $swiftMailer;
        $this->twig = $twig;
        $this->logger = $logger;
        $this->dm = $dm;
        $this->fromEmail = $fromEmail;
        $this->fromEmailSender = $fromEmailSender;
    }

    public function sendNewEpisodeNotifications()
    {
        $showRepository = $this->dm->getRepository('AppBundle:Show');

        $shows = $showRepository->findWithNewEpisodes();

        foreach ($shows as $show) {
            $newEpisodes = $show->getNewEpisodes();
            foreach ($newEpisodes as $newEpisode) {
                $mail = $this->twig->render(
                    'mail/notification.html.twig',
                    [
                        'show' => $show,
                        'episode' => $newEpisode,
                    ]
                );

                $this->sendEmail($show, $mail, $newEpisode);

                $newEpisode->setNotificationSended(true);
{'fraction_non_alphanumeric': 0.11710526315789474, 'fraction_numerical': 0.0, 'mean_word_length': 2.0288844621513946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3936043', 'n_tokens_mistral': 923, 'n_tokens_neox': 880, 'n_words': 160}