Method returns list of languages

@param InputInterface  $input  Input interface
@param OutputInterface $output Output interface

@see Command
@return mixed
185737
protected function interact(InputInterface $input, OutputInterface $output)
    {
        if (!$input->getArgument('bundle')) {
            $bundle = $this->getHelper('dialog')->askAndValidate(
                $output,
                'Please give the bundle:',
                function($bundle)
                {
                    if (empty($bundle)) {
                        throw new \Exception('Bundle can not be empty');
                    }

                    return $bundle;
                }
            );
            $input->setArgument('bundle', $bundle);
        }
    }
1210563
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->nyrodev->increasePhpLimits();
        $dir = $input->getArgument('dir');
        $suffix = $input->getArgument('suffix');
        $extension = $input->getArgument('extension');

        $translationDb = $this->nyrodev->getParameter('nyroDev_utility.translationDb');
        if (!$translationDb) {
            $output->writeln('translationDB is not configured, exiting');

            return;
        }

        $locale = $this->nyrodev->getParameter('locale');
        $locales = explode('|', $this->nyrodev->getParameter('locales'));
        if (0 == count($locales)) {
            $output->writeln('locales is not configured or empty, exiting');

            return;
        }

        $output->writeln('Search for original translations files');
        $originals = array();
        $finder = new Finder();
        $translations = $finder
                    ->directories()
                    ->in('./'.$dir)
                    ->name('translations');

        foreach ($translations as $translation) {
            $finderTr = new Finder();
            $files = $finderTr->files()->in($translation->getRealpath())->name('*.'.$locale.$suffix.'.'.$extension);
            foreach ($files as $file) {
                $originals[] = $file->getRealpath();
            }
        }

        $nbO = count($originals);
        if ($nbO) {
            $repo = $this->db->getRepository($translationDb);
            $this->className = $repo->getClassName();
            $this->accessor = PropertyAccess::createPropertyAccessor();

            $output->writeln('Retrieving existing translations');
            $this->existing = array();
            foreach ($repo->findAll() as $row) {
                $this->existing[$row->getDomain().'-'.$row->getLocale().'-'.$row->getIdent()] = true;
            }

            $output->writeln('Parsing '.$nbO.' translation files');
            $nbTrunc = -2 - strlen($extension) - strlen($locale) - strlen($suffix);
            $fs = new Filesystem();
            $nb = 0;
            foreach ($originals as $original) {
                $output->writeln('Start fetching '.$original);
                $domain = substr(basename($original), 0, $nbTrunc);
                $dir = dirname($original);

                $trans = Yaml::parse(file_get_contents($original));

                foreach ($locales as $loc) {
                    $curTrans = $trans;
                    if ($loc != $locale) {
                        $default = $dir.'/'.$domain.'.'.$loc.$suffix.'.'.$extension;
                        if ($fs->exists($default)) {
                            $curTrans = $this->mergeTr($curTrans, Yaml::parse(file_get_contents($default)));
                        }
                    }
                    $cur = $this->createNewTrans($domain, $loc, $curTrans);
                    $output->writeln($loc.' : '.$cur);
                    $nb += $cur;
                }
            }

            $output->writeln('Added translations: '.$nb);
            $output->writeln('Flushing...');
            $this->db->flush();
        } else {
            $output->writeln('No original translation files found.');
        }
    }
910792
public function all(OutputInterface $output, array $response)
    {
        $this->printTable($output,
            ['Key', 'Name', 'Type', 'Public', 'Dependencies', 'Outdated', 'Updated At', 'Bad Licenses', 'Unknown Licenses'],
            ['ids', 'name', 'project_type', 'public', 'dep_number', 'out_number', 'updated_at', 'licenses_red', 'licenses_unknown'],
            $response,
            function ($key, $value) use ($output) {
                if ('public' === $key) {
                    return $value === 1 ? 'Yes' : 'No';
                }

                if (!in_array($key, ['out_number', 'licenses_red', 'licenses_unknown'], true)) {
                    return $value;
                }

                return $this->printBoolean($output, $value > 0 ? $value : 'No', $value, !$value, false);
            }
        );
    }
631530
protected function getCommandArguments(InputInterface $input)
    {
        $package = $this->getPackageInformation($input->getOption('package'));

        return [
            $this->getComposer(),
            $this->composerOperation,
            $package,
        ];
    }
