当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper\DialogHelper类代码示例

本文整理汇总了PHP中Symfony\Component\Console\Helper\DialogHelper的典型用法代码示例。如果您正苦于以下问题:PHP DialogHelper类的具体用法?PHP DialogHelper怎么用?PHP DialogHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DialogHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     # get the di container
     $project = $this->getApplication()->getProject();
     # verify if a output file name been passed
     if (($out_file_name = $input->getArgument('out')) === null) {
         $out_file_name = 'schema.xml';
     } else {
         $out_file_name = rtrim($out_file_name, '.xml') . '.xml';
     }
     # load the schema analyser
     $schema_analyser = $project->getSchemaAnalyser();
     #run the analyser
     $schema = $schema_analyser->analyse($project->getDatabase(), $project->getXMLEngineBuilder());
     # write the scheam file to the project folder (sources)
     $sources_io = $project->getSourceIO();
     $formatted_xml = $schema_analyser->format($schema->toXml());
     try {
         #Write config file to the project
         $sources_io->write($out_file_name, '', $formatted_xml, $overrite = false);
         $output->writeLn('<comment>++</comment> <info>sources/' . $out_file_name . '</info>');
     } catch (FileExistException $e) {
         #ask if they want to overrite
         $dialog = new DialogHelper();
         $answer = $dialog->askConfirmation($output, "<question>{$out_file_name} already exists do you want to Overrite? [y|n]</question>:", false);
         if ($answer) {
             #Write config file to the project
             $sources_io->write($out_file_name, '', $formatted_xml, $overrite = true);
             $output->writeLn('<comment>++</comment> <info>sources/' . $out_file_name . '</info>');
         }
     }
 }
开发者ID:icomefromthenet,项目名称:faker,代码行数:32,代码来源:AnalyseCommand.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->app = $this->getApplication();
     $dialog = new DialogHelper();
     $case = $input->getArgument('case');
     if (null == $case) {
         $case = $this->app->getCurrent();
         if ($case == null || $case == 0) {
             $case = $dialog->ask($output, 'Enter a case number: ');
         }
     }
     try {
         $bug = $this->app->fogbugz->search(array('q' => (int) $case, 'cols' => 'ixBug,sTitle,sStatus,sLatestTextSummary,' . 'sProject,sArea,sPersonAssignedTo,sStatus,' . 'sPriority,sCategory,dtOpened,dtResolved,' . 'dtClosed,dtLastUpdated,sFixFor,ixBugParent'));
     } catch (ApiError $e) {
         $output->writeln(sprintf("<error>%s</error>", $e->getMessage()), $this->app->outputFormat);
         exit(1);
     }
     if (0 == $bug->cases['count']) {
         $output->writeln(sprintf('<error>Unable to retrieve [%d]</error>', $case), $this->app->outputFormat);
         exit(1);
     }
     // extract the case to local vars and then include the template
     $data = FogBugzHelpers::responseToArray($bug->cases->case);
     $data['host'] = $this->app->fogbugz->url;
     if ($data['ixBugParent'] == 0) {
         $data['ixBugParent'] = '—';
     }
     $data['statusFormat'] = $this->app->statusStyle($data['sStatus']);
     $template = $this->app->twig->loadTemplate('info.twig');
     $view = $template->render($data);
     $output->write($view, false, $this->app->outputFormat);
 }
开发者ID:enobrev,项目名称:fogbugz-php-cli,代码行数:32,代码来源:ViewCommand.php

示例3: askAuth

 public function askAuth()
 {
     $dialog = new DialogHelper();
     self::$user = $dialog->ask($this->getOutput(), "<question>GitHub User</question> ");
     self::$pass = $dialog->askHiddenResponse($this->getOutput(), "   <question>Password</question> ");
     return $this;
 }
