/**
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $container = $this->getContainer();
     $container->set("request", new Request());
     $container->get("request")->setSession(new Session(new MockArraySessionStorage()));
     $container->enterScope("request");
     try {
         $container->get("event_dispatcher")->dispatch(TheliaStudioEvents::LAUNCH_MODULE_BUILD, new ModuleGenerateEvent($input->getArgument("moduleCode"), $input->getOption("tables"), ['php'], ["Loop"]));
         $output->renderBlock(array('', 'Everything has been generated successfully', 'Files available in your module directory', ''), 'bg=green;fg=black');
     } catch (\Exception $e) {
         $outputArray = explode("\n", $e->getMessage());
         array_push($outputArray, '');
         array_unshift($outputArray, '');
         $output->renderBlock($outputArray, 'bg=red;fg=white');
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->module = $this->formatModuleName($input->getArgument("name"));
     $this->moduleDirectory = THELIA_MODULE_DIR . DIRECTORY_SEPARATOR . $this->module;
     $this->verifyExistingModule();
     $this->createDirectories();
     $this->createFiles();
     if (method_exists($this, "renderBlock")) {
         //impossible to change output class in CommandTester...
         $output->renderBlock(array('', sprintf("module %s create with success", $this->module), "You can now configure your module and complete module.xml file", ''), "bg=green;fg=black");
     }
 }
 /**
  * Check positions consistency
  *
  * @param OutputInterface $output     An OutputInterface instance
  * @param bool            $isAbsolute Set to true or false according to position values
  *
  * @throws \InvalidArgumentException
  *
  * @return bool Continue or stop command
  */
 protected function checkPositions(OutputInterface $output, &$isAbsolute = false)
 {
     $isRelative = false;
     foreach (array_count_values($this->positionsList) as $value => $count) {
         if (is_int($value) && $value[0] !== '+' && $value[0] !== '-') {
             $isAbsolute = true;
             if ($count > 1) {
                 throw new \InvalidArgumentException('Two (or more) absolute positions are identical.');
             }
         } else {
             $isRelative = true;
         }
     }
     if ($isAbsolute && $isRelative) {
         $output->renderBlock(['', 'Mix absolute and relative positions may produce unexpected results !', ''], 'bg=yellow;fg=black');
         /** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */
         $dialog = $this->getHelper('dialog');
         if (!$dialog->askConfirmation($output, '<question>Do you want to continue ? y/[n]<question>', false)) {
             return false;
         }
     }
     return true;
 }