protected function execute(InputInterface $input, OutputInterface $output)
{
$locale = $input->getOption('locale');
$seed = $input->getOption('seed');
$format = $input->getOption('format');
$count = $input->getOption('count');
$type = $input->getArgument('type');
$args = $input->getArgument('args');
$data = array();
$faker = Factory::create($locale);
if ($seed) {
$faker->seed($seed);
}
for ($i = 0; $i < $count; $i++) {
$data[] = $faker->format($type, $args);
}
switch ($format) {
case 'json':
$this->outputJson($output, $data);
break;
case 'xml':
$this->outputXml($output, $data);
break;
case 'csv':
$this->outputCsv($input, $output, $data);
break;
case 'php':
$this->outputPhp($output, $data);
break;
case 'printf':
$this->outputPrintf($input, $output, $data);
break;
case 'vprintf':
$this->outputVprintf($input, $output, $data);
break;
default:
throw new \RuntimeException('Unknown output format ' . $format);
}
}