File tree 1 file changed +8
-11
lines changed
Filter options
src/Symfony/Component/Uid/Command
1 file changed +8
-11
lines changed
Original file line number Diff line number Diff line change 23
23
24
24
class GenerateUlidCommand extends Command
25
25
{
26
+ private const FORMAT_OPTIONS = [
27
+ 'base32 ' ,
28
+ 'base58 ' ,
29
+ 'rfc4122 ' ,
30
+ ];
31
+
26
32
protected static $ defaultName = 'ulid:generate ' ;
27
33
protected static $ defaultDescription = 'Generate a ULID ' ;
28
34
@@ -87,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
87
93
88
94
$ formatOption = $ input ->getOption ('format ' );
89
95
90
- if (\in_array ($ formatOption , $ this -> getAvailableFormatOptions () )) {
96
+ if (\in_array ($ formatOption , self :: FORMAT_OPTIONS )) {
91
97
$ format = 'to ' .ucfirst ($ formatOption );
92
98
} else {
93
99
$ io ->error (sprintf ('Invalid format "%s", did you mean "base32", "base58" or "rfc4122"? ' , $ input ->getOption ('format ' )));
@@ -112,16 +118,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
112
118
public function complete (CompletionInput $ input , CompletionSuggestions $ suggestions ): void
113
119
{
114
120
if ($ input ->mustSuggestOptionValuesFor ('format ' )) {
115
- $ suggestions ->suggestValues ($ this -> getAvailableFormatOptions () );
121
+ $ suggestions ->suggestValues (self :: FORMAT_OPTIONS );
116
122
}
117
123
}
118
-
119
- private function getAvailableFormatOptions (): array
120
- {
121
- return [
122
- 'base32 ' ,
123
- 'base58 ' ,
124
- 'rfc4122 ' ,
125
- ];
126
- }
127
124
}
You can’t perform that action at this time.
0 commit comments