MailChimpListsCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 9
c 1
b 0
f 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
/**
4
 * @author    Markus Tacker <[email protected]>
5
 * @copyright 2013-2016 Verein zur Förderung der Netzkultur im Rhein-Main-Gebiet e.V. | http://netzkultur-rheinmain.de/
6
 */
7
8
namespace BCRM\BackendBundle\Command;
9
10
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
class MailChimpListsCommand extends ContainerAwareCommand
15
{
16
    protected function configure()
17
    {
18
        $this
19
            ->setName('bcrm:mailchimp:lists')
20
            ->setDescription('List the available mailchimp lists');
21
    }
22
23
    protected function execute(InputInterface $input, OutputInterface $output)
24
    {
25
        /* @var \Coderbyheart\MailChimpBundle\MailChimp\Api $mailchimp */
26
        $mailchimp = $this->getContainer()->get('mailchimp');
27
        $output->writeln('Available lists in our mailchimp account:');
28
        foreach ($mailchimp->listsList()->data as $list) {
29
            $output->writeln(sprintf('%s (%s)', $list->name, $list->id));
30
        }
31
    }
32
}
33