Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. VersionParser.php

function VersionParser::normalizeBranch

Normalizes a branch name to be able to perform comparisons on it.

Parameters

string $name:

Return value

string

1 call to VersionParser::normalizeBranch()
VersionParser::normalize in vendor/composer/semver/src/VersionParser.php
Normalizes a version string to be able to perform comparisons on it.

File

vendor/composer/semver/src/VersionParser.php, line 217

Class

VersionParser
Version parser.

Namespace

Composer\Semver

Code

public function normalizeBranch($name) {
    $name = trim((string) $name);
    if (preg_match('{^v?(\\d++)(\\.(?:\\d++|[xX*]))?(\\.(?:\\d++|[xX*]))?(\\.(?:\\d++|[xX*]))?$}i', $name, $matches)) {
        $version = '';
        for ($i = 1; $i < 5; ++$i) {
            $version .= isset($matches[$i]) ? str_replace(array(
                '*',
                'X',
            ), 'x', $matches[$i]) : '.x';
        }
        return str_replace('x', '9999999', $version) . '-dev';
    }
    return 'dev-' . $name;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal