Skip to content

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
tshafer authored and StyleCIBot committed Dec 5, 2015
1 parent c235d40 commit 116c9c2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 108 deletions.
2 changes: 1 addition & 1 deletion config/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/

'groups' => [
'web' => [ 'production' ],
'web' => ['production'],
],

];
39 changes: 10 additions & 29 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class Connection implements ConnectionInterface
{

/**
* The SSH gateway implementation.
*
Expand Down Expand Up @@ -43,7 +42,7 @@ class Connection implements ConnectionInterface
*
* @var array
*/
protected $tasks = [ ];
protected $tasks = [];

/**
* The output implementation for the connection.
Expand All @@ -52,7 +51,6 @@ class Connection implements ConnectionInterface
*/
protected $output;


/**
* Create a new SSH connection instance.
*
Expand All @@ -65,13 +63,12 @@ class Connection implements ConnectionInterface
*/
public function __construct($name, $host, $username, array $auth, GatewayInterface $gateway = null, $timeout = 10)
{
$this->name = $name;
$this->host = $host;
$this->name = $name;
$this->host = $host;
$this->username = $username;
$this->gateway = $gateway ?: new SecLibGateway($host, $auth, new Filesystem(), timeout);
$this->gateway = $gateway ?: new SecLibGateway($host, $auth, new Filesystem(), timeout);
}


/**
* Define a set of commands as a task.
*
Expand All @@ -85,7 +82,6 @@ public function define($task, $commands)
$this->tasks[$task] = $commands;
}


/**
* Run a task against the connection.
*
Expand All @@ -96,12 +92,11 @@ public function define($task, $commands)
*/
public function task($task, Closure $callback = null)
{
if (isset( $this->tasks[$task] )) {
if (isset($this->tasks[$task])) {
$this->run($this->tasks[$task], $callback);
}
}


/**
* Run a set of commands against the connection.
*
Expand Down Expand Up @@ -133,7 +128,6 @@ public function run($commands, Closure $callback = null)
}
}


/**
* Get the gateway implementation.
*
Expand All @@ -143,14 +137,13 @@ public function run($commands, Closure $callback = null)
*/
public function getGateway()
{
if ( ! $this->gateway->connected() && ! $this->gateway->connect($this->username)) {
if (!$this->gateway->connected() && !$this->gateway->connect($this->username)) {
throw new \RuntimeException('Unable to connect to remote server.');
}

return $this->gateway;
}


/**
* Get the display callback for the connection.
*
Expand All @@ -160,7 +153,7 @@ public function getGateway()
*/
protected function getCallback($callback)
{
if ( ! is_null($callback)) {
if (!is_null($callback)) {
return $callback;
}

Expand All @@ -169,7 +162,6 @@ protected function getCallback($callback)
};
}


/**
* Display the given line using the default output.
*
Expand All @@ -179,14 +171,13 @@ protected function getCallback($callback)
*/
public function display($line)
{
$server = $this->username . '@' . $this->host;
$server = $this->username.'@'.$this->host;

$lead = '<comment>[' . $server . ']</comment> <info>(' . $this->name . ')</info>';
$lead = '<comment>['.$server.']</comment> <info>('.$this->name.')</info>';

$this->getOutput()->writeln($lead . ' ' . $line);
$this->getOutput()->writeln($lead.' '.$line);
}


/**
* Get the output implementation for the connection.
*
Expand All @@ -201,7 +192,6 @@ public function getOutput()
return $this->output;
}


/**
* Set the output implementation.
*
Expand All @@ -214,7 +204,6 @@ public function setOutput(OutputInterface $output)
$this->output = $output;
}


/**
* Format the given command set.
*
Expand All @@ -227,7 +216,6 @@ protected function formatCommands($commands)
return is_array($commands) ? implode(' && ', $commands) : $commands;
}


/**
* Download the contents of a remote file.
*
Expand All @@ -241,7 +229,6 @@ public function get($remote, $local)
$this->getGateway()->get($remote, $local);
}


/**
* Get the contents of a remote file.
*
Expand All @@ -254,7 +241,6 @@ public function getString($remote)
return $this->getGateway()->getString($remote);
}


/**
* Upload a local file to the server.
*
Expand All @@ -268,7 +254,6 @@ public function put($local, $remote)
$this->getGateway()->put($local, $remote);
}


/**
* Upload a string to to the given file on the server.
*
Expand All @@ -282,7 +267,6 @@ public function putString($remote, $contents)
$this->getGateway()->putString($remote, $contents);
}


/**
* Check whether a given file exists on the server.
*
Expand All @@ -295,7 +279,6 @@ public function exists($remote)
return $this->getGateway()->exists($remote);
}


/**
* Rename a remote file.
*
Expand All @@ -309,7 +292,6 @@ public function rename($remote, $newRemote)
return $this->getGateway()->rename($remote, $newRemote);
}


/**
* Delete a remote file from the server.
*
Expand All @@ -322,7 +304,6 @@ public function delete($remote)
return $this->getGateway()->delete($remote);
}


/**
* Get the exit status of the last command.
*
Expand Down
10 changes: 0 additions & 10 deletions src/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

interface ConnectionInterface
{

/**
* Define a set of commands as a task.
*
Expand All @@ -17,7 +16,6 @@ interface ConnectionInterface
*/
public function define($task, $commands);


/**
* Run a task against the connection.
*
Expand All @@ -28,7 +26,6 @@ public function define($task, $commands);
*/
public function task($task, Closure $callback = null);


/**
* Run a set of commands against the connection.
*
Expand All @@ -39,7 +36,6 @@ public function task($task, Closure $callback = null);
*/
public function run($commands, Closure $callback = null);


/**
* Download the contents of a remote file.
*
Expand All @@ -50,7 +46,6 @@ public function run($commands, Closure $callback = null);
*/
public function get($remote, $local);


/**
* Get the contents of a remote file.
*
Expand All @@ -60,7 +55,6 @@ public function get($remote, $local);
*/
public function getString($remote);


/**
* Upload a local file to the server.
*
Expand All @@ -71,7 +65,6 @@ public function getString($remote);
*/
public function put($local, $remote);


/**
* Upload a string to the given file on the server.
*
Expand All @@ -82,7 +75,6 @@ public function put($local, $remote);
*/
public function putString($remote, $contents);


/**
* Check whether a given file exists on the server.
*
Expand All @@ -92,7 +84,6 @@ public function putString($remote, $contents);
*/
public function exists($remote);


/**
* Rename a remote file.
*
Expand All @@ -103,7 +94,6 @@ public function exists($remote);
*/
public function rename($remote, $newRemote);


/**
* Delete a remote file from the server.
*
Expand Down
1 change: 1 addition & 0 deletions src/GatewayInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function run($command);
* @return void
*/
public function get($remote, $local);

/**
* Get the contents of a remote file.
*
Expand Down
Loading

0 comments on commit 116c9c2

Please sign in to comment.