public function createUser($email, $plainPassword, $name = null, $roles = array())
    {

        $userClass = $this->getUserClass();

        $user = new $userClass($email);

        if (!empty($plainPassword)) {
            $this->setUserPassword($user, $plainPassword);
        }

        if ($name !== null) {
            $user->setName($name);
        }
        if (!empty($roles)) {
            $user->setRoles($roles);
        }

        return $user;
    }
public function createUser($email, $plainPassword, $name = null, $roles = array())
    {

        $userClass = $this->getUserClass();

        $user = new $userClass($email);

        if (!empty($plainPassword)) {
            $this->setUserPassword($user, $plainPassword);
        }

        if ($name !== null) {
            $user->setName($name);
        }
        if (!empty($roles)) {
            $user->setRoles($roles);
        }

        return $user;
    }
public function createUser ( $ email , $ plainPassword , $ name = null , $ roles = array ( ) ) { $ userClass = $ this -> getUserClass ( ) ; $ user = new $ userClass ( $ email ) ; if ( ! empty ( $ plainPassword ) ) { $ this -> setUserPassword ( $ user , $ plainPassword ) ; } if ( $ name !== null ) { $ user -> setName ( $ name ) ; } if ( ! empty ( $ roles ) ) { $ user -> setRoles ( $ roles ) ; } return $ user ; }
Factory method for creating a new User instance.

@param string $email
@param string $plainPassword
@param string $name
@param array $roles
@return User
Factory method for creating a new User instance .