public function setScheme($scheme)
    {
        // validate scheme
        try {
            $scheme = new StringObject($scheme);
        } catch (\Exception $e) {
            throw new UrlObjectException($e->getMessage());
        }

        if (!$scheme->endsWith('://')) {
            $scheme->val($scheme->val() . '://');
        }

        // set the scheme
        $this->scheme = $scheme->trimRight('://')->val();
        $this->rebuildUrl();

        return $this;
    }