-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathGeneratorType.php
52 lines (44 loc) · 1.15 KB
/
GeneratorType.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
namespace DrupalCodeGenerator;
/**
* Generator definition.
*
* @phpcs:disable
* @todo Enable code sniffer once it supports enums
* @see https://www.drupal.org/project/coder/issues/3283741
*/
enum GeneratorType {
// @todo Support installation profiles.
case MODULE;
case MODULE_COMPONENT;
case THEME;
case THEME_COMPONENT;
case OTHER;
/**
* Determines if the generator produces a new Drupal extension.
*/
public function isNewExtension(): bool {
return $this === self::MODULE || $this === self::THEME;
}
/**
* Defines a label for extension human name.
*/
public function getNameLabel(): string {
return match ($this) {
self::MODULE, self::MODULE_COMPONENT => 'Module name',
self::THEME, self::THEME_COMPONENT => 'Theme name',
default => 'Name',
};
}
/**
* Defines a label for extension machine name.
*/
public function getMachineNameLabel(): string {
return match ($this) {
self::MODULE, self::MODULE_COMPONENT => 'Module machine name',
self::THEME, self::THEME_COMPONENT => 'Theme machine name',
default => 'Machine name',
};
}
}