From ea70cb4bd37f9291bcd1a8f4e74c4b2b3382211c Mon Sep 17 00:00:00 2001 From: Donald Wilcox Date: Fri, 9 Oct 2015 13:08:48 -0400 Subject: [PATCH 1/3] Finish impletmenting ConnectionInterface --- src/MultiConnection.php | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/MultiConnection.php b/src/MultiConnection.php index 408ccbf..b9affd9 100755 --- a/src/MultiConnection.php +++ b/src/MultiConnection.php @@ -97,4 +97,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); + } + } } From 773d0b1f9e72a788521c0de9bb0200e6788b75d3 Mon Sep 17 00:00:00 2001 From: Donald Wilcox Date: Fri, 9 Oct 2015 13:10:03 -0400 Subject: [PATCH 2/3] Implement get() and getString() --- src/MultiConnection.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/MultiConnection.php b/src/MultiConnection.php index b9affd9..96d555c 100755 --- a/src/MultiConnection.php +++ b/src/MultiConnection.php @@ -68,6 +68,36 @@ 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. * From 3959e75e089477a7926be48919dcd26cdc97de9d Mon Sep 17 00:00:00 2001 From: Donald Wilcox Date: Fri, 9 Oct 2015 13:18:09 -0400 Subject: [PATCH 3/3] Fixed styling. --- src/MultiConnection.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/MultiConnection.php b/src/MultiConnection.php index 96d555c..e04b291 100755 --- a/src/MultiConnection.php +++ b/src/MultiConnection.php @@ -97,7 +97,6 @@ public function getString($remote) } } - /** * Upload a local file to the server. *