Generate Route
@param InputInterface $input
@param OutputInterface $output
@return mixed
181163
public function createRoute(InputInterface $input, OutputInterface $output)
    {
        $router = $this->getApplication()->find('create:router');
        $router_arguments = array(
            'command'       => 'create:router',
            'module'        => $input->getArgument('module'),
            'controller'    => $input->getArgument('table'),
            'action'        => 'index'
        );
        $input_router = new ArrayInput($router_arguments);
        $return_router = $router->run($input_router,$output);
        return $output->writeln($return_router);
    }
49316
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getOption('path');
        $failOnly = $input->getOption('fail-only');
        $format = $input->getOption('format');
        $context = $input->getOption('context');
        $threshold = $input->getOption('threshold');
        $version = $input->getOption('php');
        $outputPath = $input->getOption('output');

        if ($format === 'html' && $outputPath === null) {
            throw new \InvalidArgumentException('Output path must be set for format "HTML"');
        }

        $context = ($context !== null)
            ? explode(', ', $context) : array();

        // If we're not given a version, assume the current version
        if ($version === null) {
            $version = PHP_VERSION;
        }

        // if we're not given a path at all, try to figure it out
        if ($path === null) {
            $path = php_ini_loaded_file();
        }

        if (!is_file($path)) {
            throw new \Exception('Path is null or not accessible: "'.$path.'"');
        }

        $scan = new \Psecio\Iniscan\Scan($path, $context, $threshold, $version);
        $results = $scan->execute();
        $deprecated = $scan->getMarked();

        $options = array(
            'path' => $path,
            'failOnly' => $failOnly,
            'deprecated' => $deprecated,
            'verbose' => $input->getOption('verbose'),
            'output' => $outputPath
        );

        $format = ($format === null) ? 'console' : $format;
        $formatClass = "\\Psecio\\Iniscan\\Command\\ScanCommand\\Output\\".ucwords(strtolower($format));
        if (!class_exists($formatClass)) {
            throw new \Psecio\Iniscan\Exceptions\FormatNotFoundException('Output format "'.$format.'" not found');
        }
        $outputHandler = new $formatClass($output, $options);
        return $outputHandler->render($results);
    }
789661
public function run(InputInterface $input, OutputInterface $output)
    {
        parent::run($input, $output);
        $formTask = new GenerateForm(
            [
                'command' => $this->_command,
                'controllerData' => $this->_controllerData,
                'path' => $this->getPath()
            ]
        );
        return $formTask->run($input, $output);
    }
764917
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);

        $builderName = $input->getArgument('builder-name');
        $basepath = $input->getArgument('basepath');
        $language = $input->getOption('language');
        $sitemapDumper = $this
            ->container
            ->get('elcodi.sitemap_dumper.' . $builderName);

        $sitemapDumper->dump(
            $basepath,
            $language
        );

        $this->finishCommand($output);
    }
833285
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setIo($input, $output);

        $outputFile = $input->getOption('generate');

        $output->writeln("<info>Generating your {$outputFile}...</info>");
        $output->writeln("<comment>{$this->banner}\n</comment>");

        $generated['source'] = $this->setupSources();
        $generated['build'] = $this->setupBuild();
        $generated['deploy'] = $this->setupDeploy();
        $generated['gulp'] = $this->setupGulp();
        $generated['serve'] = $this->setupServe($generated);

        $yaml = $this->createYaml($generated);

        if ($input->getOption('dry-run')) {

            $output->writeln("\n<info>Ready to write config file</info>");
            $output->writeln($yaml);

            if ( ! $this->confirm("Write the above configuration to <path>{$outputFile}</path>?")) {
                return $output->writeln('<error>Aborted!</error>');
            }
        }

        if ( ! $this->files->put($outputFile, $yaml)) {
            return $output->writeln('<error>Failed to save config file.</error>');
        }

        $output->writeln("<info>Success! <path>{$outputFile}</path> written.</info>");

        if ( ! empty($generated['source']['git.url'])) {
            $output->writeln("Try a <comment>steak pull</comment> next to fetch your sources...");
        } else {
            $output->writeln("Try <comment>steak serve</comment> to start building your site...");
        }
    }
1042130
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $name = strtolower($input->getArgument('name'));
    $action = $input->getOption('action');

    $migrationFile = ModulusCLI::$appdir . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR . '0000_00_00_00_00_00_migrations.php';

    require $migrationFile;

    if (Capsule::schema()->hasTable('migrations') == false) {
      if (file_exists($migrationFile)) {
        call_user_func(['Migrations', 'up']);
      }
      else {
        return $output->writeln('<error>The migrations file is missing</error>');
      }
    }

    $migrationsDir = ModulusCLI::$appdir . DIRECTORY_SEPARATOR . 'database' . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR;

    if ($name == 'all') {
      $succesful = [];

      foreach(glob($migrationsDir.'*.php') as $migration) {
        $migrationPath = substr($migration, strrpos($migration, '/') + 1);
        $className = substr($this->className(substr($migration, strrpos($migration, '/') + 1)), 0, -4);

        if ($className != 'Migrations') {
          require $migration;

          $migrationResponse = $this->migrateAll($migrationPath, $className, $action);
          if ($migrationResponse != 0 || $migrationResponse != 'Couldn\'t migrate. See log for more information') {
            $succesful[] = $migrationPath;
          }
        }

      }

      if (count($succesful) == 0) {
        return $output->writeln('Nothing to migrate');
      }

      foreach($succesful as $succesfulMigration) {
        $output->writeln('<info>"' . substr($succesfulMigration, 0, -4).'" was successful.</info>');
      }

      return;
    }

    $migrationFile = $migrationsDir . $name . '.php';

    if (file_exists($migrationFile)) {
      require $migrationFile;

      $className = $this->className(substr($name, strrpos($name, '/') + 1));

      if ($className != 'Migrations') {
        $migrationResponse = $this->migrateAll($name.'.php', $className, $action);
        if ($migrationResponse != 0 || $migrationResponse != 'Couldn\'t migrate. See log for more information') {
          return $output->writeln('<info>"' . $name.'" was successful.</info>');
        }
        else {
          return $output->writeln('Nothing to migrate');
        }
      }
    }
    else {
      $output->writeln('<error>"'.$migrationFile.'" migration file does not exist</error>');
    }
  }
1052110
private function generateEncryptRequest(InputInterface $input, OutputInterface $output)
    {
        $algorithmId = $input->getArgument('algorithm_id');
        $plaintextValue = $input->getArgument('plaintext_value');
        $key = $input->getOption('key');
        $keyProvided = $input->hasParameterOption(['--key', '-k']);

        $questionText = 'Plaintext value to be encrypted (hidden input): ';
        $plaintextAsker = $this->questionAskerGenerator
            ->generateHiddenInputQuestionAsker($questionText, $input, $output);

        return $this->encryptRequestFactory
            ->createEncryptRequest($algorithmId, $key, $keyProvided, $plaintextAsker, $plaintextValue);
    }
1157482
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Start generating...');
        $generated = $this->getFacade()->generateDataProvider();

        if ($output->isVerbose()) {
            foreach ($generated as $provider) {
                $output->writeln($provider . ' generated');
            }
        }
    }
419662
public function execute(InputInterface $input, OutputInterface $output)
    {
        $argument = $input->getArgument($this->argumentName);
        $path = $this->basePath.'/'.$argument.'.php';

        if ($input->hasOption('restful') && $input->getOption('restful') == true) {
            $this->restful = true;
        } else {
            $this->restful = false;
        }

        $response = $this->runFileGeneratorCommand($path, $argument);

        if ($response === true) {
            $this->type ?: $this->type = 'Command';
            $output->writeln(ucfirst($this->type).' created successfully');

            return;
        }
        $output->writeln($response);
    }
946925
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);

        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');

        $nodeRef = NodeRef::fromString($input->getArgument('node-ref'));
        $consistent = $input->getOption('consistent') ? true : false;

        try {
            $node = $this->ncr->getNode($nodeRef, $consistent, $context);
            echo json_encode($node, $input->getOption('pretty') ? JSON_PRETTY_PRINT : 0) . PHP_EOL;
        } catch (\Throwable $e) {
            $errOutput->writeln($e->getMessage());
        }
    }
23092
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $params = array();
        $params = array_merge($input->getArguments(), $input->getOptions());

        if (!is_dir($params['mapping-directory'])) {
            throw new \InvalidArgumentException('Invalid mapping sources directory');
        }

        if (null == $params['models-directory']) {
            $params['models-directory'] = $params['mapping-directory'];
        }

        $parserClass = (strpos($params['parser'], '\\') === false) ? '\\Boomgo\\Parser\\'.ucfirst($params['parser']).'Parser' : $params['parser'];
        $formatterClass = (strpos($params['formatter'], '\\') === false) ? '\\Boomgo\\Formatter\\'.ucfirst($params['formatter']).'Formatter' : $params['formatter'];

        $formatter = new $formatterClass;
        $parser = new $parserClass;

        $mapBuilder = new MapBuilder($parser, $formatter);
        $twigGenerator = new TwigGenerator();
        $mapperGenerator = new MapperGenerator($mapBuilder, $twigGenerator);

        $mapperGenerator->generate($params['mapping-directory'], $params['models-namespace'], $params['mappers-namespace'], $params['models-directory']);

        $output->writeln('<info>Mappers have been generated</info>');
    }
