本文整理匯總了PHP中app\Auth::setPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP Auth::setPassword方法的具體用法?PHP Auth::setPassword怎麽用?PHP Auth::setPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Auth
的用法示例。
在下文中一共展示了Auth::setPassword方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseInput
private function parseInput(InputInterface $input, OutputInterface $output)
{
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
/*
* Filename
*/
$this->filename = $input->getOption('filename');
if (empty($this->filename)) {
$this->filename = $helper->ask($input, $output, new Question('Json file to import: '));
}
if (!file_exists($this->filename)) {
throw new \Exception('File not found');
}
/*
* Owner
*/
$this->owner = $input->getOption('owner');
if (empty($this->owner)) {
$this->owner = $helper->ask($input, $output, new Question('Owner of GitHub repository, organization or a person: '));
}
if (empty($this->owner)) {
throw new \Exception('Empty owner');
}
/*
* Repo
*/
$this->repo = $input->getOption('repo');
if (empty($this->repo)) {
$this->repo = $helper->ask($input, $output, new Question('GitHub repository name: '));
}
if (empty($this->repo)) {
throw new \Exception('Empty repo');
}
/*
* username
*/
$username = $input->getOption('username');
if (empty($username)) {
$username = $helper->ask($input, $output, new Question('GitHub username to log in with: '));
}
if (empty($username)) {
throw new \Exception('Empty username');
}
$this->auth = new Auth($username);
if ($helper->ask($input, $output, new Question('Do you use 2 factor auth for GitHub? (y/N) '))) {
$question = new Question('GitHub personal token (https://github.com/settings/tokens) with repo access: ');
$token = $helper->ask($input, $output, $question);
$this->auth->setToken($token);
} else {
$password = $helper->ask($input, $output, new Question('GitHub password: '));
$this->auth->setPassword($password);
}
}