Skip to content

Commit c1d5319

Browse files
committed
DISPLAY-986: Review feedback
1 parent fed639e commit c1d5319

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
6-
- Update docker build to publish to "os2display" org on docker hup. Update github workflow to latest actions.
6+
- Update docker build to publish to "os2display" org on docker hub. Update github workflow to latest actions.
77
- Updated `EventDatabaseApiFeedType` query ensuring started
88
but not finished events are found.
99
- Refactored all feed related classes and services

src/Command/User/AddUserCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ protected function interact(InputInterface $input, OutputInterface $output): voi
165165
$this->io->text(' > <info>Role</info>: '.$role);
166166
} else {
167167
$question = new ChoiceQuestion(
168-
'Please select the users role (defaults to editor)',
169-
['editor', 'admin'],
168+
'Please select the user\'s role (defaults to editor)',
169+
CommandInputValidator::ALLOWED_USER_ROLES,
170170
0
171171
);
172-
$question->setErrorMessage('Color %s is invalid.');
172+
$question->setErrorMessage('Role %s is invalid.');
173173

174174
$role = $helper->ask($input, $output, $question);
175175
$output->writeln('You have just selected: '.$role);
@@ -284,7 +284,7 @@ private function getCommandHelp(): string
284284
If you omit any of the required arguments, the command will ask you to
285285
provide the missing values:
286286
287-
# command will ask you for the password etc
287+
# command will ask you for the password etc.
288288
<info>php %command.full_name%</info> <comment>email</comment>
289289
290290
# command will ask you for all arguments

src/Utils/CommandInputValidator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
class CommandInputValidator
2626
{
27+
public const ALLOWED_USER_ROLES = ['editor', 'admin'];
28+
2729
public function __construct(
2830
private TenantRepository $tenantRepository,
2931
) {}
@@ -95,8 +97,7 @@ public function validateRole(?string $role): string
9597
throw new InvalidArgumentException('The role can not be empty.');
9698
}
9799

98-
$allowedRoles = ['editor', 'admin'];
99-
if (!in_array($role, $allowedRoles)) {
100+
if (!in_array($role, self::ALLOWED_USER_ROLES)) {
100101
throw new InvalidArgumentException('Unknown role: '.$role);
101102
}
102103

0 commit comments

Comments
 (0)