Code Duplication    Length = 26-26 lines in 2 locations

src/BCRM/BackendBundle/Command/SendConfirmUnregistrationMailCommand.php 1 location

@@ 15-40 (lines=26) @@
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
class SendConfirmUnregistrationMailCommand extends ContainerAwareCommand
16
{
17
    protected function configure()
18
    {
19
        $this
20
            ->setName('bcrm:unregistration:confirm')
21
            ->setDescription('Send unregistration confirmation emails');
22
    }
23
24
    protected function execute(InputInterface $input, OutputInterface $output)
25
    {
26
        /** @var \BCRM\BackendBundle\Entity\Event\UnregistrationRepository $repo */
27
        $repo = $this->getContainer()->get('bcrm.backend.repo.unregistration');
28
        /** @var \LiteCQRS\Bus\CommandBus $commandBus */
29
        $commandBus = $this->getContainer()->get('command_bus');
30
        foreach ($repo->getNewUnregistrations() as $unregistration) {
31
            if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
32
                $output->writeln(sprintf('Sending unregistration confirmation mail for %s', $unregistration));
33
            }
34
            $command                 = new SendUnregistrationConfirmationMailCommand();
35
            $command->unregistration = $unregistration;
36
            $command->schemeAndHost  = $this->getContainer()->getParameter('scheme_and_host');
37
            $commandBus->handle($command);
38
        }
39
    }
40
}
41

src/BCRM/BackendBundle/Command/SendPayRegistrationMailCommand.php 1 location

@@ 15-40 (lines=26) @@
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
class SendPayRegistrationMailCommand extends ContainerAwareCommand
16
{
17
    protected function configure()
18
    {
19
        $this
20
            ->setName('bcrm:registration:pay')
21
            ->setDescription('Send registration payment emails');
22
    }
23
24
    protected function execute(InputInterface $input, OutputInterface $output)
25
    {
26
        /** @var \BCRM\BackendBundle\Entity\Event\RegistrationRepository $repo */
27
        $repo = $this->getContainer()->get('bcrm.backend.repo.registration');
28
        /** @var \LiteCQRS\Bus\CommandBus $commandBus */
29
        $commandBus = $this->getContainer()->get('command_bus');
30
        foreach ($repo->getToPay() as $registration) {
31
            if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
32
                $output->writeln(sprintf('Sending payment notification mail for %s', $registration));
33
            }
34
            $command                = new SendPaymentNotificationMailCommand();
35
            $command->registration  = $registration;
36
            $command->schemeAndHost = $this->getContainer()->getParameter('scheme_and_host');
37
            $commandBus->handle($command);
38
        }
39
    }
40
}
41