/**
  * Create a module
  *
  * @return ConsoleModel
  */
 public function moduleAction()
 {
     // check for help mode
     if ($this->requestOptions->getFlagHelp()) {
         return $this->moduleHelp();
     }
     // output header
     $this->consoleHeader('Creating new module');
     // get needed options to shorten code
     $path = $this->requestOptions->getPath();
     $moduleName = $this->requestOptions->getModuleName();
     $modulePath = $this->requestOptions->getModulePath();
     $moduleViewDir = $this->requestOptions->getModuleViewDir();
     // check for module path and application config
     if (!file_exists($path . '/module') || !file_exists($path . '/config/application.config.php')) {
         return $this->sendError(array(array(Color::NORMAL => 'The path '), array(Color::RED => $path), array(Color::NORMAL => ' doesn\'t contain a ZF2 application.')));
     }
     // check if module name provided
     if (!$moduleName) {
         return $this->sendError(array(array(Color::NORMAL => 'Please provide the module name as parameter.')));
     }
     // check if module exists
     if (file_exists($modulePath)) {
         return $this->sendError(array(array(Color::NORMAL => 'The module '), array(Color::RED => $moduleName), array(Color::NORMAL => ' already exists.')));
     }
     // write start message
     $this->console->write('       => Creating module class for module ');
     $this->console->writeLine($moduleName, Color::GREEN);
     // Create the Module.php
     $this->moduleGenerator->createModule();
     // write start message
     $this->console->write('       => Creating configuration for module ');
     $this->console->writeLine($moduleName, Color::GREEN);
     // Create the module.config.php
     $this->moduleGenerator->createConfiguration();
     // write start message
     $this->console->write('       => Adding module ');
     $this->console->write($moduleName, Color::GREEN);
     $this->console->writeLine(' to application configuration.');
     // add module configuration to application
     $applicationConfig = $this->moduleConfigurator->addModuleConfig();
     // check for module config updates
     if ($applicationConfig) {
         // update module configuration
         $configFlag = $this->moduleGenerator->updateConfiguration($applicationConfig, $path . '/config/application.config.php');
     }
     $this->console->writeLine();
     $this->console->write(' Done ', Color::NORMAL, Color::CYAN);
     $this->console->write(' ');
     $this->console->write('The module ');
     $this->console->write($moduleName, Color::GREEN);
     $this->console->write(' has been created');
     // success
     if ($path !== '.') {
         $this->console->write(' in ');
         $this->console->writeLine($path, Color::GREEN);
     } else {
         $this->console->writeLine();
     }
     // output footer
     $this->consoleFooter('module was successfully created');
 }