<commit_before><?php

namespace Algolia\SearchBundle\Command;


use Algolia\SearchBundle\IndexManagerInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class IndexCommand extends ContainerAwareCommand
{
    protected function getEntitiesFromArgs(InputInterface $input, OutputInterface $output, IndexManagerInterface $indexManager)
    {
        $entities = [];
        $indexNames = [];

        if ($indexList = $input->getOption('indices')) {
            $indexNames = explode(',', $indexList);
        }

        if (empty($indexNames)) {
            return $indexManager->getSearchableEntities();
        }

        $config = $indexManager->getConfiguration();

        foreach ($indexNames as $name) {
            if (isset($config['indices'][$name])) {
                $entities[$name] = $config['indices'][$name]['class'];
            } else {
                $output->writeln('<comment>No index named <info>'.$name.'</info> was found. Check you configuration.</comment>');
            }
        }<commit_msg>fix(command): Get correct names when importing all index<commit_after><?php

namespace Algolia\SearchBundle\Command;


use Algolia\SearchBundle\IndexManagerInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class IndexCommand extends ContainerAwareCommand
{
    protected function getEntitiesFromArgs(InputInterface $input, OutputInterface $output, IndexManagerInterface $indexManager)
    {
        $entities = [];
        $indexNames = [];

        if ($indexList = $input->getOption('indices')) {
            $indexNames = explode(',', $indexList);
        }

        $config = $indexManager->getConfiguration();

        if (empty($indexNames)) {
            $indexNames = array_keys($config['indices']);
        }

        foreach ($indexNames as $name) {
            if (isset($config['indices'][$name])) {
                $entities[$name] = $config['indices'][$name]['class'];
            } else {
                $output->writeln('<comment>No index named <info>'.$name.'</info> was found. Check you configuration.</comment>');
            }
        }
{'fraction_non_alphanumeric': 0.13358778625954199, 'fraction_numerical': 0.0, 'mean_word_length': 3.1385964912280704, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 18, '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': '1755434', 'n_tokens_mistral': 610, 'n_tokens_neox': 604, 'n_words': 119}