- Removed double spaces - Added space after if/switch/foreach - Removed space on elseif - Added space around parentheses - Added newline at end of file - Removed space before semicolon at end of line Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
25 lines
581 B
PHP
25 lines
581 B
PHP
<?php
|
|
|
|
class UserWrapper {
|
|
public $userName;
|
|
public $password;
|
|
public $user;
|
|
|
|
public function __construct( $userName, $password, $group = '' ) {
|
|
$this->userName = $userName;
|
|
$this->password = $password;
|
|
|
|
$this->user = User::newFromName( $this->userName );
|
|
if ( !$this->user->getID() ) {
|
|
$this->user = User::createNew( $this->userName, array(
|
|
"email" => "test@example.com",
|
|
"real_name" => "Test User" ) );
|
|
}
|
|
$this->user->setPassword( $this->password );
|
|
|
|
if ( $group !== '' ) {
|
|
$this->user->addGroup( $group );
|
|
}
|
|
$this->user->saveSettings();
|
|
}
|
|
}
|