1139260
protected function getMigrationPath(InputInterface $input, OutputInterface $output)
    {
        // First, try the non-interactive option:
        $path = $input->getOption('path');

        if (!empty($path)) {
            return $path;
        }

        $paths = $this->getConfig()->getMigrationPaths();

        // No paths? That's a problem.
        if (empty($paths)) {
            throw new \Exception('No migration paths set in your Phinx configuration file.');
        }

        $paths = Util::globAll($paths);

        if (empty($paths)) {
            throw new \Exception(
                'You probably used curly braces to define migration path in your Phinx configuration file, ' .
                'but no directories have been matched using this pattern. ' .
                'You need to create a migration directory manually.'
            );
        }

        // Only one path set, so select that:
        if (1 === count($paths)) {
            return array_shift($paths);
        }

        // Ask the user which of their defined paths they'd like to use:
        $helper = $this->getHelper('question');
        $question = $this->getSelectMigrationPathQuestion($paths);

        return $helper->ask($input, $output, $question);
    }
93710
private function doDump(OutputInterface $output)
    {
        if (!is_dir($dir = dirname($this->targetPath))) {
            $output->writeln('<info>[dir+]</info>  ' . $dir);
            if (false === @mkdir($dir, 0777, true)) {
                throw new \RuntimeException('Unable to create directory ' . $dir);
            }
        }

        $output->writeln('<info>[file+]</info> ' . $this->targetPath);

        $templates = [
            'js' => "this.%s = route('%s');\n",
            'es6' => "\t\t\t'%s': '%s',\n"
        ];

        $type = $this->parameterBag->get('netbull_core.js_type');

        $routes = '';
        foreach ($this->extractor->getRoutes() as $name => $route) {
            preg_match_all("/{(.*?)}/i", $route->getPath(), $routeParams);

            if (0 < count($routeParams)) {
                $parameters = array_flip($routeParams[1]);
                $normalizedRoute = preg_replace_callback("/{(.*?)}/i", function($m) use($parameters) {
                    return ':' . ($parameters[$m[1]] + 1);
                }, $route->getPath());

                $routes .= sprintf($templates[$type], $name, $normalizedRoute);
            }
        }

        $source = file_get_contents(__DIR__ . '/../Resources/js/router.' . $type . '.js');
        $content = str_replace('//<ROUTES>', $routes, $source);

        if (false === @file_put_contents($this->targetPath, $content)) {
            throw new \RuntimeException('Unable to write file ' . $this->targetPath);
        }
    }
260941
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);

        $batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 1000);
        $batchDelay = NumberUtils::bound($input->getOption('batch-delay'), 100, 600000);
        $since = $input->getOption('since');
        $until = $input->getOption('until');
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');
        $streamId = $input->getArgument('stream-id') ? StreamId::fromString($input->getArgument('stream-id')) : null;

        if (!empty($since)) {
            $since = Microtime::fromString(str_pad($since, 16, '0'));
        }

        if (!empty($until)) {
            $until = Microtime::fromString(str_pad($until, 16, '0'));
        }

        $i = 0;
        $receiver = function (Event $event, StreamId $streamId) use ($errOutput, $batchSize, $batchDelay, &$i) {
            ++$i;

            try {
                echo json_encode($event) . PHP_EOL;
            } catch (\Throwable $e) {
                $errOutput->writeln($e->getMessage());
            }

            if (0 === $i % $batchSize) {
                if ($batchDelay > 0) {
                    usleep($batchDelay * 1000);
                }
            }
        };

        if ($streamId) {
            $this->getPbjx()->getEventStore()->pipeEvents($streamId, $receiver, $since, $until, $context);
        } else {
            $this->getPbjx()->getEventStore()->pipeAllEvents($receiver, $since, $until, $context);
        }
    }
1292311
public function execute(InputInterface $input, OutputInterface $output)
    {
        return $this->go(new Input($input), new Output($output));
    }
686902
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $docs = new Parser(APP_PATH);
        $docs->parse();

        // {{
        $this->title('所有路由规则');
        // }}

        foreach ($docs as $class => $doc) {
            foreach ((array) $doc['methods'] as $method) {
                $this->writeln(
                    sprintf(
                        ' <info>-</> <success>%s</> <title>%s</> <info>-></> %s',
                        str_pad(strtoupper($method), 4),
                        str_pad($doc['route'], 30),
                        $class
                    )
                );
            }
        }

        $this->newLine();

        return 0;
    }
809136
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getOption('path');
        $context = array();

        // if we're not given a path at all, try to figure it out
        if ($path === null) {
            $path = php_ini_loaded_file();
        }

        if (!is_file($path)) {
            throw new \Exception('Path is null or not accessible: "'.$path.'"');
        }

        $scan = new \Psecio\Iniscan\Scan($path, $context);
        $scan->execute();

        $scan->getMarked();
        $result = pathinfo($path);

        // to start, we need a backup of the file (overwrite if there)
        $backupPath = './'.$result['basename'].'-'.date('mdy');
        copy($path, $backupPath);

        // Now les get our rules and parse them
        $scan = new \Psecio\Iniscan\Scan($path, $context);
        $rules = get_object_vars($scan->getRules());

        $output->writeLn($this->generateIniOutput($rules));
    }