addArgument('name', InputArgument::REQUIRED, 'O nome da interface (ex: PaymentInterface)');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$name = $input->getArgument('name');
if (!str_ends_with($name, 'Interface')) {
$name .= 'Interface';
}
$directory = dirname(__DIR__, 2) . '/Interfaces';
$filePath = $directory . '/' . $name . '.php';
if (file_exists($filePath)) {
$output->writeln("A interface '{$name}' já existe!");
return Command::FAILURE;
}
if (!is_dir($directory)) {
mkdir($directory, 0755, true);
}
$year = date('Y');
$template = <<writeln("Interface '{$name}' criada com sucesso em app/Interfaces/");
return Command::SUCCESS;
} else {
$output->writeln("Falha ao criar o arquivo da interface.");
return Command::FAILURE;
}
}
}