Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Generator / ModuleFileGenerator.php
index 8f8e84e4728ce62e2d38faa39f3193d1c7281d2f..86054b0b71da858b6fda14779df3ccb2ec52e6cc 100644 (file)
@@ -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
             );
         }