From e3d1a993a1421deb2d14b72fe3cede360990d5b6 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Mon, 12 Jan 2015 21:48:19 +0100 Subject: [PATCH] [enh] adding isFtp() function to FTP API class --- lib/Alternc/Api/Object/Ftp.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Alternc/Api/Object/Ftp.php b/lib/Alternc/Api/Object/Ftp.php index ef0a6ff4..e224e178 100644 --- a/lib/Alternc/Api/Object/Ftp.php +++ b/lib/Alternc/Api/Object/Ftp.php @@ -104,6 +104,23 @@ class Alternc_Api_Object_Ftp extends Alternc_Api_Legacyobject { } } + /** API Method from legacy class method ftp->is_ftp() + * @param $options a hash with parameters transmitted to legacy call + * mandatory parameters: DIR + * @return Alternc_Api_Response Integer the ID of the account in this folder, or FALSE + */ + function isFtp($options) { + if (!isset($options["dir"])) { + return new Alternc_Api_Response(array("code" => self::ERR_INVALID_ARGUMENT, "message" => "Missing or invalid argument: DIR")); + } + $result = $this->ftp->is_ftp($options["dir"]); + if (!$result) { + return $this->alterncLegacyErrorManager(); + } else { + return new Alternc_Api_Response(array("content" => $result)); + } + } + } // class Alternc_Api_Object_Ftp \ No newline at end of file