1
0
Fork 0

removed overkill function isHash as suggested by @stloyd

pull/1046/head
Zbigniew Czapran 2012-08-31 16:37:03 +01:00
parent c0c23033d5
commit 8d966547a2
1 changed files with 1 additions and 13 deletions

View File

@ -26,7 +26,6 @@ use Composer\Package\LinkConstraint\VersionConstraint;
class VersionParser
{
private static $modifierRegex = '[._-]?(?:(beta|b|RC|alpha|a|patch|pl|p)(?:[.-]?(\d+))?)?([.-]?dev)?';
private static $sha1Length = 40;
/**
* Returns the stability of a version
@ -76,24 +75,13 @@ class VersionParser
}
// if source reference is a sha1 hash -- truncate
if ($truncate && self::isHash($package->getSourceReference())) {
if ($truncate && strlen($package->getSourceReference()) === 40) {
return $package->getPrettyVersion() . ' ' . substr($package->getSourceReference(), 0, 6);
}
return $package->getPrettyVersion() . ' ' . $package->getSourceReference();
}
/**
* Indicates whether version is in form of hash.
*
* @param string $version
* @return boolean
*/
private static function isHash($version)
{
return strlen($version) == self::$sha1Length;
}
/**
* Normalizes a version string to be able to perform comparisons on it
*