@param string $url
@param string $root

@return $this
351885
public function determineActiveForUrl(string $url, string $root = '/')
    {
        if (! $this->hasUrl()) {
            return;
        }

        ActiveUrlChecker::check($this->url, $url, $root)
            ? $this->setActive()
            : $this->setInactive();

        ExactUrlChecker::check($this->url, $url, $root)
            ? $this->setExactActive()
            : $this->setExactActive(false);
    }
1192816
public function setUrl($url)
    {
        if (!is_null($url)) {
            if (!preg_match('@^https?://@', $url)) {
                throw new \InvalidArgumentException(sprintf('Invalid url: %s', $url));
            }

            $this->url = $url;
        } else {
            $this->url = null;
        }

        return $this;
    }
703463
public function setBaseHref($url)
    {
        $node = $this->filterXPath('descendant-or-self::base')->getNode(0);
        if ($node == null) {
            $node = $this->dom->createElement('base');
            $this->getHeadNode()->appendChild($node);
        }
        $node->setAttribute('href', $url);
    }
992298
public function setUri($uri): self
    {
        $this->uri = $uri instanceof Uri ? $uri : new Uri($uri);

        return $this;
    }
85076
public function setRedirect ($url)
	{
		$this->setHeader ('Location', $url);
		$this->setStatus (302);
		$this->setData (array ('message' => 'Redirecting to ' . $url));

		return $this;
	}
21661
public function init($url = null)
    {
        $url       = (empty($url) ? Server::getInstance()->getCurrentUri() : $url);
        $this->url = parse_url($url);

        return $this;
    }
138951
public function setURL(URL $url)
    {
        $this->domain = $url->host;
        $this->path = $url->path;
        $this->secure = $url->secure;
        return $this;
    }
24375
public function setUrl(string $url): RequestContext
    {
        $this->assertValidUrl($url);

        $this->url = $url;

        return $this;
    }
619184
public function setRoot(Page $root)
    {
        if ($this->hasMainSection()) {
            $this->getMainSection()->setRoot($root->getRoot()->getMainSection());
        }

        return $this;
    }
467038
public function setUrl(UrlContract $url)
    {
        $this->url = $url;
        $this->dirExists = null;
        return $this;
    }
1163499
private function setUrl(?string $url): self
    {
        $this->updatePropertyValue(
            UrlFieldInterface::PROP_URL,
            $url
        );

        return $this;
    }
72624
public function diffUri($url)
    {
        if (is_object($url) && !empty($url->uri)) {
            $this->uri = \UString::substrAfter($this->uri, $url->uri);
            \UString::doStartWith($this->uri, '/');
        }
        return $this;
    }
1317395
public function setBaseUrl($url) {
		if ($url === '/' || $url === '//') {
			$this->baseUrl = $url;
			return;
		}
		
		$this->baseUrl = rtrim($url, '/') . '/';
		
		return $this;
	}
998339
public static function setRoot(vfsStreamDirectory $root): vfsStreamDirectory
    {
        self::$root = $root;
        clearstatcache();
        return self::$root;
    }
331812
public function setPageRoot($root = false)
    {
        $this->issetpageroot = true;

        if (Conversion::validateNodeName($root) && $root != $this->page->nodeName) {
            $nodelist = $this->page->childNodes;
            $this->page = $this->dom->createElement($root);

            foreach ($nodelist as $item) {
                $this->page->appendChild($item->cloneNode(true));
            }
        }
    }
664139
public function initUrl($url, $username = null, $password = null, $userAgent = null)
    {
        if (!is_null($username) && !is_null($password)) {
            $this->httpBasicAuth['username'] = $username;
            $this->httpBasicAuth['password'] = $password;
        }

        if (!is_null($userAgent)) {
            $this->httpUserAgent = $userAgent;
        }

        $this->initFile($url);

        return $this;
    }
392285
public function setDatabaseUrl ($url)
    {
        $parts = parse_url($url);

        $this->database['name'] = trim($parts['path'], '/');
        $this->database['user'] = $parts['user'];
        $this->database['pass'] = $parts['pass'];
        $this->database['host'] = $parts['host'];
        $this->database['port'] = $parts['port'];

        return $this;
    }