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


PHP IOInterface::ask方法代码示例

本文整理汇总了PHP中Composer\IO\IOInterface::ask方法的典型用法代码示例。如果您正苦于以下问题:PHP IOInterface::ask方法的具体用法?PHP IOInterface::ask怎么用?PHP IOInterface::ask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\IO\IOInterface的用法示例。


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

示例1: configure

 /**
  * @param IOInterface $io
  * @param CommitMsg   $commitMsg
  *
  * @return CommitMsg
  */
 public static function configure(IOInterface $io, CommitMsg $commitMsg)
 {
     $answer = $io->ask(HookQuestions::COMMIT_MSG_HOOK, HookQuestions::DEFAULT_TOOL_ANSWER);
     $commitMsg = $commitMsg->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
     if (true === $commitMsg->isEnabled()) {
         $regularExpressionAnswer = $io->ask(HookQuestions::COMMIT_MSG_REGULAR_EXPRESSION, HookQuestions::COMMIT_MSG_REGULAR_EXPRESSION_ANSWER);
         $commitMsg = $commitMsg->addRegularExpression(new RegularExpression($regularExpressionAnswer));
     }
     return $commitMsg;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:16,代码来源:CommitMsgConfigurator.php

示例2: configure

 /**
  * @param IOInterface $io
  * @param PhpMd       $phpMd
  *
  * @return PhpMd
  */
 public static function configure(IOInterface $io, PhpMd $phpMd)
 {
     if (true === $phpMd->isUndefined()) {
         $answer = $io->ask(HookQuestions::PHPMD_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpMd = $phpMd->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
         $optionsAnswer = $io->ask(HookQuestions::PHPMD_OPTIONS, null);
         $options = new PhpMdOptions($optionsAnswer);
         $phpMd = $phpMd->setOptions($options);
     }
     return $phpMd;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:17,代码来源:PhpMdConfigurator.php

示例3: configure

 public static function configure(IOInterface $input, PrePush $prePush)
 {
     $answer = $input->ask(HookQuestions::PRE_PUSH_HOOK_QUESTION, HookQuestions::DEFAULT_TOOL_ANSWER);
     $prePush = $prePush->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
     if (true === $prePush->isEnabled()) {
         $rightMessageAnswer = $input->ask(HookQuestions::PRE_PUSH_RIGHT_MESSAGE, HookQuestions::PRE_PUSH_RIGHT_MESSAGE_DEFAULT);
         $errorMessageAnswer = $input->ask(HookQuestions::PRE_PUSH_ERROR_MESSAGE, HookQuestions::PRE_PUSH_ERROR_MESSAGE_DEFAULT);
         $prePush = $prePush->setMessages(new Messages(new Message($rightMessageAnswer), new Message($errorMessageAnswer)));
     }
     return $prePush;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:11,代码来源:PrePushConfigurator.php

示例4: configure

 /**
  * @param IOInterface $io
  * @param PreCommit   $preCommit
  *
  * @return PreCommit
  */
 public static function configure(IOInterface $io, PreCommit $preCommit)
 {
     $answer = $io->ask(HookQuestions::PRE_COMMIT_HOOK, HookQuestions::DEFAULT_TOOL_ANSWER);
     $preCommit = $preCommit->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
     if (true === $preCommit->isEnabled()) {
         $rightMessageAnswer = $io->ask(HookQuestions::PRE_COMMIT_RIGHT_MESSAGE, HookQuestions::PRE_COMMIT_RIGHT_MESSAGE_DEFAULT);
         $errorMessageAnswer = $io->ask(HookQuestions::PRE_COMMIT_ERROR_MESSAGE, HookQuestions::PRE_COMMIT_ERROR_MESSAGE_DEFAULT);
         $preCommit = $preCommit->setMessages(new Messages(new Message($rightMessageAnswer), new Message($errorMessageAnswer)));
     }
     return $preCommit;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:17,代码来源:PreCommitConfigurator.php

示例5: configure

 /**
  * @param IOInterface           $io
  * @param PhpUnitStrictCoverage $strictCoverage
  *
  * @return PhpUnitStrictCoverage
  */
 public static function configure(IOInterface $io, PhpUnitStrictCoverage $strictCoverage)
 {
     if (true === $strictCoverage->isUndefined()) {
         $strictCoverageAnswer = $io->ask(HookQuestions::PHPUNIT_STRICT_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER);
         $strictCoverage = $strictCoverage->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($strictCoverageAnswer)));
         /** @var PhpUnitStrictCoverage $strictCoverage */
         if (true === $strictCoverage->isEnabled()) {
             $minimum = $io->ask(HookQuestions::PHPUNIT_STRICT_COVERAGE_MINIMUM, 0.0);
             $strictCoverage = $strictCoverage->setStrictCoverage(new MinimumStrictCoverage((double) $minimum));
         }
     }
     return $strictCoverage;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:19,代码来源:PhpUnitStrictCoverageConfigurator.php

示例6: configure

 /**
  * @param IOInterface $io
  * @param PhpCs       $phpCs
  *
  * @return PhpCs|\Module\Configuration\Model\ToolInterface
  */
 public static function configure(IOInterface $io, PhpCs $phpCs)
 {
     if (true === $phpCs->isUndefined()) {
         $answer = $io->ask(HookQuestions::PHPCS_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpCs = $phpCs->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
         if (true === $phpCs->isEnabled()) {
             $standardAnswer = $io->ask(HookQuestions::PHPCS_STANDARD, null);
             /** @var PhpCs $phpCs */
             $phpCs = $phpCs->addStandard(new PhpCsStandard($standardAnswer));
         }
     }
     return $phpCs;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:19,代码来源:PhpCsConfigurator.php

示例7: configure

 /**
  * @param IOInterface $input
  * @param PhpUnitGuardCoverage $phpUnitGuardCoverage
  *
  * @return PhpUnitGuardCoverage
  */
 public function configure(IOInterface $input, PhpUnitGuardCoverage $phpUnitGuardCoverage)
 {
     if (true === $phpUnitGuardCoverage->isUndefined()) {
         $guardCoverageAnswer = $input->ask(HookQuestions::PHPUNIT_GUARD_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpUnitGuardCoverage = $phpUnitGuardCoverage->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($guardCoverageAnswer)));
         if (true === $phpUnitGuardCoverage->isEnabled()) {
             $defaultMessage = $input->ask(HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE, HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE_DEFAULT);
             /** @var PhpUnitGuardCoverage $phpUnitGuardCoverage */
             $phpUnitGuardCoverage = $phpUnitGuardCoverage->setWarningMessage(new Message($defaultMessage));
             $this->coverageGitIgnoreConfigurator->configure();
         }
     }
     return $phpUnitGuardCoverage;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:20,代码来源:PhpUnitGuardCoverageConfigurator.php

示例8: processParams

 protected function processParams($params, $actualParams)
 {
     if (!$this->io->isInteractive()) {
         return $actualParams;
     }
     $this->io->write('<comment>Some parameters are missing. Please provide them.</comment>');
     foreach ($params as $key => $value) {
         $result = $this->io->ask(sprintf("<question>%s</question> (<comment>%s</comment>): ", $this->messages[$key], $value));
         if (!empty($result)) {
             $actualParams[$key] = $result;
         }
     }
     return $actualParams;
 }
开发者ID:ethna,项目名称:ethna-composer-handler,代码行数:14,代码来源:Processor.php

示例9: configure

 /**
  * @param IOInterface $io
  * @param PhpCsFixer  $phpCsFixer
  *
  * @return PhpCsFixer
  */
 public static function configure(IOInterface $io, PhpCsFixer $phpCsFixer)
 {
     if (true === $phpCsFixer->isUndefined()) {
         $answer = $io->ask(HookQuestions::PHPCSFIXER_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpCsFixer = $phpCsFixer->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
         if (true === $phpCsFixer->isEnabled()) {
             $psr0Answer = $io->ask(HookQuestions::PHPCSFIXER_PSR0_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
             $psr1Answer = $io->ask(HookQuestions::PHPCSFIXER_PSR1_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
             $psr2Answer = $io->ask(HookQuestions::PHPCSFIXER_PSR2_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
             $symfonyAnswer = $io->ask(HookQuestions::PHPCSFIXER_SYMFONY_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER);
             $phpCsFixer = $phpCsFixer->addLevels(new PhpCsFixerLevels(new Level(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($psr0Answer)), new Level(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($psr1Answer)), new Level(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($psr2Answer)), new Level(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($symfonyAnswer))));
         }
     }
     return $phpCsFixer;
 }
开发者ID:eNRJ,项目名称:php-git-hooks,代码行数:21,代码来源:PhpCsFixerConfigurator.php

示例10: ask

 public function ask($question, array $options)
 {
     $output = [];
     $output[] = sprintf('<question>%s</question>', $question);
     foreach ($options as $selection => $title) {
         $output[] = sprintf('[<comment>%s</comment>] %s', $selection, $title);
     }
     while (1) {
         $answer = $this->io->ask(implode(PHP_EOL, $output) . PHP_EOL);
         if (!array_key_exists($answer, $options)) {
             $this->io->write('<error>Invalid option selected.</error>');
         } else {
             return $answer;
         }
     }
 }
开发者ID:deltasystems,项目名称:dewdrop-skeleton,代码行数:16,代码来源:Installer.php

示例11: start

 public static function start(Configuration $configuration, IOInterface $io)
 {
     $params = array();
     $params['database-model'] = $io->ask("> Database model? (MYSQLI) ", "MYSQLI");
     $params['database-host'] = $io->ask("> Database host? (localhost) ", "localhost");
     $params['database-port'] = $io->askAndValidate("> Database port? (3306) ", function ($value) {
         return is_int($value);
     }, 3, 3306);
     $params['database-name'] = $io->ask("> Database name? (comodojo) ", "comodojo");
     $params['database-user'] = $io->ask("> Database user? (comodojo) ", "comodojo");
     $params['database-password'] = $io->askAndHideAnswer("> Database password? ");
     $params['database-prefix'] = $io->ask("> Common prefix for database tables? (cmdj_) ", "cmdj_");
     foreach ($params as $param => $value) {
         $configuration->set($param, $value);
     }
 }
开发者ID:comodojo,项目名称:comodojo-installer,代码行数:16,代码来源:InteractiveConfiguration.php

示例12: genSecretConfig

 /**
  * Generate database config. will store in: etc/secret.yml.
  *
  * @param IOInterface $io
  *
  * @return  void
  */
 protected static function genSecretConfig(IOInterface $io)
 {
     $etc = __DIR__ . '/../../../etc';
     $secret = Yaml::parse(file_get_contents($etc . '/secret.dist.yml'));
     $driver = 'mysql';
     $host = $io->ask("Database host [localhost]: ", 'localhost');
     $name = $io->ask("Database name [natika]: ", 'natika');
     $user = $io->ask("Database user [root]: ", 'root');
     $pass = $io->askAndHideAnswer("Database password: ");
     $prefix = '';
     $secret['database'] = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $pass, 'name' => $name, 'prefix' => $prefix);
     file_put_contents($etc . '/secret.yml', Yaml::dump($secret, 4));
     $io->write('');
     $io->write('Database config setting complete.');
     $io->write('');
 }
开发者ID:asika32764,项目名称:natika,代码行数:23,代码来源:StarterInstaller.php

示例13: treatParams

 /**
  * Treat params and display Q&A.
  *
  * @param array $expectedKeys
  * @param boolean $isStarted
  * @param string $prefix
  *
  * @since 0.0.3
  */
 private function treatParams(array $expectedKeys, $isStarted = false, $prefix = '')
 {
     $params = [];
     // Iterate on expected keys
     foreach ($expectedKeys as $key => $message) {
         if (is_array($message)) {
             $params[$key] = $this->treatParams($message, $isStarted, $key);
         } else {
             // Display a first message before treating params
             if (!$isStarted) {
                 $isStarted = true;
                 # Write
                 $this->io->write("\n<comment>Some parameters are missing. Please provide them.</comment>");
             }
             // Display prefix when its needed, treat special boolean case
             $p = !empty($prefix) ? $prefix . ' ' : '';
             $m = is_bool($message) && !$message ? '0' : $message;
             # Read
             $value = $this->io->ask(sprintf("<question>%s%s</question> (<comment>%s</comment>): ", $p, $key, $m), $message);
             $value = is_bool($message) ? (bool) $value : (is_int($message) ? (int) $value : $value);
             // Special case: 'debug'
             if ('debug' === $key && $value) {
                 $params[$key] = $this->treatParams(['savequeries' => true, 'script_debug' => true, 'wp_debug_display' => true, 'wp_debug' => true], false, $key);
             } else {
                 $params[$key] = $value;
             }
         }
     }
     return $params;
 }
开发者ID:GetOlympus,项目名称:Olympus,代码行数:39,代码来源:Processor.php

示例14: configure

 /**
  * @param IOInterface $io
  * @param PhpUnit     $phpUnit
  *
  * @return PhpUnit
  */
 public static function configure(IOInterface $io, PhpUnit $phpUnit)
 {
     /** @var PhpUnit $phpUnit */
     if (true === $phpUnit->isUndefined()) {
         $answer = $io->ask(HookQuestions::PHPUNIT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpUnit = $phpUnit->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
         if (true === $phpUnit->isEnabled()) {
             $randomAnswer = $io->ask(HookQuestions::PHPUNIT_RANDOM_MODE, HookQuestions::DEFAULT_TOOL_ANSWER);
             $optionsAnswer = $io->ask(HookQuestions::PHPUNIT_OPTIONS, null);
             $randomMode = new PhpUnitRandomMode(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($randomAnswer));
             $options = new PhpUnitOptions($optionsAnswer);
             $phpUnit = $phpUnit->setRandomModeAndOptions($randomMode, $options);
         }
     }
     return $phpUnit;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:22,代码来源:PhpUnitConfigurator.php

示例15: configure

 /**
  * @param IOInterface $io
  * @param PhpLint     $phpLint
  *
  * @return PhpLint
  */
 public static function configure(IOInterface $io, PhpLint $phpLint)
 {
     if (true === $phpLint->isUndefined()) {
         $answer = $io->ask(HookQuestions::PHPLINT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpLint = $phpLint->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
     }
     return $phpLint;
 }
开发者ID:bruli,项目名称:php-git-hooks,代码行数:14,代码来源:PhpLintConfigurator.php


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