public static function match($version, $constraints = null)
    {
        if (is_string($version) && empty($version)) {
            return false;
        }

        if (empty($constraints) || $version == $constraints) {
            return true;
        }

        $parser = new VersionParser();
        $modifierRegex = '[\-\@]dev(\#\w+)?';
        $constraints = preg_replace('{' . $modifierRegex . '$}i', '', $constraints);
        $version = $parser->normalize($version);
        $version = preg_replace('{' . $modifierRegex . '$}i', '', $version);

        if (empty($constraints) || $version == $constraints) {
            return true;
        }

        try {
            $pkgConstraint = new VersionConstraint('==', $version);
            $constraintObjects = $parser->parseConstraints($constraints);

            return $constraintObjects->matches($pkgConstraint);
        } catch (\Exception $ex) {
            return false;
        }
    }