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


PHP Question::setHiddenFallback方法代码示例

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


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

示例1: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     parent::bootstrapProcessWire($output);
     $name = $input->getArgument('name');
     $email = $input->getOption('email');
     $pass = $input->getOption('password');
     $roles = explode(",", $input->getOption('roles'));
     $helper = $this->getHelper('question');
     if (!$email) {
         $question = new Question('Please enter a email address : ', 'email');
         $email = $helper->ask($input, $output, $question);
     }
     if (!$pass) {
         $question = new Question('Please enter a password : ', 'password');
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $pass = $helper->ask($input, $output, $question);
     }
     if (!\ProcessWire\wire("pages")->get("name={$name}") instanceof \ProcessWire\NullPage) {
         $output->writeln("<error>User '{$name}' already exists!</error>");
         exit(1);
     }
     $user = $this->createUser($email, $name, $this->userContainer, $pass);
     $user->save();
     if ($input->getOption('roles')) {
         $this->attachRolesToUser($name, $roles, $output);
     }
     if ($pass) {
         $output->writeln("<info>User '{$name}' created successfully!</info>");
     } else {
         $output->writeln("<info>User '{$name}' created successfully! Please do not forget to set a password.</info>");
     }
 }
开发者ID:wireshell,项目名称:wireshell,代码行数:38,代码来源:UserCreateCommand.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var WardenSetupService $wardenSetupService */
     $wardenSetupService = $this->getContainer()->get('warden_setup');
     /** @var UserProviderService $userProviderService */
     $userProviderService = $this->getContainer()->get('user_provider');
     if ($userProviderService->isSetup() && !$input->getOption('regenerate')) {
         $output->writeln('Warden username and password is already setup - check the README file if you need to regenerate.');
         return;
     }
     $helper = $this->getHelper('question');
     $usernameQuestion = new Question('Please enter the admin username [admin]: ', 'admin');
     $username = $helper->ask($input, $output, $usernameQuestion);
     $passwordQuestion = new Question('Please enter the admin password (minimum of 8 characters): ', '');
     $passwordQuestion->setValidator(function ($value) {
         if (trim($value) == '') {
             throw new \Exception('The password can not be empty');
         }
         if (strlen($value) < 8) {
             throw new \Exception('Password provided is too short - must be minimum of 8 characters');
         }
         return $value;
     });
     $passwordQuestion->setMaxAttempts(3);
     $passwordQuestion->setHidden(TRUE);
     $passwordQuestion->setHiddenFallback(FALSE);
     $password = $helper->ask($input, $output, $passwordQuestion);
     $output->writeln(' - Setting up the password file ...');
     $userProviderService->generateLoginFile($username, $password);
     $output->writeln(' - Setting up the CSS file ...');
     $wardenSetupService->generateCSSFile();
     $output->writeln('Warden installation complete.');
 }
开发者ID:TWEagle,项目名称:warden,代码行数:33,代码来源:InstallCommand.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var QuestionHelper $questionHelper */
     $questionHelper = $this->getHelper('question');
     $usernameQuestion = new Question('E-mail: ');
     $usernameQuestion->setValidator(function ($value) {
         if (trim($value) === '') {
             throw new \Exception('E-mail can not be empty');
         }
         if (!Validators::isEmail($value)) {
             throw new \Exception('E-mail is not valid');
         }
         return $value;
     });
     $passwordQuestion = new Question('Password: ');
     $passwordQuestion->setValidator(function ($value) {
         if (trim($value) === '') {
             throw new \Exception('The password can not be empty');
         }
         return $value;
     });
     $passwordQuestion->setHidden(TRUE);
     $passwordQuestion->setHiddenFallback(FALSE);
     $username = $questionHelper->ask($input, $output, $usernameQuestion);
     $password = $questionHelper->ask($input, $output, $passwordQuestion);
     $name = $questionHelper->ask($input, $output, new Question('Name: '));
     $user = $this->userFacade->add($username, $password, $name);
     $output->writeln('User ' . $user->getEmail() . ' was successfully created!');
 }
