protected function handleType(TypeGenerator $generator, Type $type, $path)
{
// Handle existing class:
if ($this->filesystem->fileExists($path)) {
if ($this->handleExistingFile($generator, $type, $path)) {
return true;
}
// Ask if a class can be overwritten if it contains errors
if (!$this->askForOverwrite()) {
$this->output->writeln(sprintf('Skipping %s', $type->getName()));
return false;
}
}
// Try to create a blanco class:
try {
$file = new FileGenerator();
$this->generateType($file, $generator, $type, $path);
} catch (\Exception $e) {
$this->output->writeln('<fg=red>' . $e->getMessage() . '</fg=red>');
return false;
}
return true;
}