SatisAdmin\Console\AddUserCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $app = $this->getApp();
        $user = new User($input->getArgument('username'), $input->getArgument('password'));
        $users = is_file($app['app.users_file']) ? json_decode(file_get_contents($app['app.users_file']), true) : [];
        $users[$input->getArgument('username')] = ['ROLE_USER', $app->encodePassword($user, $input->getArgument('password'))];
        file_put_contents($app['app.users_file'], json_encode($users, JSON_PRETTY_PRINT));
        $app->log('User added', ['user' => $user->getUsername()], Logger::INFO);
    }
AddUserCommand