开发者ID:wodcz,项目名称:sandbox,代码行数:29,代码来源:CreateUser.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption("password")) {
         $password = $input->getOption("password");
     } else {
         $question = new Question('Password: ');
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $helper = $this->getHelper('question');
         $password = $helper->ask($input, $output, $question);
     }
     $server = new Server\Database\Mysql();
     $server->setHostname($input->getArgument("host"));
     $server->setUser("provisioning");
     $server->setPassword($this->createPassword());
     $server->setDatabase("provisioning");
     $server->setMode($input->getArgument("mode"));
     $server->setType($input->getArgument("type"));
     $server->setActive(false);
     // convert errors to PDOExceptions
     $options = [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION];
     $dsn = sprintf("mysql:host=%s;port=%s;charset=utf8", $server->getHostname(), 3306);
     $pdo = new \PDO($dsn, $input->getArgument("user"), $password, $options);
     $pdo->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
     $pdo->exec("SET NAMES utf8;");
     $pdo->exec("CREATE USER '{$server->getUser()}'@'%' IDENTIFIED BY '{$server->getPassword()}';");
     $pdo->exec("GRANT CREATE, DROP, GRANT OPTION, LOCK TABLES, REFERENCES, EVENT, ALTER, DELETE, INDEX, INSERT, SELECT, UPDATE, CREATE TEMPORARY TABLES, TRIGGER, CREATE VIEW, SHOW VIEW, ALTER ROUTINE, CREATE ROUTINE, EXECUTE, CREATE USER, PROCESS, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, SHOW DATABASES, USAGE ON *.* TO '{$server->getUser()}' WITH GRANT OPTION;");
     $pdo->exec("CREATE DATABASE {$server->getDatabase()} DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;");
     // Write to DB
     $entityManager = $this->getProvisioningServer("mysql")->getEntityManager();
     $entityManager->persist($server);
     $entityManager->flush();
     $table = $this->getMySqlServersTable([$server], $output);
     $table->render();
 }
开发者ID:keboola,项目名称:provisioning-bundle,代码行数:35,代码来源:InitMysqlServerCommand.php

