public static function create(User $user, $name, $username, $password)
    {
        $options = [
            'action' => 'create',
            'name' => $name,
        ];
        if (!empty($password)) {
            $options += ['user' => $username, 'passwd' => $password, 'passwd2' => $password];
        } else {
            $options += ['userlist' => $username];
        }
        $user->getContext()->invokeApiPost('DATABASES', $options);
        return new self($name, $user, $user->getContext());
    }
public static function create(User $user, $name, $username, $password)
    {
        $options = [
            'action' => 'create',
            'name' => $name,
        ];
        if (!empty($password)) {
            $options += ['user' => $username, 'passwd' => $password, 'passwd2' => $password];
        } else {
            $options += ['userlist' => $username];
        }
        $user->getContext()->invokeApiPost('DATABASES', $options);
        return new self($name, $user, $user->getContext());
    }
public static function create ( User $ user , $ name , $ username , $ password ) { $ options = [ 'action' => 'create' , 'name' => $ name , ] ; if ( ! empty ( $ password ) ) { $ options += [ 'user' => $ username , 'passwd' => $ password , 'passwd2' => $ password ] ; } else { $ options += [ 'userlist' => $ username ] ; } $ user -> getContext ( ) -> invokeApiPost ( 'DATABASES' , $ options ) ; return new self ( $ name , $ user , $ user -> getContext ( ) ) ; }
Creates a new database under the specified user.

@param User $user Owner of the database
@param string $name Database name, without <user>_ prefix
@param string $username Username to access the database with, without <user>_ prefix
@param string|null $password Password, or null if database user already exists
@return Database Newly created database
Creates a new database under the specified user .