Skip to content

Commit

Permalink
Merge pull request #15 from dowilcox/5.1
Browse files Browse the repository at this point in the history
Finish implementing ConnectionInterface on MultiConnection.
  • Loading branch information
adamgoose committed Oct 16, 2015
2 parents 0384fe9 + 3959e75 commit 3bf81d9
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions src/MultiConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,35 @@ public function run($commands, Closure $callback = null)
}
}

/**
* Download the contents of a remote file.
*
* @param string $remote
* @param string $local
*
* @return void
*/
public function get($remote, $local)
{
foreach ($this->connections as $connection) {
$connection->get($remote, $local);
}
}

/**
* Get the contents of a remote file.
*
* @param string $remote
*
* @return string
*/
public function getString($remote)
{
foreach ($this->connections as $connection) {
$connection->getString($remote);
}
}

/**
* Upload a local file to the server.
*
Expand Down Expand Up @@ -97,4 +126,47 @@ public function putString($remote, $contents)
$connection->putString($remote, $contents);
}
}

/**
* Check whether a given file exists on the server.
*
* @param string $remote
*
* @return bool
*/
public function exists($remote)
{
foreach ($this->connections as $connection) {
$connection->exists($remote);
}
}

/**
* Rename a remote file.
*
* @param string $remote
* @param string $newRemote
*
* @return bool
*/
public function rename($remote, $newRemote)
{
foreach ($this->connections as $connection) {
$connection->rename($remote, $newRemote);
}
}

/**
* Delete a remote file from the server.
*
* @param string $remote
*
* @return bool
*/
public function delete($remote)
{
foreach ($this->connections as $connection) {
$connection->delete($remote);
}
}
}

0 comments on commit 3bf81d9

Please sign in to comment.