Returns a clone with other extension.

@param string $extension

@return Url
559476
public function withExtension($extension)
    {
        $clone = clone $this;
        $clone->info['extension'] = $extension;

        if (empty($clone->info['file'])) {
            $clone->info['file'] = array_pop($clone->info['path']);
        }

        return $clone;
    }
211806
public function replaceExtension($filename, $extension)
    {
        $parts = $this->splitFilename($filename);
        $newFilename = $parts[0] . $parts[1];
        if (is_string($extension) && ($extension !== '')) {
            $newFilename .= '.' . $extension;
        }

        return $newFilename;
    }
1374348
public static function addExtension(string $file, string $extension)
    {
        if (substr($file, strlen($extension) * -1) !== $extension) {
            $file .= $extension;
        }
        return $file;
    }
1147916
public static function getMimeType($extension)
    {
        if (!isset(self::$mimeTypes[$extension])) {
            return null;
        }

        return self::$mimeTypes[$extension];
    }
1074636
public function getTypeByExtension($extension)
    {
        if ($this->isValidExtension($extension)) {

            // We get back flipped copy
            $list = $this->getList(true);
            return $list[$extension];

        } else {

            // For all unknown extensions, the default Mime-Type is used
            return 'application/octet-stream';
        }
    }
889504
public function getFormatForFileExtension($extension)
    {
        $format = $this->getConfiguredFormat();
        if ($format === static::FORMAT_AUTO) {
            $format = $this->getAutomaticFormatForFileExtension((string) $extension);
        }

        return $format;
    }
1331403
public function withExtensions(Ext\Extension ...$exts): Extensions
    {
        $obj = clone $this;
        foreach ($exts as $ext) {
            $obj->_extensions[$ext->oid()] = $ext;
        }
        return $obj;
    }
1240240
public function getBundles($extension = null)
    {
        if ($extension === null) {
            return $this->bundles;
        }
        elseif (isset($this->bundles[$extension])) {
            return $this->bundles[$extension];
        }
        else {
            return null;
        }
    }
619675
public function extension($extension = null)
    {
        if (is_null($extension)) {
            if (!empty($this->extension)) {
                return $this->extension;
            }
            if (isset($this->attributes['extension'])) {
                return $this->attributes['extension'];
            }
        }
        $this->extension = $this->checkExtension($extension);

        return $this;
    }
138616
public function url($doc = 'index', $ref = null)
    {
        return $this->factory->url($this, $ref, $doc);
    }
921225
public function replaceExtension($extension)
    {
        $atoms = $this->nameAtoms();
        if (array('', '') === $atoms) {
            if (null === $extension) {
                return $this;
            }

            return $this->replaceName(
                static::EXTENSION_SEPARATOR . $extension
            );
        }

        $numAtoms = count($atoms);

        if ($numAtoms > 1) {
            if (null === $extension) {
                $replacement = array();
            } else {
                $replacement = array($extension);
            }

            array_splice($atoms, -1, $numAtoms, $replacement);
        } elseif (null !== $extension) {
            $atoms[] = $extension;
        }

        return $this->replaceName(implode(self::EXTENSION_SEPARATOR, $atoms));
    }
524548
public function extend($name, ExtensionInterface $extension)
    {
        $this->getExtensions()->put($name, $extension);

        $extension->set($this);

        return $extension;
    }
860769
public function getPaths($extension = null)
	{
		if (isset($extension))
		{
			if (isset($this->paths[$extension]))
			{
				return $this->paths[$extension];
			}

			return;
		}

		return $this->paths;
	}
694746
public function withHost($host)
    {
        $uri = $this->getUri()->withHost($host);

        /** @var static $clone */
        $clone = $this->withUri($uri);

        return $clone;
    }
446474
public function resetAliases($extension = null)
    {
        if ($extension === null) {
            $this->aliases = [];
        }
        else {
            $this->aliases[$extension] = [];
        }

        return $this;
    }
817797
private function getParser($extension)
    {
        foreach ($this->supportedFileParsers as $fileParser) {
            if (in_array($extension, $fileParser::getSupportedExtensions($extension))) {
                return new $fileParser();
            }

        }

        // If none exist, then throw an exception
        throw new UnsupportedFormatException('Unsupported configuration format');
    }
347777
public static function getDomainFromURL($url)
	{
		$url = str_replace(self::getProtocolFromURL($url) . '://', '', $url);
		
		return explode('/', $url)[0];
	}