Skip to content

Commit

Permalink
phpcbf auto-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bomoko committed Nov 12, 2023
1 parent f08b0d5 commit 828cd16
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/LagoonCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

use Consolidation\SiteAlias\SiteAliasManagerAwareTrait;
use Drush\Commands\DrushCommands;
use Drush\Exceptions\CommandFailedException;
use Drush\Drush;
use Drush\Exceptions\CommandFailedException;
use Drush\SiteAlias\SiteAliasManagerAwareInterface;
use GuzzleHttp\Client;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Process\Process;
use Symfony\Component\Yaml\Yaml;
use \Symfony\Component\HttpKernel\Kernel;

/**
* Drush integration for Lagoon.
Expand Down Expand Up @@ -65,8 +65,8 @@ class LagoonCommands extends DrushCommands implements SiteAliasManagerAwareInter
* {@inheritdoc}
*/
public function __construct() {
// Get default config
if($this->isLagoonEnvironment()) {
// Get default config.
if ($this->isLagoonEnvironment()) {
$this->isLagoonEnvironment = TRUE;
$lagoonyml = $this->getLagoonYml();
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
Expand Down Expand Up @@ -194,22 +194,22 @@ public function getJwtToken() {
[$ssh_host, $ssh_port] = explode(":", $this->endpoint);

$args = [
"-p", $ssh_port,
"-p", $ssh_port,
"-o", "ConnectTimeout=5",
"-o", "LogLevel=FATAL",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no",
];

if ($this->sshKey) {
$args += ["-i", $this->sshKey];
$args += ["-i", $this->sshKey];
}

$cmd = ["ssh", ...$args, "lagoon@$ssh_host", "token"];

$this->logger()->debug("Retrieving token via SSH -" . implode(" ", $cmd));
if (version_compare(Kernel::VERSION, "4.2", "<")) {
// Symfony >= 4.2 only allows the array form of the command parameter
// Symfony >= 4.2 only allows the array form of the command parameter.
$ssh = new Process(implode(" ", $cmd));
}
else {
Expand All @@ -220,7 +220,8 @@ public function getJwtToken() {

try {
$ssh->mustRun();
} catch (ProcessFailedException $exception) {
}
catch (ProcessFailedException $exception) {
$this->logger->debug($ssh->getMessage());
}

Expand Down Expand Up @@ -285,7 +286,7 @@ private function isLagoonEnvironment() {
* @return void
*/
private function preCommandChecks() {
if($this->isLagoonEnvironment() == FALSE) {
if ($this->isLagoonEnvironment() == FALSE) {
throw new CommandFailedException(dt("Attempting to run a Lagoon command in a non-Lagoon environment."));
}
}
Expand Down

0 comments on commit 828cd16

Please sign in to comment.