<commit_before><?php 

namespace MrJuliuss\Syntara\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;

class UserSeedCommand extends Command {

	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $name = 'create:user';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Create new user in database';

	/**
	 * Create a new command instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		parent::__construct();
	}

	/**
	 * Execute the console command.
	 *
	 * @return void
	 */
	public function fire()
	{
        try 
        {
            // Create the user
            $user = \Sentry::getUserProvider()->create(array(
                'email'    => $this->argument('email'),
                'password' => $this->argument('password'),
                'username' => $this->argument('username'),
            ));

            $activationCode = $user->getActivationCode();
            $user->attemptActivation($activationCode);
        }
        catch (Cartalyst\Sentry\Users\UserExistsException $e){}
	}

    /**
	 * Get the console command arguments.
	 *
	 * @return array
	 */
	protected function getArguments()
	{
		return array(
			array('email',    InputArgument::REQUIRED, 'User email'),
			array('password', InputArgument::REQUIRED, 'User password'),
			array('username', InputArgument::REQUIRED, 'User name')
		);
	}

	/**
	 * Get the console command options.
	 *
	 * @return array
	 */
	protected function getOptions()
	{<commit_msg>[Upg] add validator to UserSeed command<commit_after><?php namespace MrJuliuss\Syntara\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Config;
use Validator;

class UserSeedCommand extends Command {

	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $name = 'create:user';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Create new user in database';

	/**
	 * Create a new command instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		parent::__construct();
	}

	/**
	 * Execute the console command.
	 *
	 * @return void
	 */
	public function fire()
	{
        try 
        {
            $email = $this->argument('email');
            $pass = $this->argument('password');
            $username = $this->argument('username');

             $validator = Validator::make(
                array(
                    'email' => $email, 
                    'pass' => $pass,
                    'username' => $username),
                Config::get('syntara::rules.users.create')
            );

            if($validator->fails())
            {
                foreach($validator->messages()->getMessages() as $key => $messages)
                {
                    $this->info(ucfirst($key).' :');
                    foreach($messages as $message)
                    {
                        $this->error($message);
                    }
                }
            }
            else
            {
                // Create the user
                $user = \Sentry::getUserProvider()->create(array(
                    'email'    => $email,
                    'password' => <PASSWORD>,
                    'username' => $username,
                ));

                $activationCode = $user->getActivationCode();
                $user->attemptActivation($activationCode);

                $this->info('User created with success');
            }
        }
        catch (\Cartalyst\Sentry\Users\UserExistsException $e)
        {
            $this->error('User already exists !');
        }
	}

    /**
	 * Get the console command arguments.
	 *
	 * @return array
	 */
	protected function getArguments()
	{
		return array(
			array('email',    InputArgument::REQUIRED, 'User email'),
			array('password', InputArgument::REQUIRED, 'User password'),
			array('username', InputArgument::REQUIRED, 'User name')
		);
	}

	/**
	 * Get the console command options.
	 *
	 * @return array
	 */
	protected function getOptions()
	{
{'fraction_non_alphanumeric': 0.13731198447355653, 'fraction_numerical': 0.0, 'mean_word_length': 1.9428979300499643, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503914', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1097, 'n_words': 253}