Split the URL and version.

@param string $version The url and version (in the same string)

@return string[] The url and version
14394
protected static function splitUrlVersion($version)
    {
        $pos = strpos($version, '#');

        // number version or empty version
        if (false !== $pos) {
            $url = substr($version, 0, $pos);
            $version = substr($version, $pos);
        } else {
            $url = $version;
            $version = '#';
        }

        return array($url, $version);
    }
341543
public function selectVersion($version)
	{
		if ( ! in_array($version, $this->versions))
		{
			// not a value version
			return false;
		}

		$this->version = $version;

		return $this;
	}
1197410
public function script($src, $version=false){

        $list = [];

        foreach((array)$src as $script) {

            $type = 'text/javascript';
            $src  = $script;
            $load = '';

            if (is_array($script)) {
                extract($script);
            }

            $ispath = strpos($src, ':') !== false && !preg_match('#^(|http\:|https\:)//#', $src);
            $list[] = '<script src="'.($ispath ? $this->pathToUrl($src):$src).($version ? "?ver={$version}":"").'" type="'.$type.'" '.$load.'></script>';
        }

        return implode("\n", $list);
    }
751652
public function getLink(String $key, String $version = 'latest')
    {
        $return = $this->getLinks()[$key] ?? false;

        if( $version !== 'latest' )
        {
            return $this->versionModifier($version, $return);
        }

        return $return;
    }
830977
public function extractShortUrl(string $url):array {
		$urls = [$url];

		while($url = $this->extract($url)){
			$urls[] = $url;
		}

		return $urls;
	}
749986
public function getRoutes($version = null)
    {
        $routes = $this->adapter->getIterableRoutes($version);

        if (! is_null($version)) {
            $routes = [$version => $routes];
        }

        $collections = [];

        foreach ($routes as $key => $value) {
            $collections[$key] = new RouteCollection($this->container['request']);

            foreach ($value as $route) {
                $route = $this->createRoute($route);

                $collections[$key]->add($route);
            }
        }

        return is_null($version) ? $collections : $collections[$version];
    }
68338
public static function convertDateVersion($version)
    {
        if (preg_match('/^\d{7,}\./', $version)) {
            $pos = strpos($version, '.');
            $version = substr($version, 0, $pos).self::convertDateMinorVersion(substr($version, $pos + 1));
        }

        return $version;
    }
965811
def split_version(version):
    
    if re.match("^[^0-9].*", version):
        return [version]
    return [int(i) for i in version.split(".")]
1358289
public function get($version)
    {
        if (!isset($this->versions[$version])) {
            throw new OutOfBoundsException(sprintf(
                'The version %s of path %s does not exist.',
                $version,
                $this->path
            ));
        }

        return $this->versions[$version];
    }
875079
protected function splitNameAndPath($name)
    {

        list($start, $end) = strpos($name, '::') ? explode('::', $name) : ['', $name];

        if ($start) {
            return [$start, $end];
        }

        $paths = $this->getPaths();

        // If the name does not exists in the paths, it assumes its a (file)path.
        if (!isset($paths[$end])) {
            return ['', $end];
        }

        return [$end, ''];

    }
981994
private static function split(string $string): array
    {
        $chars = [];

        for ($i = 0; $i < strlen($string); $i++) {
            $chars[] = $string[$i];
        }

        return $chars;
    }
760777
protected function splitUrl($url)
    {
        $path = parse_url(trim($url, '/'), PHP_URL_PATH);
        return $path ? explode('/', $path) : array();
    }
1002494
public function getVersions()
    {
        while (
            !empty($this->version) &&
            substr_count($this->version, '.') < 2
        ) {
            $this->version .= '.0';
        }
        // Remove part by part of the version.
        $result = array_merge(
            [$this->version],
            $this->explode($this->version, '.')
        );
        asort($result);
        usort($result, function ($a, $b) {
            // PHP 7: Switch to the <=> "Spaceship" operator
            return strlen($b) - strlen($a);
        });
        return $this->filterDuplicates($result);
    }
422570
public function asVersion($version) {
        $result = array();

        foreach (get_object_vars($this) as $property => $value) {
            //
            // skip properties that start with an underscore to allow
            // storing information that isn't included in statement
            // structure etc. (see Attachment.content for example)
            //
            if (strpos($property, '_') === 0) {
                continue;
            }

            if ($value instanceof VersionableInterface) {
                $value = $value->asVersion($version);
            }
            elseif (is_array($value) && !empty($value)) {
                $tmp_value = array();
                foreach ($value as $element) {
                    if ($element instanceof VersionableInterface) {
                        array_push($tmp_value, $element->asVersion($version));
                    }
                    else {
                        array_push($tmp_value, $element);
                    }
                }
                $value = $tmp_value;
            }

            if (isset($value) && (!is_array($value) || !empty($value))) {
                $result[$property] = $value;
            }
        }

        if (method_exists($this, '_asVersion')) {
            $this->_asVersion($result, $version);
        }

        return $result;
    }
619003
public function mapOfficeVersion(string $version): string
    {
        $intVersion = (int) $version;

        if (in_array($intVersion, [2007, 2010, 2013, 2016])) {
            return (string) $intVersion;
        }

        if (16 === $intVersion) {
            return '2016';
        }

        if (15 === $intVersion) {
            return '2013';
        }

        if (14 === $intVersion) {
            return '2010';
        }

        if (12 === $intVersion) {
            return '2007';
        }

        return '0';
    }
915855
public static function parse ($version)
    {
        $nums = explode(self::DELIMITER, $version);
        $numbers = array();
        foreach ($nums as $num) {
            if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
                if (isset($matches[1])) {
                    $numbers[] = $matches[1];
                } else {
                    $numbers[] = 0;
                }
            } else {
                break;
            }
        }
        if (! sizeof($numbers)) {
            $numbers = array(0);
        }
        return $numbers;
    }
506974
protected function processURL(string $url) : array
    {
        $url = trim($url, '/');
        $url_array = explode('/', $url);
        return $url_array;
    }