134126
protected function showGeneratorList(OutputInterface $output)
    {
        $output->writeln("<comment>Available generators:</comment>");
        $helpCommand = "<info>{$this->getName()} help [generator]</info>";
        $output->writeln("Use {$helpCommand} for more information on each generator.");

        $rows = [];

        /** @var GeneratorInterface $generator */
        foreach ($this->dispatcher->getRegistry()->getGenerators() as $generator) {
            $rows[] = array("<info>{$generator->getName()}</info>", $generator->getDescription());
        }

        /** @var TableHelper $table */
        $table = $this->getHelper('table');
        $table->setLayout(TableHelper::LAYOUT_BORDERLESS);
        $table->setHorizontalBorderChar('');
        $table->setRows($rows);
        $table->render($output);
    }
806200
protected function listReporters(OutputInterface $output)
    {
        $output->writeln("");
        foreach ($this->factory->getReporters() as $name => $info) {
            $output->writeln(sprintf("    %s - %s", $name, $info['description']));
        }
        $output->writeln("");
    }
1071262
public function createTable(InputInterface $input, OutputInterface $output)
    {
        $databse = $this->getApplication()->find('create:table');
        $databse_arguments = array(
            'command'   => 'create:table',
            'table'     => $input->getArgument('table'),
            'column'    => $input->getArgument('column')
        );
        $input_db   = new ArrayInput($databse_arguments);
        $return_db  = $databse->run($input_db,$output);
        return $output->writeln($return_db);
    }
1369937
public function getCredentials(OutputInterface $output)
    {
        $credentials = $this->parser->getCredentials();
        if ( is_null($credentials)) {
            $this->showErrorRunLlumInitFirst($output,"Credentials");
        };
        return $credentials;
    }
468924
protected function execute(InputInterface $input, OutputInterface $output) : ?int
    {
        $loggerHelper = new LoggerHelper();
        $logger       = $loggerHelper->create($output);

        /** @var string $resources */
        $resources = $input->getOption('resources');

        $failed  = false;
        $command = $this->getApplication()->find('validate-browsers');

        $input = new ArrayInput(
            [
                'command' => 'validate-browsers',
                '--resources' => $resources,
            ]
        );

        $returnCode = $command->run($input, $output);

        if (0 < $returnCode) {
            $logger->error('There was an error executing the "validate-browsers" command, cannot continue.');

            $failed = true;
        }
        $command = $this->getApplication()->find('validate-devices');

        $input = new ArrayInput(
            [
                'command' => 'validate-devices',
                '--resources' => $resources,
            ]
        );

        $returnCode = $command->run($input, $output);

        if (0 < $returnCode) {
            $logger->error('There was an error executing the "validate-devices" command, cannot continue.');

            $failed = true;
        }

        $command = $this->getApplication()->find('validate-engines');

        $input = new ArrayInput(
            [
                'command' => 'validate-engines',
                '--resources' => $resources,
            ]
        );

        $returnCode = $command->run($input, $output);

        if (0 < $returnCode) {
            $logger->error('There was an error executing the "validate-engines" command, cannot continue.');

            $failed = true;
        }

        $command = $this->getApplication()->find('validate-platforms');

        $input = new ArrayInput(
            [
                'command' => 'validate-platforms',
                '--resources' => $resources,
            ]
        );

        $returnCode = $command->run($input, $output);

        if (0 < $returnCode) {
            $logger->error('There was an error executing the "validate-platforms" command, cannot continue.');

            $failed = true;
        }

        $command = $this->getApplication()->find('validate-core-divisions');

        $input = new ArrayInput(
            [
                'command' => 'validate-core-divisions',
                '--resources' => $resources,
            ]
        );

        $returnCode = $command->run($input, $output);

        if (0 < $returnCode) {
            $logger->error('There was an error executing the "validate-core-divisions" command, cannot continue.');

            $failed = true;
        }

        $command = $this->getApplication()->find('validate-divisions');

        $input = new ArrayInput(
            [
                'command' => 'validate-divisions',
                '--resources' => $resources,
            ]
        );

        $returnCode = $command->run($input, $output);

        if (0 < $returnCode) {
            $logger->error('There was an error executing the "validate-divisions" command, cannot continue.');

            $failed = true;
        }

        if (!$failed) {
            $output->writeln('the files are valid');
        }

        return (int) $failed;
    }
239355
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->requireConfig();

        $output->writeln('Starting <fg=blue>Magallanes</>');
        $output->writeln('');

        $output->writeln(sprintf('<comment>%s</comment>', var_export($this->runtime->getConfiguration(), true)));

        $output->writeln('');
        $output->writeln('Finished <fg=blue>Magallanes</>');

        return 0;
    }