示例5: execute

 /**
  * Execute the command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $db = $input->getOption('db');
     if (empty($db)) {
         throw new \InvalidArgumentException('You must define the database name with --db');
     }
     $password = $input->getOption('password');
     if (is_null($password)) {
         $helper = $this->getHelper('question');
         $question = new Question('Password: ');
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $password = $helper->ask($input, $output, $question);
     }
     try {
         $pdo = new \PDO("mysql:dbname={$db};host=" . $input->getOption('host'), $input->getOption('user'), $password);
     } catch (\Exception $e) {
         throw new \RuntimeException("Can't connect to the database. Check your credentials");
     }
     $writer = new \Inet\Neuralyzer\Configuration\Writer();
     $ignoreFields = $input->getOption('ignore-field');
     $writer->protectCols($input->getOption('protect'));
     // Override the protection if fields are defined
     if (!empty($ignoreFields)) {
         $writer->protectCols(true);
         $writer->setProtectedCols($ignoreFields);
     }
     $writer->setIgnoredTables($input->getOption('ignore-table'));
     $data = $writer->generateConfFromDB($pdo, new \Inet\Neuralyzer\Guesser());
     $writer->save($data, $input->getOption('file'));
     $output->writeln('<comment>Configuration written to ' . $input->getOption('file') . '</comment>');
 }
开发者ID:inetprocess,项目名称:neuralyzer,代码行数:40,代码来源:ConfigGenerateCommand.php

示例6: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $password = getenv('VAULT_PASSWORD');
     $tries = 0;
     while (!$password) {
         $question = new Question('Vault password: ', null);
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $helperSet = $this->getHelperSet();
         $helper = $helperSet->get('question');
         $password = $helper->ask($input, $output, $question);
     }
     $this->vault = new Vault($password, $output);
     // Defaults
     $this->vault->setStoragePath(getcwd() . '/vault');
     $this->vault->setWorkPath(getcwd() . '/secure');
     $this->vault->verify();
     // Load droid.yml
     $filename = $this->getVaultFilename();
     if ($filename && file_exists($filename)) {
         $loader = new JsonLoader();
         $loader->load($vault, $filename);
     } else {
     }
     return parent::doRun($input, $output);
 }
开发者ID:linkorb,项目名称:vault,代码行数:26,代码来源:Application.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption("password")) {
         $password = $input->getOption("password");
     } else {
         $question = new Question('Password: ');
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $helper = $this->getHelper('question');
         $password = $helper->ask($input, $output, $question);
     }
     $server = new Server\Database\Redshift();
     $server->setHostname($input->getArgument("hostname"));
     $server->setConnectionId($input->getArgument("connectionId"));
     $server->setUser("provisioning");
     $server->setPassword($this->createPassword());
     $server->setDatabase("provisioning");
     $server->setMode("active");
     $server->setActive(false);
     // convert errors to PDOExceptions
     $options = [\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_EMULATE_PREPARES => false];
     $dsn = "pgsql:host={$server->getHostname()};port=5439;dbname={$input->getArgument("database")}";
     $pdo = new \PDO($dsn, $input->getArgument("user"), $password, $options);
     $pdo->exec("CREATE USER {$server->getUser()} CREATEUSER PASSWORD '{$server->getPassword()}';");
     $pdo->exec("CREATE DATABASE {$server->getDatabase()};");
     $pdo->exec("REVOKE ALL PRIVILEGES ON SCHEMA public FROM PUBLIC;");
     // Write to DB
     $entityManager = $this->getProvisioningServer("redshift")->getEntityManager();
     $entityManager->persist($server);
     $entityManager->flush();
     $table = $this->getRedshiftServersTable([$server], $output);
     $table->render();
 }
开发者ID:keboola,项目名称:provisioning-bundle,代码行数:33,代码来源:InitRedshiftServerCommand.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $login = $input->getArgument("login");
     $helper = $this->getHelper('question');
     $question = new Question("Unix password for « {$login} » : ");
     $question->setHidden(true);
     $question->setHiddenFallback(false);
     $password = $input->getArgument("password") ? $input->getArgument("password") : $helper->ask($input, $output, $question);
     $blih = new Blih($login, $password);
     $blihRepositoriesResponse = $blih->repository()->all();
     if ($blihRepositoriesResponse->code == 200) {
         $user = $this->getUserOrCreateIt($login);
         $repositoryNames = array_keys(get_object_vars($blihRepositoriesResponse->body->repositories));
         foreach ($repositoryNames as $repositoryName) {
             $output->writeln("> Repository « {$login}/{$repositoryName} »");
             $repository = $this->getRepoOrCreateIt($user, $repositoryName);
             $aclResponse = $blih->repository($repositoryName)->acl()->get();
             if ($aclResponse->code == 200) {
                 $acls = get_object_vars($aclResponse->body);
                 foreach ($acls as $aclLogin => $acl) {
                     $output->writeln("  ACL for « {$aclLogin} »: {$acl}");
                     $aclUser = $this->getUserOrCreateIt($aclLogin);
                     $repositoryACL = $this->getACLOrCreateIt($aclUser, $repository);
                     $repositoryACL->setR(strpos($acl, "r") !== false);
                     $repositoryACL->setW(strpos($acl, "w") !== false);
                     $repositoryACL->setA(strpos($acl, "a") !== false);
                     $this->getContainer()->get("doctrine")->getManager()->persist($repositoryACL);
                 }
             }
             $output->writeln("");
             $this->getContainer()->get("doctrine")->getManager()->persist($repository);
             $this->getContainer()->get("doctrine")->getManager()->flush();
         }
     }
 }
开发者ID:Raphy,项目名称:BlihWI,代码行数:35,代码来源:BlihUpdateCommand.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption("password")) {
         $password = $input->getOption("password");
     } else {
         $question = new Question('Password: ');
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $helper = $this->getHelper('question');
         $password = $helper->ask($input, $output, $question);
     }
     $server = new Server\Database\Redshift();
     $server->setHostname($input->getArgument("host"));
     $server->setConnectionId($input->getArgument("connectionId"));
     $server->setUser($input->getArgument("user"));
     $server->setPassword($password);
     $server->setDatabase($input->getArgument("database"));
     $server->setMode("active");
     $server->setActive(false);
     // Write to DB
     $entityManager = $this->getProvisioningServer("redshift")->getEntityManager();
     $entityManager->persist($server);
     $entityManager->flush();
     $table = $this->getRedshiftServersTable([$server], $output);
     $table->render();
 }
开发者ID:keboola,项目名称:provisioning-bundle,代码行数:26,代码来源:AddRedshiftServerCommand.php

示例10: secret

 /**
  * Ask the user the given secret question.
  *
  * @param  string  $question
  * @return string
  */
 public function secret($question)
 {
     $question = '<comment>' . $question . '</comment> ';
     $question = new Question($question);
     $question->setHidden(true);
     $question->setHiddenFallback(false);
     return $this->getHelperSet()->get('question')->ask($this->input, $this->output, $question);
 }
开发者ID:laravel,项目名称:envoy,代码行数:14,代码来源:Command.php

