
| Current Path : /var/www/html/strat/vendor/webflo/drupal-finder/src/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/vendor/webflo/drupal-finder/src/DrupalFinderComposerRuntime.php |
<?php
/**
* @file
* Contains \DrupalFinder\DrupalFinderComposerRuntime.
*/
namespace DrupalFinder;
use Composer\InstalledVersions;
use Composer\Autoload\ClassLoader;
class DrupalFinderComposerRuntime
{
/**
* Get the Drupal root path.
*/
public function getDrupalRoot(): ?string
{
$core = InstalledVersions::getInstallPath('drupal/core');
return $core ? realpath(dirname($core)) : null;
}
/**
* Get the path to the Composer root directory.
*/
public function getComposerRoot(): ?string
{
foreach (InstalledVersions::getAllRawData() as $data) {
if (isset($data['versions']['drupal/core'])) {
return realpath($data['root']['install_path']);
}
}
$root = InstalledVersions::getRootPackage();
return realpath($root['install_path']);
}
/**
* Get the vendor path.
*/
public function getVendorDir(): ?string
{
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if ($loader->findFile(\Drupal::class)) {
return realpath($vendorDir);
}
}
}
}