You are here

protected function HackedCommands::validateProjectName in Hacked! 8.2

Checks that machine_name is valid Drupal project.

@throw \Exception For empty for invalid project machine names.

Parameters

string $machine_name: The machine name to be checked.

2 calls to HackedCommands::validateProjectName()
HackedCommands::validateDetailsCommand in src/Commands/HackedCommands.php
Validates the hacked:details command.
HackedCommands::validateDiffCommand in src/Commands/HackedCommands.php
Validates the hacked:diff command.

File

src/Commands/HackedCommands.php, line 243

Class

HackedCommands
A Drush commandfile for Hacked! module.

Namespace

Drupal\hacked\Commands

Code

protected function validateProjectName($machine_name) {
  $project = new hackedProject($machine_name);
  $project
    ->identify_project();
  if (!$project->project_identified) {
    throw new \Exception((string) $this
      ->t('Could not find project: @project', [
      '@project' => $machine_name,
    ]));
  }
}