Nastavi URL
@param string $url
@throws InvalidArgumentException
@throws UniqueConstraintViolationException
480779
public function setUrl(?string $url): void
	{
		if ($this->locale === null) {
			throw new InvalidArgumentException('Locale must be set before calling setUrl');
		}
		if ($this->isLink === null) {
			throw new InvalidArgumentException("'isLink' must be set before calling setUrl");
		}
		if (!$this->isLink && Strings::match($url, '/[^A-Za-z0-9_-]/')) {
			throw new InvalidArgumentException('URL contains invalid characters');
		}

		$completeUrl = !$this->isLink && $this->parent && $url !== null ?
			$this->parent->completeUrl . '/' . $url
			: $url;

		/* @var $repository PagesRepository */
		$repository = $this->getRepository();
		$page = $repository->getByUrl($completeUrl, $this->locale->name);
		if ($page !== null && $page !== $this) {
			throw new UniqueConstraintViolationException("Page with '$url' exists");
		}
		$this->url = $url;
	}
397872
public static function fromString($url)
    {
        static $defaults = ['scheme' => null, 'host' => null,
            'path' => null, 'port' => null, 'query' => null,
            'user' => null, 'pass' => null, 'fragment' => null];

        if (false === ($parts = parse_url($url))) {
            throw new \InvalidArgumentException('Unable to parse malformed '
                . 'url: ' . $url);
        }

        $parts += $defaults;

        // Convert the query string into a Query object
        if ($parts['query'] || 0 !== strlen($parts['query'])) {
            $parts['query'] = Query::fromString($parts['query']);
        }

        return new static($parts['scheme'], $parts['host'], $parts['user'],
            $parts['pass'], $parts['port'], $parts['path'], $parts['query'],
            $parts['fragment']);
    }
275431
public function validateUrl($url)
    {
        if ('' === $url) {
            return $this;
        }

        if (!is_string($url) || strlen($url) > 2000) {
            throw new InvalidArgumentException(
                'URL must be a string of at most 2,000 characters',
                400
            );
        }

        return $this;
    }
943541
public function Init($url) {
        $urlParts = explode("/", $url);

        //@todo: Get the application base url
        $baseUrl = "/";
        $baseUrlConstainsVirtualPath = !(strcasecmp("/", $baseUrl) === 0);
        $startIndex = $baseUrlConstainsVirtualPath ? self::StartIndexWithVirtualPath : self::StartIndexNoVirtualPath;

        $this->setUrl($url);
        if (array_key_exists($startIndex, $urlParts) && array_key_exists($startIndex + 1, $urlParts)) {
            $this->setModule($urlParts[$startIndex]);
            $this->setAction($urlParts[$startIndex + 1]);
        } else {
            $this->Init($this->defaultUrl);
        }
    }
34335
public function addUrl(Url $url)
    {
        if ($this->isFull()) {
            throw new \RuntimeException('The urlset limit has been exceeded');
        }

        $urlXml = $url->toXml();
        $this->appendXML($urlXml);

        //add unknown custom namespaces
        $this->customNamespaces = array_merge($this->customNamespaces, $url->getCustomNamespaces());

        //---------------------
        //Check limits
        if ($this->countItems++ >= self::LIMIT_ITEMS) {
            $this->limitItemsReached = true;
        }

        $urlLength = strlen($urlXml);
        $this->countBytes += $urlLength;

        if ($this->countBytes + $urlLength + strlen($this->getStructureXml()) > self::LIMIT_BYTES) {
            //we suppose the next url is almost the same length and cannot be added
            //plus we keep 500kB (@see self::LIMIT_BYTES)
            //... beware of numerous images set in url
            $this->limitBytesReached = true;
        }
        //---------------------
    }
454954
public static function setApiUrl($url)
    {
        $apiUrl = filter_var($url, FILTER_VALIDATE_URL);

        if (!$apiUrl) {
            throw new Exception\InvalidArgumentException(
                'API URL should be a valid url'
            );
        }

        self::$apiUrl = rtrim($url, '\\/');
    }
542833
public function identify($url)
    {
        $result = $this->parseProjectId($url);
        if (empty($result['projectId']) && strpos($url, '.') !== false) {
            $result = $this->identifyFromHeaders($url);
        }
        if (empty($result['projectId'])) {
            throw new InvalidArgumentException('Failed to identify project ID from URL: <error>' . $url . '</error>');
        }

        return $result + ['environmentId' => null, 'host' => null, 'appId' => null];
    }
