
| Current Path : /var/www/html/c12park/vendor/chi-teck/drupal-code-generator/src/Command/PhpStormMeta/ |
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/c12park/vendor/chi-teck/drupal-code-generator/src/Command/PhpStormMeta/Extensions.php |
<?php
declare(strict_types=1);
namespace DrupalCodeGenerator\Command\PhpStormMeta;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use DrupalCodeGenerator\Asset\File;
/**
* Generates PhpStorm meta-data for extensions.
*/
final class Extensions {
/**
* Constructs the object.
*/
public function __construct(
private readonly ModuleHandlerInterface $moduleHandler,
private readonly ThemeHandlerInterface $themeHandler,
) {}
/**
* Generator callback.
*/
public function __invoke(): File {
// Module handler also manages profiles.
$module_extensions = \array_filter(
$this->moduleHandler->getModuleList(),
static fn (Extension $extension): bool => $extension->getType() === 'module',
);
$modules = \array_keys($module_extensions);
$themes = \array_keys($this->themeHandler->listInfo());
\sort($themes);
return File::create('.phpstorm.meta.php/extensions.php')
->template('extensions.php.twig')
->vars(['modules' => $modules, 'themes' => $themes]);
}
}