Skip to content

Commit 586e111

Browse files
committed
use composer class to get the latest version
1 parent 4ed985c commit 586e111

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/Helper/VersionHelper.php

+2-22
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Artemeon\M2G\Helper;
66

77
use ahinkle\PackagistLatestVersion\PackagistLatestVersion;
8+
use Composer\InstalledVersions;
89
use Exception;
910

1011
class VersionHelper
@@ -18,28 +19,7 @@ public static function getPackageName(): ?string
1819

1920
public static function fetchVersion(): string
2021
{
21-
$name = self::getPackageName();
22-
23-
$version = null;
24-
25-
foreach (
26-
[
27-
__DIR__ . '/../../../../composer/installed.php',
28-
__DIR__ . '/../../../vendor/composer/installed.php',
29-
__DIR__ . '/../../vendor/composer/installed.php'
30-
] as $file
31-
) {
32-
if (file_exists($file)) {
33-
$installed = require $file;
34-
$version = $installed['versions'][$name]['pretty_version'] ?? null;
35-
36-
break;
37-
}
38-
}
39-
40-
unset($file, $installed);
41-
42-
return $version;
22+
return InstalledVersions::getPrettyVersion('artemeon/mantis2github');
4323
}
4424

4525
/**

0 commit comments

Comments
 (0)