<commit_before><?php
namespace Wits\IssueBundle\Mail\Processor;

use Fetch\Message;
use Wiakowe\FetchBundle\Processor\MailProcessorInterface;
use Doctrine\ORM\EntityManager;
use Wits\UserBundle\Entity\User;
use Wits\IssueBundle\Entity\Issue;
use Wits\IssueBundle\Event\IssueCreateEvent;
use Wits\IssueBundle\Event\IssueEvents;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
 * @author <NAME> <<EMAIL>>
 */
class NewIssueProcessor implements MailProcessorInterface
{
    /**
     * @var EntityManager
     */
    protected $entityManager;

    protected $eventDispatcher;

    public function __construct(EntityManager $entityManager, EventDispatcherInterface $eventDispatcher)
    {
        $this->entityManager   = $entityManager;
        $this->eventDispatcher = $eventDispatcher;
    }

    public function apply(Message $message)
    {
        $senderAddress = $message->getAddresses('from')['address'];

        $user = $this->entityManager
            ->getRepository('WitsUserBundle:User')
            ->findOneByEmail($senderAddress);

        if (!$user) {
            $user = new User;

            $user->setEmail($senderAddress);
            $user->addRole('ROLE_REPORTER');

            $this->entityManager->persist($user);
        }

        $issue = new Issue;

        /** @var $project \Wits\ProjectBundle\Entity\Project */
        $project = $this->entityManager<commit_msg>#3 Added some minor documentation.<commit_after><?php
namespace Wits\IssueBundle\Mail\Processor;

use Fetch\Message;
use Wiakowe\FetchBundle\Processor\MailProcessorInterface;
use Doctrine\ORM\EntityManager;
use Wits\UserBundle\Entity\User;
use Wits\IssueBundle\Entity\Issue;
use Wits\IssueBundle\Event\IssueCreateEvent;
use Wits\IssueBundle\Event\IssueEvents;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
 * @author <NAME> <<EMAIL>>
 */
class NewIssueProcessor implements MailProcessorInterface
{
    /**
     * @var EntityManager
     */
    protected $entityManager;

    /**
     * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
     */
    protected $eventDispatcher;

    public function __construct(EntityManager $entityManager, EventDispatcherInterface $eventDispatcher)
    {
        $this->entityManager   = $entityManager;
        $this->eventDispatcher = $eventDispatcher;
    }

    public function apply(Message $message)
    {
        $senderAddress = $message->getAddresses('from')['address'];

        $user = $this->entityManager
            ->getRepository('WitsUserBundle:User')
            ->findOneByEmail($senderAddress);

        if (!$user) {
            $user = new User;

            $user->setEmail($senderAddress);
            $user->addRole('ROLE_REPORTER');

            $this->entityManager->persist($user);
        }

        $issue = new Issue;

        /** @var $project \Wits\ProjectBundle\Entity\Project */
        $project = $this->entityManager
{'fraction_non_alphanumeric': 0.120108880571623, 'fraction_numerical': 0.0003402517863218782, 'mean_word_length': 3.2060085836909873, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, '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': '2366434', 'n_tokens_mistral': 844, 'n_tokens_neox': 796, 'n_words': 141}