1019510
public function setConst(string $const): void
	{
		if (!$this->locale) {
			throw new InvalidArgumentException('Locale must be set before calling setConst');
		}
		if (Strings::match($const, '/[^A-Za-z0-9_]/')) {
			throw new InvalidArgumentException('Constant contains invalid characters');
		}

		/* @var $repository ContentRepository */
		$repository = $this->getRepository();
		$content = $repository->getByConst($const, $this->locale->name);
		if ($content !== null && $content !== $this) {
			throw new UniqueConstraintViolationException("Content with '$const' exists");
		}
		$this->const = $const;
	}
142687
public function addImageFromUrl($url) {
        if (is_string($url)) {
            // URL specified as a string. Create a URL instance
            $url = GuzzleUrl::factory($url);
        }

        if (!($url instanceof GuzzleUrl)) {
            // Invalid argument
            throw new InvalidArgumentException(
                'Parameter must be a string or an instance of Guzzle\Http\Url'
            );
        }

        if (!$url->getScheme()) {
            throw new InvalidArgumentException('URL is missing scheme: ' . (string) $url);
        }

        // Fetch the image we want to add
        $image = (string) $this->get($url)->send()->getBody();

        return $this->addImageFromString($image);
    }
108225
public function setUrl($url)
    {
        if ($this->hasBeenSent()) {
            throw new CAS_OutOfSequenceException(
                'Cannot set the URL, request already sent.'
            );
        }
        if (!is_string($url)) {
            throw new CAS_InvalidArgumentException('$url must be a string.');
        }

        $this->_url = $url;
    }
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;
    }
1263207
protected function initialize($url)
    {
        $url = filter_var($url, FILTER_SANITIZE_URL);
        $parsedUrl = parse_url($url);

        if (false === filter_var($url, FILTER_VALIDATE_URL) || false === $parsedUrl) {
            throw new InvalidArgumentException(sprintf('URL "%s" seriously malformed.', $url));
        }

        $parsedUrl = $parsedUrl + [
                'scheme' => '',
                'host' => '',
                'port' => null,
                'user' => '',
                'pass' => '',
                'path' => '',
                'fragment' => '',
                'query' => ''
            ];

        $this->scheme = $this->filterScheme($parsedUrl['scheme']);
        $this->host = $this->filterHost($parsedUrl['host']);
        $this->port = $this->filterPort($parsedUrl['port']);
        $this->path = $this->filterPath($parsedUrl['path']);
        $this->query = $this->filterQuery($parsedUrl['query']);
        $this->fragment = $this->filterFragment($parsedUrl['fragment']);

        if ($parsedUrl['user']) {
            if ($parsedUrl['pass']) {
                $this->userInfo = $parsedUrl['user'] . ':' . $parsedUrl['pass'];
            } else {
                $this->userInfo = $parsedUrl['user'];
            }
        }
    }
630409
private function setUrl($url)
    {
        // remove the whitespace
        $url = trim($url);

        // @see https://gist.github.com/dperini/729294 and https://mathiasbynens.be/demo/url-regex
        $urlValidationRegex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS';
        if (!preg_match($urlValidationRegex, $url)) {
            throw new InvalidUrlException(sprintf('The url: "%s" is not a valid url.', $url), 400);
        }
        $this->url = $url;

        return $this;
    }
854241
public function url($url)
    {
        if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
            return $url;
        }

        if (is_string($url)) {
            return $this->parseStringUrl($url);
        }

        if (is_array($url)) {
            return $this->make(new UrlSettings($url));
        }

        if ($url instanceof UrlSettings) {
            return $this->make($url);
        }

        throw new \InvalidArgumentException('Settings is not a supported type');
    }
55134
public function setUrl($url): self
    {
        if (\is_string($url)) {
            $this->options['url'] = $url;

            return $this;
        }

        if ($url instanceof Leg) {
            $this->setUrlFromLeg($url);

            return $this;
        }

        if ($url instanceof BoardData) {
            $this->setUrlFromBoardData($url);

            return $this;
        }

        throw new \InvalidArgumentException(
            sprintf('setUrl must be a string, Leg or BoardData object')
        );
    }
392345
private function assertValidUrl(string $url): void
    {
        if (!(filter_var($url, FILTER_VALIDATE_URL) || filter_var($url, FILTER_VALIDATE_IP))) {
            throw new RequestContextException("Failed to set invalid URL: $url");
        }
    }
1162326
public function setUrl($url)
    {
        if (is_string($url)) {
            $this->url = $url;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($url) . "' for argument 'url' given. String expected."
            );
        }
    }