Skip to content

Commit

Permalink
unnecessary curly braces
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Jul 19, 2024
1 parent 94b1e90 commit f473d1a
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion bin/acli
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if (in_array($input->getFirstArgument(), ['clear-kernel-cache', 'ckc'])) {
$kernel_cache_dir = $kernel->getCacheDir();
$filesystem->remove([$kernel_cache_dir]);
$filesystem->mkdir($kernel_cache_dir);
$filesystem->touch("{$kernel_cache_dir}/.gitkeep");
$filesystem->touch("$kernel_cache_dir/.gitkeep");
exit;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Command/Api/ApiCommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private function addPostArgumentUsageToExample(mixed $requestBody, mixed $propKe

if (array_key_exists('example', $requestBodyContent)) {
$example = $requestBodyContent['example'];
$prefix = $type === 'argument' ? '' : "--{$propKey}=";
$prefix = $type === 'argument' ? '' : "--$propKey=";
if (array_key_exists($propKey, $example)) {
switch ($paramDefinition['type']) {
case 'object':
Expand Down Expand Up @@ -194,7 +194,7 @@ private function addPostArgumentUsageToExample(mixed $requestBody, mixed $propKe
} else {
$value = $example[$propKey];
}
$usage .= $prefix . "\"{$value}\" ";
$usage .= $prefix . "\"$value\" ";
break;
}
}
Expand Down Expand Up @@ -486,7 +486,7 @@ private function generateApiListCommands(array $apiCommands, string $commandPref
$command->setName($name);
$command->setNamespace($name);
$command->setAliases([]);
$command->setDescription("List all API commands for the {$namespace} resource");
$command->setDescription("List all API commands for the $namespace resource");
$apiListCommands[$name] = $command;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function normalize(): array
// phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys
$normalized = [
'type' => 'packageRecommendation',
'id' => "{$this->packageName}:{$this->versionConstraint}",
'id' => "$this->packageName:$this->versionConstraint",
'attributes' => [
'requirePackage' => [
'name' => $this->packageName,
Expand Down
2 changes: 1 addition & 1 deletion src/Command/App/UnlinkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$application = $this->getCloudApplication($this->datastoreAcli->get('cloud_app_uuid'));
$this->datastoreAcli->set('cloud_app_uuid', null);
$output->writeln("<info>Unlinked <options=bold>$projectDir</> from Cloud application <options=bold>{$application->name}</></info>");
$output->writeln("<info>Unlinked <options=bold>$projectDir</> from Cloud application <options=bold>$application->name</></info>");

return Command::SUCCESS;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Archive/ArchiveExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$randomString = (string) random_int(10000, 100000);
$tempDirName = 'acli-archive-' . basename($this->dir) . '-' . time() . '-' . $randomString;
$archiveTempDir = Path::join(sys_get_temp_dir(), $tempDirName);
$this->io->confirm("This will generate a new archive in <options=bold>{$this->destinationDir}</> containing the contents of your Drupal application at <options=bold>{$this->dir}</>.\n Do you want to continue?");
$this->io->confirm("This will generate a new archive in <options=bold>$this->destinationDir</> containing the contents of your Drupal application at <options=bold>$this->dir</>.\n Do you want to continue?");

$this->checklist->addItem('Removing temporary artifact directory');
$this->checklist->updateProgressBar("Removing $archiveTempDir");
Expand Down Expand Up @@ -98,7 +98,7 @@ private function determineDestinationDir(InputInterface $input): void
{
$this->destinationDir = $input->getArgument('destination-dir');
if (!$this->fs->exists($this->destinationDir)) {
throw new AcquiaCliException("The destination directory {$this->destinationDir} does not exist!");
throw new AcquiaCliException("The destination directory $this->destinationDir does not exist!");
}
}

Expand All @@ -107,7 +107,7 @@ private function determineDestinationDir(InputInterface $input): void
*/
private function createArchiveDirectory(string $artifactDir): void
{
$this->checklist->updateProgressBar("Mirroring source files from {$this->dir} to {$artifactDir}");
$this->checklist->updateProgressBar("Mirroring source files from $this->dir to $artifactDir");
$originFinder = $this->localMachineHelper->getFinder();
$originFinder->files()->in($this->dir)
// Include dot files like .htaccess.
Expand Down
8 changes: 4 additions & 4 deletions src/Command/CodeStudio/CodeStudioCommandTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ private function determineGitLabProject(ApplicationResponse $cloudApplication):
$projects,
'id',
'path_with_namespace',
"Found multiple projects that could match the {$cloudApplication->name} application. Choose which one to configure."
"Found multiple projects that could match the $cloudApplication->name application. Choose which one to configure."
);
}
// Prompt to create project.
$this->io->writeln([
"",
"Could not find any existing Code Studio project for Acquia Cloud Platform application <comment>{$cloudApplication->name}</comment>.",
"Searched for UUID <comment>{$cloudApplication->uuid}</comment> in project descriptions.",
"Could not find any existing Code Studio project for Acquia Cloud Platform application <comment>$cloudApplication->name</comment>.",
"Searched for UUID <comment>$cloudApplication->uuid</comment> in project descriptions.",
]);
$createProject = $this->io->confirm('Would you like to create a new Code Studio project? If you select "no" you may choose from a full list of existing projects.');
if ($createProject) {
Expand All @@ -202,7 +202,7 @@ private function determineGitLabProject(ApplicationResponse $cloudApplication):
$this->gitLabClient->projects()->all(),
'id',
'path_with_namespace',
"Choose a Code Studio project to configure for the {$cloudApplication->name} application"
"Choose a Code Studio project to configure for the $cloudApplication->name application"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function checkGitLabCiCdVariables(array $project): void
$existingKeys = array_column($gitlabCicdExistingVariables, 'key');
foreach ($gitlabCicdVariables as $gitlabCicdVariable) {
if (!in_array($gitlabCicdVariable, $existingKeys, true)) {
throw new AcquiaCliException("Code Studio CI/CD variable {$gitlabCicdVariable} is not configured properly");
throw new AcquiaCliException("Code Studio CI/CD variable $gitlabCicdVariable is not configured properly");
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/Command/CodeStudio/CodeStudioWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->io->writeln([
"",
"This command will configure the Code Studio project <comment>{$project['path_with_namespace']}</comment> for automatic deployment to the",
"Acquia Cloud Platform application <comment>{$cloudApplication->name}</comment> (<comment>$appUuid</comment>)",
"using credentials (API Token and SSH Key) belonging to <comment>{$account->mail}</comment>.",
"Acquia Cloud Platform application <comment>$cloudApplication->name</comment> (<comment>$appUuid</comment>)",
"using credentials (API Token and SSH Key) belonging to <comment>$account->mail</comment>.",
"",
"If the <comment>{$account->mail}</comment> Cloud account is deleted in the future, this Code Studio project will need to be re-configured.",
"If the <comment>$account->mail</comment> Cloud account is deleted in the future, this Code Studio project will need to be re-configured.",
]);
$answer = $this->io->confirm('Do you want to continue?');
if (!$answer) {
Expand Down Expand Up @@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
" git remote add codestudio {$project['http_url_to_repo']}",
" git push codestudio",
]);
$this->io->note(["If the {$account->mail} Cloud account is deleted in the future, this Code Studio project will need to be re-configured."]);
$this->io->note(["If the $account->mail Cloud account is deleted in the future, this Code Studio project will need to be re-configured."]);

return Command::SUCCESS;
}
Expand Down
34 changes: 17 additions & 17 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ private function findCloudApplicationByGitUrl(
$terminalWidth = (new Terminal())->getWidth();
foreach ($customerApplications as $application) {
// Ensure that the message takes up the full terminal width to prevent display artifacts.
$message = "Searching <options=bold>{$application->name}</> for matching git URLs";
$message = "Searching <options=bold>$application->name</> for matching git URLs";
$suffixLength = $terminalWidth - strlen($message) - 17;
$suffix = $suffixLength > 0 ? str_repeat(' ', $suffixLength) : '';
$progressBar->setMessage($message . $suffix);
Expand Down Expand Up @@ -789,7 +789,7 @@ private function searchApplicationEnvironmentsForGitUrl(
): ?ApplicationResponse {
foreach ($applicationEnvironments as $environment) {
if ($environment->flags->production && in_array($environment->vcs->url, $localGitRemotes, true)) {
$this->logger->debug("Found matching Cloud application! {$application->name} with uuid {$application->uuid} matches local git URL {$environment->vcs->url}");
$this->logger->debug("Found matching Cloud application! $application->name with uuid $application->uuid matches local git URL {$environment->vcs->url}");

return $application;
}
Expand All @@ -809,7 +809,7 @@ protected function inferCloudAppFromLocalGitConfig(
Client $acquiaCloudClient
): ?ApplicationResponse {
if ($this->projectDir && $this->input->isInteractive()) {
$this->output->writeln("There is no Cloud Platform application linked to <options=bold>{$this->projectDir}/.git</>.");
$this->output->writeln("There is no Cloud Platform application linked to <options=bold>$this->projectDir/.git</>.");
$answer = $this->io->confirm('Would you like Acquia CLI to search for a Cloud application that matches your local git config?');
if ($answer) {
$this->output->writeln('Searching for a matching Cloud application...');
Expand Down Expand Up @@ -976,7 +976,7 @@ public static function validateUuid(string $uuid): string
private function saveCloudUuidToDatastore(ApplicationResponse $application): bool
{
$this->datastoreAcli->set('cloud_app_uuid', $application->uuid);
$this->io->success("The Cloud application {$application->name} has been linked to this repository by writing to {$this->datastoreAcli->filepath}");
$this->io->success("The Cloud application $application->name has been linked to this repository by writing to {$this->datastoreAcli->filepath}");

return true;
}
Expand Down Expand Up @@ -1102,7 +1102,7 @@ private function doGetEnvFromAlias(string $alias): EnvironmentResponse
$environments = $environmentsResource->getAll($customerApplication->uuid);
foreach ($environments as $environment) {
if ($environment->name === $environmentAlias) {
$this->logger->debug("Found environment {$environment->uuid} matching $environmentAlias.");
$this->logger->debug("Found environment $environment->uuid matching $environmentAlias.");

return $environment;
}
Expand Down Expand Up @@ -1158,7 +1158,7 @@ private function doGetApplicationFromAlias(string $applicationAlias): mixed

$customerApplication = $customerApplications[0];

$this->logger->debug("Found application {$customerApplication->uuid} matching alias $applicationAlias.");
$this->logger->debug("Found application $customerApplication->uuid matching alias $applicationAlias.");

return $customerApplication;
}
Expand Down Expand Up @@ -1474,9 +1474,9 @@ private function getCloudSites(EnvironmentResponse $cloudEnvironment): array
protected function getCloudSitesPath(mixed $cloudEnvironment, mixed $sitegroup): string
{
if ($cloudEnvironment->platform === 'cloud-next') {
$path = "/home/clouduser/{$cloudEnvironment->name}/sites";
$path = "/home/clouduser/$cloudEnvironment->name/sites";
} else {
$path = "/mnt/files/$sitegroup.{$cloudEnvironment->name}/sites";
$path = "/mnt/files/$sitegroup.$cloudEnvironment->name/sites";
}
return $path;
}
Expand Down Expand Up @@ -1680,7 +1680,7 @@ protected function createMySqlDumpOnLocal(string $dbHost, string $dbUser, string
'mysqldump',
'gzip',
]);
$filename = "acli-mysql-dump-{$dbName}.sql.gz";
$filename = "acli-mysql-dump-$dbName.sql.gz";
$localTempDir = sys_get_temp_dir();
$localFilepath = $localTempDir . '/' . $filename;
$this->logger->debug("Dumping MySQL database to $localFilepath on this machine");
Expand All @@ -1692,10 +1692,10 @@ protected function createMySqlDumpOnLocal(string $dbHost, string $dbUser, string
$outputCallback('out', "Dumping MySQL database to $localFilepath on this machine");
}
if ($this->localMachineHelper->commandExists('pv')) {
$command = "bash -c \"set -o pipefail; MYSQL_PWD={$dbPassword} mysqldump --host={$dbHost} --user={$dbUser} {$dbName} | pv --rate --bytes | gzip -9 > $localFilepath\"";
$command = "bash -c \"set -o pipefail; MYSQL_PWD=$dbPassword mysqldump --host=$dbHost --user=$dbUser $dbName | pv --rate --bytes | gzip -9 > $localFilepath\"";
} else {
$this->io->warning('Install `pv` to see progress bar');
$command = "bash -c \"set -o pipefail; MYSQL_PWD={$dbPassword} mysqldump --host={$dbHost} --user={$dbUser} {$dbName} | gzip -9 > $localFilepath\"";
$command = "bash -c \"set -o pipefail; MYSQL_PWD=$dbPassword mysqldump --host=$dbHost --user=$dbUser $dbName | gzip -9 > $localFilepath\"";
}

$process = $this->localMachineHelper->executeFromCmd($command, $outputCallback, null, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL));
Expand Down Expand Up @@ -1918,17 +1918,17 @@ protected function waitForNotificationToComplete(Client $acquiaCloudClient, stri
private function writeCompletedMessage(NotificationResponse $notification): void
{
if ($notification->status === 'completed') {
$this->io->success("The task with notification uuid {$notification->uuid} completed");
$this->io->success("The task with notification uuid $notification->uuid completed");
} elseif ($notification->status === 'failed') {
$this->io->error("The task with notification uuid {$notification->uuid} failed");
$this->io->error("The task with notification uuid $notification->uuid failed");
} else {
throw new AcquiaCliException("Unknown task status: {$notification->status}");
throw new AcquiaCliException("Unknown task status: $notification->status");
}
$duration = strtotime($notification->completed_at) - strtotime($notification->created_at);
$completedAt = date("D M j G:i:s T Y", strtotime($notification->completed_at));
$this->io->writeln("Progress: {$notification->progress}");
$this->io->writeln("Progress: $notification->progress");
$this->io->writeln("Completed: $completedAt");
$this->io->writeln("Task type: {$notification->label}");
$this->io->writeln("Task type: $notification->label");
$this->io->writeln("Duration: $duration seconds");
}

Expand Down Expand Up @@ -1959,7 +1959,7 @@ private static function getNotificationUuidFromUrl(string $notificationUrl): str

protected function validateRequiredCloudPermissions(Client $acquiaCloudClient, ?string $cloudApplicationUuid, AccountResponse $account, array $requiredPermissions): void
{
$permissions = $acquiaCloudClient->request('get', "/applications/{$cloudApplicationUuid}/permissions");
$permissions = $acquiaCloudClient->request('get', "/applications/$cloudApplicationUuid/permissions");
$keyedPermissions = [];
foreach ($permissions as $permission) {
$keyedPermissions[$permission->name] = $permission;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Env/EnvDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$environmentsResource->delete($environment->uuid);

$this->io->success([
"The {$environment->label} environment is being deleted",
"The $environment->label environment is being deleted",
]);

return Command::SUCCESS;
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Env/EnvMirrorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$destinationEnvironment = $environmentsResource->get($destinationEnvironmentUuid);
$this->checklist->completePreviousItem();

$answer = $this->io->confirm("Are you sure that you want to overwrite everything on {$destinationEnvironment->label} ({$destinationEnvironment->name}) and replace it with source data from {$sourceEnvironment->label} ({$sourceEnvironment->name})");
$answer = $this->io->confirm("Are you sure that you want to overwrite everything on $destinationEnvironment->label ($destinationEnvironment->name) and replace it with source data from $sourceEnvironment->label ($sourceEnvironment->name)");
if (!$answer) {
return 1;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$this->io->success([
"Done! {$destinationEnvironment->label} now matches {$sourceEnvironment->label}",
"Done! $destinationEnvironment->label now matches $sourceEnvironment->label",
"You can visit it here:",
"https://" . $destinationEnvironment->domains[0],
]);
Expand All @@ -117,7 +117,7 @@ private function mirrorDatabase(Client $acquiaCloudClient, mixed $sourceEnvironm
$databasesResource = new Databases($acquiaCloudClient);
$databases = $acquiaCloudClient->request('get', "/environments/$sourceEnvironmentUuid/databases");
$defaultDatabase = $this->getDefaultDatabase($databases);
$outputCallback('out', "Copying {$defaultDatabase->name}");
$outputCallback('out', "Copying $defaultDatabase->name");

// @todo Create database if its missing.
$dbCopyResponse = $databasesResource->copy($sourceEnvironmentUuid, $defaultDatabase->name, $destinationEnvironmentUuid);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Ide/IdeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$table->setHeaders(['IDEs']);
foreach ($applicationIdes as $ide) {
$table->addRows([
["<comment>{$ide->label} ({$ide->owner->mail})</comment>"],
["<comment>$ide->label ({$ide->owner->mail})</comment>"],
["IDE URL: <href={$ide->links->ide->href}>{$ide->links->ide->href}</>"],
["Web URL: <href={$ide->links->web->href}>{$ide->links->web->href}</>"],
new TableSeparator(),
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Ide/Wizard/IdeWizardDeleteSshKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->deleteSshKeyFromCloud($output, $cloudKey);
$this->deleteLocalSshKey();

$this->output->writeln("<info>Deleted local files <options=bold>{$this->publicSshKeyFilepath}</> and <options=bold>{$this->privateSshKeyFilepath}</>");
$this->output->writeln("<info>Deleted local files <options=bold>$this->publicSshKeyFilepath</> and <options=bold>$this->privateSshKeyFilepath</>");

return Command::SUCCESS;
}
Expand Down
Loading

0 comments on commit f473d1a

Please sign in to comment.