开发者ID:sliver,项目名称:Robo,代码行数:7,代码来源:GitHub.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->app = $this->getApplication();
     $dialog = new DialogHelper();
     if (!empty($this->app->config['AuthToken'])) {
         $this->app->fogbugz = new FogBugz\Api($this->app->config['User'], '', $this->app->config['Host']);
         // The api used to login on instantiation, now we keep this token
         $this->app->fogbugz->token = $this->app->config['AuthToken'];
         if (!$input->getOption('quiet')) {
             $output->writeln("\nYou're already in as <info>" . $this->app->config['User'] . "</info>.\nUse the logout command to terminate this session.\n");
         }
         // TODO: Test this token, and re-prompt if it fails
         return;
     }
     $output->writeln("\n<comment>Please Login to FogBugz</comment>");
     $user = $dialog->ask($output, " * Email address: ", getenv("GIT_AUTHOR_EMAIL"));
     $password = $this->promptSilent(" * Password: ");
     $this->app->fogbugz = new FogBugz\Api($user, $password, $this->app->config['Host']);
     try {
         $this->app->fogbugz->logon();
         $this->app->config = array_merge($this->app->config, array('User' => $user, 'AuthToken' => $this->app->fogbugz->token));
         $this->app->saveConfig();
         $output->writeln("   <info>You're in. Use the logout command to terminate this session.</info>");
     } catch (FogBugz\ApiLogonError $e) {
         $output->writeln("\n<error>" . $e->getMessage() . "</error>\n");
         exit(1);
     }
     // Write the config and the token out to the config file
 }
开发者ID:enobrev,项目名称:fogbugz-php-cli,代码行数:29,代码来源:LoginCommand.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->app = $this->getApplication();
     $dialog = new DialogHelper();
     $case = $input->getArgument('case');
     if (null == $case) {
         $case = $this->app->getCurrent();
         if ($case == null || $case == 0) {
             $case = $dialog->ask($output, "Enter a case number: ");
         }
     }
     $url = trim($this->app->fogbugz->url, "/") . "/default.asp?" . $case;
     switch (PHP_OS) {
         case 'Darwin':
             exec("open {$url}");
             break;
         case 'WIN32':
         case 'WINNT':
             exec("cmd /c \"start {$url}\"");
             break;
         case 'Linux':
         case 'Unix':
         case 'NetBSD':
         case 'OpenBSD':
             exec("xdg-open {$url}");
             break;
         default:
             $output->writeln("<error>Your operating system (" . PHP_OS . ") isn't supported for the open command.</error>", $this->app->outputFormat);
     }
 }
开发者ID:enobrev,项目名称:fogbugz-php-cli,代码行数:30,代码来源:OpenCommand.php

示例6: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $dialog = new DialogHelper();
     if (!$input->getOption('silent')) {
         $confirmed = $dialog->askConfirmation($output, "This will install all TestGuy dependencies through PEAR installer.\n" . "PHPUnit, Symfony Components, and Mink will be installed.\n" . "Make shure this script has permission to install PEAR packages.\n" . "Do you want to proceed? (Y/n)");
         if (!$confirmed) {
             return;
         }
     }
     $output->writeln('Intalling PHPUnit...');
     $output->write(shell_exec('pear config-set auto_discover 1'));
     $output->write(shell_exec('pear install --alldeps pear.phpunit.de/PHPUnit'));
     $output->writeln("Installing Symfony Components...");
     $output->write(shell_exec("pear channel-discover pear.symfony.com"));
     $output->write(shell_exec('pear install symfony2/Finder'));
     $output->write(shell_exec('pear install symfony2/Process'));
     $output->write(shell_exec('pear install symfony2/CssSelector'));
     $output->write(shell_exec('pear install symfony2/DomCrawler'));
     $output->write(shell_exec('pear install symfony2/BrowserKit'));
     $output->writeln("Installing Mink...");
     $output->write(shell_exec("pear channel-discover pear.behat.org"));
     $output->write(shell_exec("pear install behat/mink"));
     $output->writeln('Please check PHPUnit was installed sucessfully. Run the "phpunit" command. If it is not avaible try installing PHPUnit manually');
     $output->writeln("Installaction complete. Init your new TestGuy suite calling the 'init' command");
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:25,代码来源:Install.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->app = $this->getApplication();
     $dialog = new DialogHelper();
     $case = $input->getArgument('case');
     $note = $input->getArgument('note');
     // fb note "string message" and so we swap case and note
     if (!is_numeric($case)) {
         $note = $case;
         $case = $this->app->getCurrent();
         if (empty($case)) {
             $case = $dialog->ask($output, 'Enter a case number:');
         }
     }
     if (empty($note)) {
         $note = $dialog->ask($output, sprintf("Please supply a note for Case %d:\n", $case));
     }
     try {
         $this->app->fogbugz->edit(array('ixBug' => $case, 'sEvent' => $note));
         $output->writeln(sprintf('Left a note on case %s', $case), $this->app->outputFormat);
     } catch (ApiError $e) {
         $output->writeln(sprintf('<error>%s</error>', $e->getMessage()), $this->app->outputFormat);
         exit(1);
     }
 }
