<commit_before><?php

namespace Welp\MailchimpBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;

use Welp\MailchimpBundle\Provider\ProviderInterface;
use Welp\MailchimpBundle\Subscriber\ListRepository;

class WebhookCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setDescription('Add main webhook to a MailChimp List')
            ->setName('welp:mailchimp:webhook')
        ;
        // @TODO add params : listId, webhookurl
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln(sprintf('<info>%s</info>', $this->getDescription()));

        $lists = $this->getContainer()->getParameter('welp_mailchimp.lists');
        if (sizeof($lists) == 0) {
            throw new \RuntimeException("No Mailchimp list has been defined. Check the your config.yml file based on MailchimpBundle's README.md");
        }

        foreach ($lists as $listId => $listParameters) {
            $url = $listParameters['webhook_url'].'?hooksecret='.$listParameters['webhook_secret'];
            $this->getContainer()->get('welp_mailchimp.list_repository')
                ->registerMainWebhook($listId, $url);<commit_msg>add output to webhook command<commit_after><?php

namespace Welp\MailchimpBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;

use Welp\MailchimpBundle\Provider\ProviderInterface;
use Welp\MailchimpBundle\Subscriber\ListRepository;

class WebhookCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setDescription('Add main webhook to a MailChimp List')
            ->setName('welp:mailchimp:webhook')
        ;
        // @TODO add params : listId, webhookurl
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln(sprintf('<info>%s</info>', $this->getDescription()));

        $lists = $this->getContainer()->getParameter('welp_mailchimp.lists');
        if (sizeof($lists) == 0) {
            throw new \RuntimeException("No Mailchimp list has been defined. Check the your config.yml file based on MailchimpBundle's README.md");
        }

        foreach ($lists as $listId => $listParameters) {
            $url = $listParameters['webhook_url'].'?hooksecret='.$listParameters['webhook_secret'];
            $output->writeln('Add webhook to list: '.$listId);
            $output->writeln('Webhook url: '.$url);

            $this->getContainer()->get('welp_mailchimp.list_repository')
                ->registerMainWebhook($listId, $url);
{'fraction_non_alphanumeric': 0.12060967528164347, 'fraction_numerical': 0.0006626905235255136, 'mean_word_length': 3.702492211838006, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 29, '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': '2244428', 'n_tokens_mistral': 842, 'n_tokens_neox': 826, 'n_words': 163}