<commit_before><?php

/**
 * @file
 * Contains \Drupal\Console\Command\Module\DebugCommand.
 */

namespace Drupal\Console\Command\Module;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Drupal\Console\Command\Shared\ContainerAwareCommandTrait;
use Drupal\Console\Style\DrupalStyle;

class DebugCommand extends Command
{
    use ContainerAwareCommandTrait;

    protected function configure()
    {
        $this
            ->setName('module:debug')
            ->setDescription($this->trans('commands.module.debug.description'))
            ->addArgument(
                'module',
                InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
                $this->trans('commands.module.debug.module')
            )
            ->addOption(
                'status',
                null,
                InputOption::VALUE_OPTIONAL,
                $this->trans('commands.module.debug.options.status')
            )
            ->addOption(
                'type',
                null,
                InputOption::VALUE_OPTIONAL,
                $this->trans('commands.module.debug.options.type')
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new DrupalStyle($input, $output);

        $this->get('site')->loadLegacyFile('/core/modules/system/system.module');

        $status = $input->getOption('status');
        $type = $input->getOption('type');
        $modules = $input->getArgument('module');

        if ($modules) {
            $config = $this->getApplication()->getConfig();
            foreach ($modules as $module) {
                $url = sprintf(
                    '%s/packages/drupal/%s.json',
                    $config->get('application.composer.packages.default'),
                    $module
                );

                try {
                    $data = $this->getApplication()->getHttpClientHelper()->getUrlAsJson($url);
                } catch (\Exception $e) {
                    $io->error(
                        sprintf(
                            $this->trans('commands.module.debug.messages.no-results'),
                            $module
                        )
                    );

                    return 1;
                }<commit_msg>Added Drupal-Packagist repo for searching the module (#2460)<commit_after><?php

/**
 * @file
 * Contains \Drupal\Console\Command\Module\DebugCommand.
 */

namespace Drupal\Console\Command\Module;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Drupal\Console\Command\Shared\ContainerAwareCommandTrait;
use Drupal\Console\Style\DrupalStyle;

class DebugCommand extends Command
{
    use ContainerAwareCommandTrait;

    protected function configure()
    {
        $this
            ->setName('module:debug')
            ->setDescription($this->trans('commands.module.debug.description'))
            ->addArgument(
                'module',
                InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
                $this->trans('commands.module.debug.module')
            )
            ->addOption(
                'status',
                null,
                InputOption::VALUE_OPTIONAL,
                $this->trans('commands.module.debug.options.status')
            )
            ->addOption(
                'type',
                null,
                InputOption::VALUE_OPTIONAL,
                $this->trans('commands.module.debug.options.type')
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new DrupalStyle($input, $output);

        $this->get('site')->loadLegacyFile('/core/modules/system/system.module');

        $status = $input->getOption('status');
        $type = $input->getOption('type');
        $modules = $input->getArgument('module');

        if ($modules) {
            $config = $this->getApplication()->getConfig();
            $repo = $config->get('application.composer.repositories.default');

            foreach ($modules as $module) {
                $url = sprintf(
                    '%s/packages/drupal/%s.json',
                    $config->get('application.composer.packages.default'),
                    $module
                );

                try {
                    $data = $this->getApplication()->getHttpClientHelper()->getUrlAsJson($repo . $url);

                } catch (\Exception $e) {
                    $io->error(
                        sprintf(
                            $this->trans('commands.module.debug.messages.no-results'),
                            $module
                        )
                    );

                    return 1;
                }
{'fraction_non_alphanumeric': 0.12534219788815018, 'fraction_numerical': 0.0011732499022291747, 'mean_word_length': 1.7250932338838572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '3086650', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1262, 'n_words': 188}