devel_wizard-2.x-dev/src/Commands/PhpstormIdeaSpellCommands.php
src/Commands/PhpstormIdeaSpellCommands.php
<?php
declare(strict_types=1);
namespace Drupal\devel_wizard\Commands;
use Drupal\devel_wizard\Spell\SpellManagerInterface;
use Drupal\devel_wizard\Utils;
use Drush\Attributes as CLI;
use Drush\Boot\DrupalBootLevels;
class PhpstormIdeaSpellCommands extends SpellCommandsBase {
protected Utils $utils;
public function __construct(
SpellManagerInterface $spellManager,
Utils $utils,
) {
$this->utils = $utils;
parent::__construct($spellManager);
}
/**
* @noinspection PhpUnusedParameterInspection
*/
#[CLI\Command(name: 'devel-wizard:spell:devel_wizard_phpstorm_idea')]
#[CLI\Help(
description: 'Generates a basic PHPStorm project.',
)]
#[CLI\Bootstrap(level: DrupalBootLevels::FULL)]
#[CLI\Argument(
name: 'projectRoot',
description: 'Path to project directory.',
)]
public function cmdPhpStormIdeaExecute(string $projectRoot): void {
$this->execute();
}
protected function buildSpellConfigurationFromInput(): array {
$input = $this->input();
$spellId = $this->getSpellIdFromInput();
return match ($spellId) {
'devel_wizard_phpstorm_idea' => [
'project_root' => $input->getArgument('projectRoot'),
],
default => [],
};
}
}
