N98\Util\Console\Helper\ParameterHelper::askPassword PHP Method

askPassword() public method

public askPassword ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, string $argumentName = 'password', boolean $needDigits = true ) : string
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
$argumentName string
$needDigits boolean [optional]
return string
    public function askPassword(InputInterface $input, OutputInterface $output, $argumentName = 'password', $needDigits = true)
    {
        $validators = array();
        if ($needDigits) {
            $regex = array('pattern' => '/^(?=.*\\d)(?=.*[a-zA-Z])/', 'message' => 'Password must contain letters and at least one digit');
            $validators[] = new Constraints\Regex($regex);
        }
        $validators[] = new Constraints\Length(array('min' => 6));
        $constraints = new Constraints\Collection(array('password' => $validators));
        return $this->validateArgument($output, $argumentName, $input->getArgument($argumentName), $constraints);
    }