// Check if the directory to save the file is existing.
$dir =
dirname($target);
if (!
is_dir($dir)) { mkdir($dir, 0755, true
);
} helper('filesystem'
);
// Build the class based on the details we have, We'll be getting our file
// contents from the template, and then we'll do the necessary replacements.
if (!
write_file($target,
$content)) { // @codeCoverageIgnoreStart
CLI::
error(lang('CLI.generator.fileError',
[clean_path($target)]), 'light_gray', 'red'
);
CLI::
newLine();
return;
// @codeCoverageIgnoreEnd
} if ($this->
getOption('force'
) &&
$isFile) { CLI::
write(lang('CLI.generator.fileOverwrite',
[clean_path($target)]), 'yellow'
);
CLI::
newLine();