X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FGenerator%2FModuleFileGenerator.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FGenerator%2FModuleFileGenerator.php;h=86054b0b71da858b6fda14779df3ccb2ec52e6cc;hp=8f8e84e4728ce62e2d38faa39f3193d1c7281d2f;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Generator/ModuleFileGenerator.php b/vendor/drupal/console/src/Generator/ModuleFileGenerator.php index 8f8e84e47..86054b0b7 100644 --- a/vendor/drupal/console/src/Generator/ModuleFileGenerator.php +++ b/vendor/drupal/console/src/Generator/ModuleFileGenerator.php @@ -16,36 +16,32 @@ use Drupal\Console\Core\Generator\Generator; */ class ModuleFileGenerator extends Generator { + /** - * @param $machine_name - * @param $file_path + * {@inheritdoc} */ - public function generate( - $machine_name, - $file_path - ) { - $dir = $file_path .'/'. $machine_name. '.module'; + public function generate(array $parameters) + { + $machine_name = $parameters['machine_name']; + $file_path = $parameters['file_path']; + + $moduleFilePath = $file_path . '/' . $machine_name . '.module'; - if (file_exists($dir)) { - if (!is_dir($dir)) { + if (file_exists($moduleFilePath)) { + if (!is_dir($moduleFilePath)) { throw new \RuntimeException( sprintf( 'Unable to generate the .module file , it already exist at "%s"', - realpath($dir) + realpath($moduleFilePath) ) ); } } - $parameters = [ - 'machine_name' => $machine_name, - 'file_path' => $file_path , - ]; - if ($machine_name) { $this->renderFile( 'module/module-file.twig', - $file_path . '/' . $machine_name . '.module', + $moduleFilePath, $parameters ); }