protected function execute(InputInterface $input, OutputInterface $output) { $username = $input->getArgument('username'); if ($input->getArgument('password')) { $password = $input->getArgument('password'); } else { $generator = new ComputerPasswordGenerator(); $generator->setOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, true)->setOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true)->setOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, true)->setOptionValue(ComputerPasswordGenerator::OPTION_SYMBOLS, false); $password = $generator->generatePassword(); } $registerUserCommand = new DomainCommand($username, $password); $commandGateway = $this->getContainer()->get('app.command.gateway'); $commandGateway->send($registerUserCommand); $output->writeln('<info>User created!</info>'); }
function __construct() { $generator = new ComputerPasswordGenerator(); $generator->setOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, true)->setOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true)->setOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, true); $password = $generator->generatePassword(); $faker = \Faker\Factory::create(); $this->company_name = $faker->company; $this->company_website = $faker->url; $this->contact_person = $faker->name; $this->username = $faker->userName; if (strlen($this->username) <= 8) { $this->username = $this->username . uniqid(); $this->username = substr($this->username, 0, 10); } $this->password = $password; $this->retype_password = $password; $this->street = $faker->streetName; $this->house_number = $faker->randomDigit; $this->post_code = $faker->postcode; $this->city = $faker->city; $this->country = "United States"; $this->email_address = $faker->email; }
public function testSimpleUsage() { $generator = new ComputerPasswordGenerator(); $generator->setOptionValue(ComputerPasswordGenerator::OPTION_UPPER_CASE, true)->setOptionValue(ComputerPasswordGenerator::OPTION_LOWER_CASE, true)->setOptionValue(ComputerPasswordGenerator::OPTION_NUMBERS, true)->setOptionValue(ComputerPasswordGenerator::OPTION_SYMBOLS, false); $generator->generatePassword(); }