开发者ID:enobrev,项目名称:fogbugz-php-cli,代码行数:25,代码来源:NoteCommand.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->app = $this->getApplication();
     $dialog = new DialogHelper();
     // TODO: this should be config dir
     if (file_exists($this->app->configFile)) {
         $this->config = Yaml::parse($this->app->configFile);
     } else {
         $this->config = $this->app->getDefaultConfig();
     }
     $output->writeln(sprintf("%s\n<info>%s</info>\n%s\n Config Path: %s\n", str_repeat("—", 80), str_pad("FogBugz Client Setup", 80, " ", STR_PAD_BOTH), str_repeat("—", 80), $this->app->configFile), $this->app->outputFormat);
     // Prompt the values in the config file
     $question = "Enable color output (";
     $question .= !empty($this->config['UseColor']) && $this->config['UseColor'] ? "yes" : "no";
     $question .= "): ";
     $useColor = $dialog->ask($output, $question, $this->config['UseColor']);
     $this->config['UseColor'] = strtolower($useColor[0]) == 'y';
     // TODO: use validation here for host prompt
     $question = "FogBugz host url (";
     $question .= !empty($this->config['Host']) && $this->config['Host'] ? $this->config['Host'] : "include https://";
     $question .= "): ";
     $this->config['Host'] = $dialog->ask($output, $question, $this->config['Host']);
     // We can use this config to know if we need to make changes in setup
     $this->config['ConfigVersion'] = $this->app->project->version;
     $this->app->config = $this->config;
     $this->app->saveConfig();
     // Display the alias to use in bash config.
 }
开发者ID:enobrev,项目名称:fogbugz-php-cli,代码行数:28,代码来源:SetupCommand.php

示例9: getValues

 /**
  * @param  OutputInterface $output
  * @param  DialogHelper    $dialog
  * @return array
  */
 public function getValues(OutputInterface $output, DialogHelper $dialog)
 {
     $default = $this->getDefault();
     $value = $dialog->ask($output, "<info>Package Name</info> ({$default}): ", $default);
     $parts = explode('/', $default);
     $owner = $parts[0];
     $title = isset($parts[1]) ? $parts[1] : $default;
     return ['package_name' => $value, 'package_owner' => $owner, 'package_title' => $title, 'package_classname' => $this->toCamelCase($title)];
 }
开发者ID:clippings,项目名称:composer-init,代码行数:14,代码来源:PackageNamePrompt.php

示例10: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->app = $this->getApplication();
     $dialog = new DialogHelper();
     $case = $input->getArgument('case');
     $recentCases = $this->app->getRecent();
     if ($case == null) {
         $strlen = 4;
         if (!empty($recentCases)) {
             $output->writeln("What case are you working on?", $this->app->outputFormat);
             foreach ($recentCases as $recent_case) {
                 $output->writeln(sprintf("  <info>[%s]</info> %s", $recent_case['id'], substr($recent_case['title'], 0, 75)), $this->app->outputFormat);
                 // this is just for display purposes below
                 $strlen = strlen($recent_case['id']);
             }
             $output->writeln("  <info>[" . str_repeat('#', $strlen) . "]</info> Or type any other case number to start work", $this->app->outputFormat);
         }
         while ($case == null) {
             $case = $dialog->ask($output, "Case number: ");
         }
     }
     try {
         // We'll go ahead and look it up, and if we find it, we'll
         // save it to recent. Then, we'll issue the command and catch
         // any problems with it and deal with it then.
         $bug = $this->app->fogbugz->search(array('q' => (int) $case, 'cols' => 'sTitle,sStatus,sLatestTextSummary'));
         $title = (string) $bug->cases->case->sTitle;
         $this->app->pushRecent($case, $title);
         $this->app->fogbugz->startWork(array('ixBug' => $case));
         $output->writeln(sprintf("Now working on [%d]\n  %s\n", $case, $title), $this->app->outputFormat);
     } catch (ApiError $e) {
         if ($e->getCode() == '7') {
             if ($e->getMessage() == 'Case ' . $case . ' has no estimate') {
                 $output->writeln(sprintf("<alert>Case %s has no estimate.</alert>", $case), $this->app->outputFormat);
                 // Delegate to the set estimate
                 $command = $this->getApplication()->find('estimate');
                 $arguments = array('command' => 'estimate', 'case' => $case);
                 $input = new ArrayInput($arguments);
                 $command->run($input, $output);
                 // Now come back to start the case.
                 // TODO: move this to call, so we aren't working the catch.
                 $title = (string) $bug->cases->case->sTitle;
                 $this->app->fogbugz->startWork(array('ixBug' => $case));
                 $output->writeln(sprintf("Now working on [%d]\n  %s\n", $case, $title), $this->app->outputFormat);
                 return;
             } elseif ($e->getMessage() == 'Closed') {
                 $output->writeln(sprintf("<fire>Sorry, Case %s is closed and may not " . "have a time interval added to it.</fire>", $case), $this->app->outputFormat);
             } else {
                 $output->writeln(sprintf("<error>%s</error>", $e->getMessage()), $this->app->outputFormat);
             }
         } else {
             $output->writeln(sprintf("<error>%s</error>", $e->getMessage()), $this->app->outputFormat);
         }
         exit(1);
     }
 }