示例11: askForPassword

 private function askForPassword()
 {
     $helper = $this->getHelper('question');
     $question = new Question('What is the new user\'s password: ');
     $question->setHidden(true);
     $question->setHiddenFallback(false);
     return $helper->ask($this->input, $this->output, $question);
 }
开发者ID:luiz158,项目名称:orcamentos,代码行数:8,代码来源:ResetPasswordCommand.php

示例12: askHiddenResponse

 /**
  * @param $message
  * @return string
  */
 public function askHiddenResponse($message)
 {
     $this->clearLine();
     $this->output->writeln("\n");
     $question = new Question('<question>' . $message . '</question> ');
     $question->setHidden(true);
     $question->setHiddenFallback(false);
     $var = $this->dialog->ask($this->input, $this->output, $question);
     return $var;
 }
开发者ID:benoitgeerinck,项目名称:skylab,代码行数:14,代码来源:DialogProvider.php

示例13: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $SafeController = new SafeController();
     $safeName = $input->getArgument('safe');
     if (empty($safeName)) {
         $safeNames = $SafeController->getSafeNames();
         $helper = $this->getHelper('question');
         $question = new ChoiceQuestion('<question>Please select the safe for this secret:</question> ', $safeNames);
         $safeName = $helper->ask($input, $output, $question);
     }
     if (empty($safeName)) {
         throw new \Exception("Invalid safe name");
     }
     $output->writeln('');
     $output->writeln(sprintf("<info>Using safe '%s'... </info>", $safeName));
     $keyName = $input->getArgument('key');
     if (empty($keyName)) {
         $helper = $this->getHelper('question');
         $question = new Question('<question>Please enter the key name for this secret :</question> ');
         $keyName = $helper->ask($input, $output, $question);
     }
     if (empty($keyName)) {
         throw new \Exception("Invalid key name");
     }
     $value = $input->getArgument('value');
     if (empty($value)) {
         $helper = $this->getHelper('question');
         $question = new Question('<question>Please enter the value for this secret (output hidden):</question> ');
         $question->setHidden(true);
         $question->setHiddenFallback(false);
         $value = $helper->ask($input, $output, $question);
     }
     if (empty($value) && !file_exists($value)) {
         throw new \Exception("Invalid value");
     }
     if (file_exists($value)) {
         $value = file_get_contents($value);
     }
     $output->writeln('');
     $output->write(sprintf("Creating secret '%s'... ", $keyName));
     $SecretController = new SecretController();
     try {
         $safe = $SafeController->view($safeName);
         $SecretController->create($safe, $keyName, $value);
     } catch (\Exception $e) {
         $output->writeln('<error>FAILED</error>');
         $output->writeln('');
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         return;
     }
     $output->writeln('<info>DONE</info>');
     $output->writeln('');
 }
开发者ID:garyr,项目名称:portunus,代码行数:53,代码来源:StoreCommand.php

示例14: requestSlackCredentials

 protected function requestSlackCredentials(InputInterface $input, OutputInterface $output)
 {
     $helper = $this->getHelper('question');
     $output->writeln('<info>Please sign in to Slack to continue. Your username and password are not stored.</info>');
     $emailQuestion = new Question('Email: ');
     $email = $helper->ask($input, $output, $emailQuestion);
     $passwordQuestion = new Question('Password: ');
     $passwordQuestion->setHidden(true);
     $passwordQuestion->setHiddenFallback(false);
     $password = $helper->ask($input, $output, $passwordQuestion);
     return array($email, $password);
 }
开发者ID:heyupdate,项目名称:sqwack,代码行数:12,代码来源:SnapCommand.php

示例15: ask

 /**
  * Ask a question
  * 
  * @param string $question  Question to ask
  * @param mixed  $default   Default value
  * @param bool   $hidden    Hide response
  * @param bool   $required  User input is required
  * @return mixed
  */
 public function ask($question, $default = null, $hidden = false, $required = true)
 {
     $helper = $this->getHelper('question');
     $q = new Question($question, $default);
     if ($hidden) {
         $q->setHidden(true);
         $q->setHiddenFallback(false);
     }
     if ($required) {
         $q->setValidator([$this, 'assertNotEmpty']);
         $q->setMaxAttempts(2);
     }
     return $helper->ask($this->input, $this->output, $q);
 }
开发者ID:hypejunction,项目名称:elgg-cli,代码行数:23,代码来源:Command.php


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