Plugin.php 870 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. declare(strict_types=1);
  3. namespace SixShop\Core;
  4. use Composer\InstalledVersions;
  5. class Plugin
  6. {
  7. public const string EXTENSION_TYPE = 'sixshop-extension';
  8. public static array $installedSixShopExtensions = [];
  9. /**
  10. * @return array{root: array{reference: string}, versions: array<string, array>}
  11. */
  12. public static function getInstalledSixShopExtensions(): array
  13. {
  14. if (self::$installedSixShopExtensions) {
  15. return self::$installedSixShopExtensions;
  16. }
  17. $composerDir = dirname(InstalledVersions::getInstallPath('composer/composer'), 2);
  18. $filePath = $composerDir . '/installedSixShop.php';
  19. if (!file_exists($filePath)) {
  20. require dirname(__DIR__) . '/bin/generate-installed-sixshop.php';
  21. }
  22. return self::$installedSixShopExtensions = require $filePath;
  23. }
  24. }