开发者ID:enobrev,项目名称:fogbugz-php-cli,代码行数:56,代码来源:StartCommand.php

示例11: getValues

 /**
  * @param  OutputInterface $output
  * @param  DialogHelper    $dialog
  * @return array
  */
 public function getValues(OutputInterface $output, DialogHelper $dialog)
 {
     $defaults = $this->getDefaults();
     $value = $dialog->askAndValidate($output, "<info>PHP Namespace</info> ({$defaults[0]}): ", function ($namespace) {
         if (preg_match("/^([\\w\\\\]+)*\\w+\$/", $namespace)) {
             return $namespace;
         }
         throw new RuntimeException(sprintf('%s is not a valid namespace', $namespace));
     }, false, reset($defaults), $defaults);
     return ['php_namespace' => $value, 'php_namespace_escaped' => addslashes($value)];
 }
开发者ID:clippings,项目名称:composer-init,代码行数:16,代码来源:PhpNamespacePrompt.php

示例12: getValues

 /**
  * @param  OutputInterface $output
  * @param  DialogHelper    $dialog
  * @return array
  */
 public function getValues(OutputInterface $output, DialogHelper $dialog)
 {
     $default = $this->getDefault();
     $value = $dialog->askAndValidate($output, "<info>Issues url</info> ({$default}): ", function ($email) {
         if (false === filter_var($email, FILTER_VALIDATE_URL)) {
             throw new RuntimeException('Not a valid url');
         }
         return $email;
     }, false, $default);
     return ['bugs' => $value];
 }
开发者ID:clippings,项目名称:composer-init,代码行数:16,代码来源:BugsPrompt.php

示例13: testRun

 public function testRun()
 {
     $app = $this->getApp();
     $command = new LogClear($app);
     $dialog = new DialogHelper();
     $dialog->setInputStream($this->getInputStream("Yes\n"));
     $command->setHelperSet(new HelperSet(array($dialog)));
     $tester = new CommandTester($command);
     $tester->execute(array());
     $result = $tester->getDisplay();
     $this->assertRegexp('/System & change logs cleared/', $result);
 }
开发者ID:aaleksu,项目名称:bolt_cm,代码行数:12,代码来源:LogClearTest.php

示例14: ask

 public function ask($question, $regex, $errorText = null, $default = null)
 {
     if ($default) {
         $question = "{$question} [{$default}]";
     }
     return $this->dialog->askAndValidate($this->output, "<question>{$question}</question> ", $this->validateWith($regex, $errorText), false, $default);
 }
开发者ID:sethathay,项目名称:PPBakery,代码行数:7,代码来源:ConsoleInput.php

示例15: configure

 /**
  * Asks user what the path to Php source is.
  */
 public function configure()
 {
     $default = $this->settings->getDefaultValueFor('enablePhpTools', true);
     $this->settings['enablePhpTools'] = $this->dialog->askConfirmation($this->output, "\nDo you want to install the QA tools for PHP?", $default);
     if ($this->settings['enablePhpTools']) {
         $this->output->writeln("\n<info>Configuring PHP inspections</info>\n");
     }
 }
开发者ID:thangnvaltplus,项目名称:qa-tools-1,代码行数:11,代码来源:PhpConfigurator.php


注:本文中的Symfony\Component\Console\Helper\DialogHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。