817440
protected function processLanguage(OutputInterface $output, $language)
    {
        $this->writeln($output, sprintf('processing language: <info>%s</info>...', $language));

        $destinationFiles = array();
        foreach ($this->baseFiles as $file) {
            $this->writelnVerbose($output, sprintf('processing file: <info>%s</info>...', $file));

            $srcFile = $this->getLanguageBasePath() . DIRECTORY_SEPARATOR . $language . DIRECTORY_SEPARATOR . $file;

            // not a file from transifex received yet.
            if (!file_exists($srcFile)) {
                continue;
            }

            $src = new XliffFile($srcFile);

            $domain = $src->getOriginal();

            if ($domain != basename($file, '.xlf')) {
                throw new \InvalidArgumentException(
                    sprintf(
                        'Unexpected domain "%s" found in file "%s" instead of domain "%s"',
                        $domain,
                        $srcFile,
                        basename($file, '.xlf')
                    )
                );
            }

            $dstFile            = $domain . '.php';
            $destinationFiles[] = $dstFile;

            $dstDir = $this->getDestinationBasePath() . DIRECTORY_SEPARATOR . $language;
            if (!is_dir($dstDir)) {
                mkdir($dstDir, 0755, true);
            }

            $dest = new ContaoFile($dstDir . DIRECTORY_SEPARATOR . $dstFile);

            $changed = $this->convert($src, $dest);

            if ($changed) {
                $dest->setLanguage($language);
                $dest->setTransifexProject($this->project);
                $dest->setLastChange($src->getDate());

                if ($dest->getKeys()) {
                    $dest->save();
                } else {
                    unlink($dstDir . DIRECTORY_SEPARATOR . $dstFile);
                    // @codingStandardsIgnoreStart - Catch the error when directory is not empty.
                    @rmdir($dstDir);
                    // @codingStandardsIgnoreEnd
                }
            }
        }

        $this->cleanupObsoleteFiles($output, $language, $destinationFiles);
    }
767543
protected function getRepositoryAndIndices(
        InputInterface $input,
        OutputInterface $output
    ): array {
        $appName = $input->getArgument('app-name');
        $configuration = $this->repositoryBucket->getConfiguration();

        if (!isset($configuration[$appName])) {
            throw new Exception(sprintf('App %s not found under apisearch configuration', $appName));
        }

        $appId = $configuration[$appName]['app_id'];
        self::printInfoMessage(
            $output,
            $this->getHeader(),
            "App: <strong>{$appName} / {$appId}</strong>"
        );

        if (!$input->hasOption('index-name')) {
            return [$configuration[$appName]['app_id'], []];
        }

        $indexNamesAsArray = $configuration[$appName]['indices'] ?? [];

        $indices = array_map(function (string $indexName) use ($indexNamesAsArray, $appName, $output) {
            if (!isset($indexNamesAsArray[$indexName])) {
                throw new Exception(sprintf(
                    'Index %s not found under %s repository. Indices availables: %s',
                    $indexName,
                    $appName,
                    implode(', ', array_keys($indexNamesAsArray))
                ));
            }

            $indexId = $indexNamesAsArray[$indexName];
            self::printInfoMessage(
                $output,
                $this->getHeader(),
                "Index: <strong>{$indexName} / {$indexId}</strong>"
            );

            return IndexUUID::createById($indexId);
        }, $input->getOption('index-name'));

        return [
            AppUUID::createById($appId),
            $indices,
        ];
    }
321913
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container  = $this->getContainer();
        $translator = $container->get('translator');
        if (!$this->checkRunStatus($input, $output)) {
            return 0;
        }

        /** @var Cache $cacheModel */
        $cacheModel = $container->get('mautic.contactclient.model.cache');
        $output->writeln(
            '<info>'.$translator->trans(
                'mautic.contactclient.maintenance.running'
            ).'</info>'
        );
        $cacheModel->getRepository()
            ->deleteExpired()
            ->reduceExclusivityIndex();
        $output->writeln(
            '<info>'.$translator->trans(
                'mautic.contactclient.maintenance.complete'
            ).'</info>'
        );

        $this->completeRun();

        return 0;
    }
914566
protected function runCommand(InputInterface $input, OutputInterface $output)
    {
        $repository = $this->getRepository($input, $output);
        $parameters = $input->getOption('parameter');
        self::makeQueryAndPrintResults(
            $input,
            $output,
            function (Query $query) use ($repository, $parameters) {
                return $repository->query($query, $parameters);
            }
        );
    }
1071255
protected function collectServices(InputInterface $input, OutputInterface $output) {

    $service_definitions = self::getServiceDefinitions();
    $service_ids = array_keys($service_definitions);

    $services = [];
    while (TRUE) {
      $question = new Question('Type the service name or use arrows up/down. Press enter to continue');
      $question->setValidator([Utils::class, 'validateServiceName']);
      $question->setAutocompleterValues($service_ids);
      $service = $this->ask($input, $output, $question);
      if (!$service) {
        break;
      }
      $services[] = $service;
    }

    $this->vars['services'] = [];
    foreach (array_unique($services) as $service_id) {
      if (isset($service_definitions[$service_id])) {
        $definition = $service_definitions[$service_id];
      }
      else {
        // Build the definition if the service is unknown.
        $definition = [
          'type' => 'Drupal\example\ExampleInterface',
          'name' => str_replace('.', '_', $service_id),
          'description' => "The $service_id service.",
        ];
      }
      $type_parts = explode('\\', $definition['type']);
      $definition['short_type'] = end($type_parts);
      $this->vars['services'][$service_id] = $definition;
    }
    return $this->vars['services'];
  }
391077
protected function execute(InputInterface $input, OutputInterface $output)
    {
		$this->input = $input;
		$this->output = $output;
		$this->force = $input->getOption('force');
		
		$helper = $this->getHelper('question');
		
        $userQuestion = new Question('User (root): ', 'root');
		
        $passwordQuestion = new Question('Password (): ', '');
		$passwordQuestion->setHidden(true);
		$passwordQuestion->setHiddenFallback(false);

        $hostQuestion = new Question('Host (localhost): ', 'localhost');
        $driverQuestion = new Question('Driver (pdo_mysql): ', 'pdo_mysql');
		
		$user = $helper->ask($input, $output, $userQuestion);
		$password = $helper->ask($input, $output, $passwordQuestion);
		$host = $helper->ask($input, $output, $hostQuestion);
		$driver = $helper->ask($input, $output, $driverQuestion);
		
		$connectionParams = array(
			'user' => $user,
			'password' => $password,
			'host' => $host,
			'driver' => $driver
		);
		
		try {
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
			
			$databases = $sm->listDatabases();
			
			$question = new ChoiceQuestion(
				'Database',
				$databases,
				0
			);
			$question->setErrorMessage('Selected database is not valid');

			$dbName = $helper->ask($input, $output, $question);
			$output->writeln('Chosen database: ' . $dbName);
			
			//Add the dbname property
			$connectionParams['dbname'] = $dbName;
			
			$conn = $this->createConnection($connectionParams);
			
			$sm = $conn->getSchemaManager();
		
			$tables = $sm->listTables();
			
			$this->loadConfiguration();
			
			$progress = new ProgressBar($output, count($tables));
			$progress->start();
			
			foreach ($tables as $table) {
				//$output->writeln($table->getName() . " columns:\n\n");
					
				//Columns
				/*
				foreach ($table->getColumns() as $column) {
					//$output->writeln(' - ' . $column->getName() . ': ' . $column->getType() . "\n");
				}
				*/
					
				//Foreign keys
				$name = $table->getName();
				$table = $sm->listTableDetails($name);
				//$foreignKeys = $table->getForeignKeys();
				//$output->writeln("Foreign keys (" . count($foreignKeys) . ")");
				/*
				foreach ($foreignKeys as $foreignKey) {
					//$output->writeln("\n");
					$foreignColumns = $foreignKey->getForeignColumns();
					$localColumns = $foreignKey->getLocalColumns();
					foreach($foreignColumns as $key => $foreignColumn){
						//$output->writeln($foreignKey->getLocalTableName() . "." . $localColumns[$key] . " <=> " . $foreignKey->getForeignTableName() . "." . $foreignColumn . "\n");
					}
				}
				*/
		
				$primaryKeys = $table->getPrimaryKeyColumns();
				//$output->writeln("Primary keys (" . count($primaryKeys) . ")");
				/*
				foreach ($primaryKeys as $primaryKey) {
					//$output->writeln("\n" . $primaryKey);
				}
				*/
				
				//$output->writeln("\n\n");
				$this->generateCode($name, reset($primaryKeys));
				
				$progress->advance();
			}
			
			$progress->finish();
		} catch(\Exception $ex){
			$output->writeln('Generator has found the current exception: ');
			$output->writeln($ex->getMessage());
		}
    }
821712
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->nyrodev->increasePhpLimits();
        $dest = $input->getArgument('dest');
        $dir = $input->getArgument('dir');
        $suffix = $input->getArgument('suffix');
        $extension = $input->getArgument('extension');

        $locale = $this->nyrodev->getParameter('locale');
        $locales = explode('|', $this->nyrodev->getParameter('locales'));
        if (0 == count($locales)) {
            $output->writeln('locales is not configured or empty, exiting');

            return;
        }
        unset($locales[array_search($locale, $locales)]);

        $output->writeln('Search for original translations files');
        $originals = array();
        $finder = new Finder();
        $translations = $finder
                    ->directories()
                    ->in('./'.$dir)
                    ->name('translations');

        foreach ($translations as $translation) {
            $finderTr = new Finder();
            $files = $finderTr->files()->in($translation->getRealpath())->name('*.'.$locale.$suffix.'.'.$extension);
            foreach ($files as $file) {
                $originals[] = $file->getRealpath();
            }
        }

        $nbO = count($originals);
        if ($nbO) {
            $cols = array_merge(array(
                'domain',
                'ident',
                'translation',
            ), $locales);

            if (!file_exists($dest)) {
                $phpExcel = new \PHPExcel();
                $title = $creator = 'Translations';
                $phpExcel->getProperties()->setCreator($creator)
                                ->setLastModifiedBy($creator)
                                ->setTitle($title)
                                ->setSubject($title);
                $sheet = $phpExcel->setActiveSheetIndex(0);
                $sheet->setTitle($title);

                $row = 1;
                $col = 0;
                foreach ($cols as $field) {
                    $sheet->setCellValueByColumnAndRow($col, $row, $field);
                    $sheet->getStyleByColumnAndRow($col, $row)->getFont()->setBold(true);
                    $sheet->getColumnDimensionByColumn($col)->setAutoSize(true);
                    ++$col;
                }
                ++$row;
            } else {
                $fileType = \PHPExcel_IOFactory::identify($dest);
                $objReader = \PHPExcel_IOFactory::createReader($fileType);

                $phpExcel = $objReader->load($dest);
                $sheet = $phpExcel->getActiveSheet();

                $row = $sheet->getHighestDataRow() + 1;
            }

            $output->writeln('Parsing '.$nbO.' translation files');
            $nbTrunc = -2 - strlen($extension) - strlen($locale) - strlen($suffix);
            $fs = new Filesystem();

            $foundTr = array();
            $defLangs = array(
                $locale => null,
            );
            foreach ($locales as $loc) {
                $defLangs[$loc] = null;
            }

            foreach ($originals as $original) {
                $output->writeln('Start fetching '.$original);
                $domain = substr(basename($original), 0, $nbTrunc);
                $dir = dirname($original);

                $trans = $this->flattenTrans(Yaml::parse(file_get_contents($original)));
                foreach ($trans as $k => $v) {
                    $foundTr[$k] = array_merge($defLangs, array($locale => $v));
                }

                foreach ($locales as $loc) {
                    $default = $dir.'/'.$domain.'.'.$loc.$suffix.'.'.$extension;
                    if ($fs->exists($default)) {
                        $trans = $this->flattenTrans(Yaml::parse(file_get_contents($default)));
                        foreach ($trans as $k => $v) {
                            if (isset($foundTr[$k])) {
                                $foundTr[$k][$loc] = $v;
                            } else {
                                $foundTr[$k] = array_merge($defLangs, array($loc => $v));
                            }
                        }
                    }
                }

                foreach ($foundTr as $ident => $trans) {
                    $col = 0;
                    $sheet->setCellValueByColumnAndRow($col, $row, $domain);
                    ++$col;
                    $sheet->setCellValueByColumnAndRow($col, $row, $ident);
                    ++$col;
                    $sheet->setCellValueByColumnAndRow($col, $row, $trans[$locale]);
                    ++$col;
                    foreach ($locales as $loc) {
                        $sheet->setCellValueByColumnAndRow($col, $row, $trans[$loc]);
                        ++$col;
                    }
                    ++$row;
                }
            }

            $sheet->calculateColumnWidths();

            $objWriter = \PHPExcel_IOFactory::createWriter($phpExcel, 'Excel5');
            $objWriter->save($dest);

            $output->writeln('XLS file saved: '.$dest);
        } else {
            $output->writeln('No original translation files found.');
        }
    }