Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0f6b98

Browse filesBrowse files
[Console] replace method by const
1 parent 38aad7d commit d0f6b98
Copy full SHA for d0f6b98

File tree

1 file changed

+8
-11
lines changed
Filter options

1 file changed

+8
-11
lines changed

‎src/Symfony/Component/Uid/Command/GenerateUlidCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Uid/Command/GenerateUlidCommand.php
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323

2424
class GenerateUlidCommand extends Command
2525
{
26+
private const FORMAT_OPTIONS = [
27+
'base32',
28+
'base58',
29+
'rfc4122',
30+
];
31+
2632
protected static $defaultName = 'ulid:generate';
2733
protected static $defaultDescription = 'Generate a ULID';
2834

@@ -87,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8793

8894
$formatOption = $input->getOption('format');
8995

90-
if (\in_array($formatOption, $this->getAvailableFormatOptions())) {
96+
if (\in_array($formatOption, self::FORMAT_OPTIONS)) {
9197
$format = 'to'.ucfirst($formatOption);
9298
} else {
9399
$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)
112118
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
113119
{
114120
if ($input->mustSuggestOptionValuesFor('format')) {
115-
$suggestions->suggestValues($this->getAvailableFormatOptions());
121+
$suggestions->suggestValues(self::FORMAT_OPTIONS);
116122
}
117123
}
118-
119-
private function getAvailableFormatOptions(): array
120-
{
121-
return [
122-
'base32',
123-
'base58',
124-
'rfc4122',
125-
];
126-
}
127124
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.