From 8d966547a28e792c4ef27446b267064a36851143 Mon Sep 17 00:00:00 2001 From: Zbigniew Czapran Date: Fri, 31 Aug 2012 16:37:03 +0100 Subject: [PATCH] removed overkill function isHash as suggested by @stloyd --- src/Composer/Package/Version/VersionParser.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Composer/Package/Version/VersionParser.php b/src/Composer/Package/Version/VersionParser.php index d5f809d18..c9a0944eb 100644 --- a/src/Composer/Package/Version/VersionParser.php +++ b/src/Composer/Package/Version/VersionParser.php @@ -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 *