Skip to content

Commit

Permalink
chore(php): Change the wording
Browse files Browse the repository at this point in the history
I changed the wording for warning and error messages.

Signed-off-by: Baptiste Fotia <[email protected]>
  • Loading branch information
zak39 committed Nov 15, 2023
1 parent 2bbcfc8 commit 0f85f59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions lib/Commands/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function configure(): void {
'user-workspace-manager',
'uwm',
InputOption::VALUE_REQUIRED,
'The user will be workspace manager of your workspace. Please, use its uid or email address'
'The user will be workspace manager of your workspace. Please, use its user-id or email address'
);

parent::configure();
Expand All @@ -89,21 +89,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->hasParameterOption('--user-workspace-manager')) {
$pattern = $input->getOption('user-workspace-manager');
if (!$this->userChecker->checkUserExist($pattern)) {
$this->logger->error("The $pattern user or email is not exist.");
throw new \Exception("The $pattern user or email is not exist.");
$this->logger->error("$pattern could not be found. Please, make sure user-id or email exists in the Nextcloud instance.");
throw new \Exception("$pattern could not be found. Please, make sure user-id or email exists in the Nextcloud instance.");
}
}

if ($this->checkValueFormatOptionIsValid($input)) {
$this->logger->error(
sprintf(
"The value is not valid.\nPlease, define an option valid : %s",
"The format value is not valid.\nPlease, add a valid option : %s",
implode(', ', self::OPTION_FORMAT_AVAILABLE)
)
);
throw new \Exception(
sprintf(
"The value is not valid.\nPlease, define an option valid : %s",
"The format value is not valid.\nPlease, add a valid option : %s",
implode(', ', self::OPTION_FORMAT_AVAILABLE)
)
);
Expand Down
18 changes: 9 additions & 9 deletions lib/Commands/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
"No respect the glossary headers. "
. "Please, you must define these 2 headers : "
. "%s : To specify the workspace name; "
. "%s : To specify the user's uid or email address.",
. "%s : To specify the user's user-id or email address.",
implode(", ", Csv::WORKSPACE_FIELD),
implode(", ", Csv::USER_FIELD)
));
Expand All @@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
"No respect the glossary headers.\n\n"
. "Please, you must define these 2 headers :\n"
. " - %s : To specify the workspace name.\n"
. " - %s : To specify the user's uid or email address.",
. " - %s : To specify the user's user-id or email address.",
implode(", ", Csv::WORKSPACE_FIELD),
implode(", ", Csv::USER_FIELD)
)
Expand Down Expand Up @@ -111,16 +111,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->adminGroup->addUser($user, $groupname);
}

$this->logger->info("The import is done.");
$output->writeln("The import is done.");
$this->logger->info("Workspaces import done.");
$output->writeln("Workspaces import done.");

return 0;
}

protected function configure(): void {
$this
->setName('workspace:import')
->setDescription('This command allows you to import a csv file to create workspaces and define the workspace manager users.')
->setDescription('This command allows you to import a csv file to create workspaces and define their managers.')
->addArgument('path', InputArgument::REQUIRED, 'The path of the csv file.');
parent::configure();
}
Expand All @@ -137,7 +137,7 @@ private function getSpacenamesDuplicated(array $dataResponse): ?string {

if (!empty($workspacesAreNotExist)) {
$workspacesAreNotExist = array_map(fn ($spacename) => " - $spacename\n", $workspacesAreNotExist);
$message .= "Workspace names below already exist :\n" . implode('', $workspacesAreNotExist);
$message .= "The Workspace names below already exist:\n" . implode('', $workspacesAreNotExist);
$message .= "\n";

return $message;
Expand All @@ -158,7 +158,7 @@ private function getUsersArentExist(array $dataResponse): ?string {

if (!empty($usersAreNotExist)) {
$usersAreNotExist = array_map(fn ($username) => " - $username\n", $usersAreNotExist);
$message .= "Users below aren't known :\n" . implode('', $usersAreNotExist);
$message .= "The below users do not exist:\n" . implode('', $usersAreNotExist);

return $message;
}
Expand All @@ -178,8 +178,8 @@ private function getWorkspacesWithCharacterSpecials(array $dataResponse): ?strin

if (!empty($spacenamesWithCharacterSpecials)) {
$spacenamesStringify = array_map(fn ($spacename) => " - $spacename\n", $spacenamesWithCharacterSpecials);
$message .= "The workspace names below contain special characters :\n" . implode('', $spacenamesStringify);
$message .= "\nPlease, your Workspace names must not contain the following characters: " . implode(" ", str_split(WorkspaceCheckService::CHARACTERS_SPECIAL));
$message .= "The below workspace names contain special characters :\n" . implode('', $spacenamesStringify);
$message .= "\nPlease, make sure the Workspace names do not contain one of the following characters: " . implode(" ", str_split(WorkspaceCheckService::CHARACTERS_SPECIAL));

return $message;
}
Expand Down

0 comments on commit 0f85f59

Please sign in to comment.