Ejemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $raw = '';
     while ($line = fgets(STDIN)) {
         $raw .= $line;
     }
     $parser = new EmailParser($raw);
     $issue = new Support();
     $issue->setFrom($parser->getRawFrom())->setTo($parser->getRawTo())->setCc($parser->getRawCc())->setSubject($parser->getSubject())->setBody($parser->getTextPart());
     if (preg_match('/^support-(?:Lreply-)?([0-9]+)@/', $issue->getTo(), $matches)) {
         $this->processReply($issue, $matches[1], true, $output);
     } elseif (preg_match('/^support-(?:reply-)?([0-9]+)@/', $issue->getCc(), $matches)) {
         $this->processReply($issue, $matches[1], false, $output);
     } elseif (preg_match('/^support-bounces@/', $issue->getTo())) {
         $this->processBounce($parser->getRawFrom(), $parser->getRawTo(), $parser->getSubject(), $parser->getRawBody(), $output);
     } else {
         //support@ or websupport@
         $this->processNew($issue, $output);
     }
 }