]> _ Git - cubist_net.git/commitdiff
wip #7085 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 Sep 2024 09:04:42 +0000 (11:04 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 Sep 2024 09:04:42 +0000 (11:04 +0200)
src/Server/SFTP.php [new file with mode: 0644]
src/Transfer/SFTP.php

diff --git a/src/Server/SFTP.php b/src/Server/SFTP.php
new file mode 100644 (file)
index 0000000..b653056
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+
+namespace Cubist\Net\Server;
+
+use Cubist\Net\Transfer\IServer;
+
+class SFTP implements IServer
+{
+
+    protected $host;
+    protected $username;
+    protected $password;
+    protected $port;
+    protected $path;
+
+    public function __construct($host, $username, $password, $path, $port = 22)
+    {
+        $this->host = $host;
+        $this->username = $username;
+        $this->password = $password;
+        $this->port = $port;
+        $this->path = $path;
+    }
+
+    public function getProtocol()
+    {
+        return "SFTP";
+    }
+
+    public function getHost()
+    {
+        return $this->host;
+    }
+
+    public function getPort()
+    {
+        return $this->port;
+    }
+
+    public function getUsername()
+    {
+        return $this->username;
+    }
+
+    public function getPassword()
+    {
+        return $this->password;
+    }
+
+    public function getBasePath()
+    {
+        return $this->path;
+    }
+
+    public function getBaseURL()
+    {
+        // TODO: Implement getBaseURL() method.
+    }
+
+    public function getSettings()
+    {
+        // TODO: Implement getSettings() method.
+    }
+
+    public function makeURL($path)
+    {
+        // TODO: Implement makeURL() method.
+    }
+}
\ No newline at end of file
index 668e99d787c1d65656bd8ca8cb99a66aeda2018e..a3bce4c3eae42bf1c32efb75825874a9909589ab 100644 (file)
@@ -19,6 +19,11 @@ class SFTP extends Driver
 
     const DEFAULT_PORT = 22;
 
+    public static function getInstance($host, $username, $password, $path, $port = self::DEFAULT_PORT)
+    {
+        return new SFTP(new \Cubist\Net\Server\SFTP($host, $username, $password, $path, $port));
+    }
+
     protected function synchronizeFiles($source, $dest, $mirror = false, $dryrun = false)
     {
         $rclone = new Rclone();