From df3ad9ed128b8c86ba715d895a960843290f1490 Mon Sep 17 00:00:00 2001 From: Michael Rosenberger Date: Mon, 3 Dec 2018 22:34:56 +0100 Subject: [PATCH] Improves annotations for API --- lib/classes/api/abstract.ApiCommand.php | 5 +++-- lib/classes/api/abstract.ApiParameter.php | 4 ++++ lib/classes/api/class.FroxlorRPC.php | 4 ++-- lib/classes/api/commands/class.Certificates.php | 2 ++ lib/classes/api/commands/class.CustomerBackups.php | 1 + lib/classes/api/commands/class.Customers.php | 2 ++ lib/classes/api/commands/class.IpsAndPorts.php | 3 ++- lib/classes/api/commands/class.SubDomains.php | 1 + 8 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/classes/api/abstract.ApiCommand.php b/lib/classes/api/abstract.ApiCommand.php index 577f2e77..139f2d6c 100644 --- a/lib/classes/api/abstract.ApiCommand.php +++ b/lib/classes/api/abstract.ApiCommand.php @@ -181,6 +181,7 @@ abstract class ApiCommand extends ApiParameter /** * initialize mail interface so an API wide mail-object is available + * @throws phpmailerException */ private function initMail() { @@ -224,6 +225,7 @@ abstract class ApiCommand extends ApiParameter * array of parameters for the command * * @return ApiCommand + * @throws Exception */ public static function getLocal($userinfo = null, $params = null) { @@ -285,8 +287,7 @@ abstract class ApiCommand extends ApiParameter /** * call an api-command internally * - * @param string $module - * @param string $function + * @param string $command * @param array|null $params * * @return array diff --git a/lib/classes/api/abstract.ApiParameter.php b/lib/classes/api/abstract.ApiParameter.php index bb81df0e..8b1e546e 100644 --- a/lib/classes/api/abstract.ApiParameter.php +++ b/lib/classes/api/abstract.ApiParameter.php @@ -117,6 +117,7 @@ abstract class ApiParameter * value which is returned if optional=true and param is not set * * @return mixed + * @throws Exception */ protected function getUlParam($param = null, $ul_field = null, $optional = false, $default = 0) { @@ -145,6 +146,9 @@ abstract class ApiParameter * @param int $level * depth of backtrace, default 2 * + * @param int $max_level + * @param array|null $trace + * * @return string */ private function getModFunctionString($level = 1, $max_level = 5, $trace = null) diff --git a/lib/classes/api/class.FroxlorRPC.php b/lib/classes/api/class.FroxlorRPC.php index f238fab9..3c9155ce 100644 --- a/lib/classes/api/class.FroxlorRPC.php +++ b/lib/classes/api/class.FroxlorRPC.php @@ -79,10 +79,10 @@ class FroxlorRPC /** * validates the given command * - * @param array $body + * @param array $request * + * @return array * @throws Exception - * @return boolean */ private static function validateBody($request) { diff --git a/lib/classes/api/commands/class.Certificates.php b/lib/classes/api/commands/class.Certificates.php index 6d40ee6b..d763f35f 100644 --- a/lib/classes/api/commands/class.Certificates.php +++ b/lib/classes/api/commands/class.Certificates.php @@ -208,6 +208,7 @@ class Certificates extends ApiCommand implements ResourceEntity * @param int $id * * @return array + * @throws Exception */ public function delete() { @@ -261,6 +262,7 @@ class Certificates extends ApiCommand implements ResourceEntity * optional default false * * @return boolean + * @throws Exception */ private function addOrUpdateCertificate($domainid = 0, $ssl_cert_file = '', $ssl_key_file = '', $ssl_ca_file = '', $ssl_cert_chainfile = '', $do_insert = false) { diff --git a/lib/classes/api/commands/class.CustomerBackups.php b/lib/classes/api/commands/class.CustomerBackups.php index 71fcd51d..97123045 100644 --- a/lib/classes/api/commands/class.CustomerBackups.php +++ b/lib/classes/api/commands/class.CustomerBackups.php @@ -52,6 +52,7 @@ class CustomerBackups extends ApiCommand implements ResourceEntity * * @access admin, customer * @return array + * @throws Exception */ public function add() { diff --git a/lib/classes/api/commands/class.Customers.php b/lib/classes/api/commands/class.Customers.php index 5b4bf97e..cfa49985 100644 --- a/lib/classes/api/commands/class.Customers.php +++ b/lib/classes/api/commands/class.Customers.php @@ -1743,6 +1743,7 @@ class Customers extends ApiCommand implements ResourceEntity * @param string $resource * @param string $extra * optional, default empty + * @param int $increase_by */ public static function increaseUsage($customerid = 0, $resource = null, $extra = '', $increase_by = 1) { @@ -1756,6 +1757,7 @@ class Customers extends ApiCommand implements ResourceEntity * @param string $resource * @param string $extra * optional, default empty + * @param int $decrease_by */ public static function decreaseUsage($customerid = 0, $resource = null, $extra = '', $decrease_by = 1) { diff --git a/lib/classes/api/commands/class.IpsAndPorts.php b/lib/classes/api/commands/class.IpsAndPorts.php index b7450b41..5509dc0d 100644 --- a/lib/classes/api/commands/class.IpsAndPorts.php +++ b/lib/classes/api/commands/class.IpsAndPorts.php @@ -284,8 +284,9 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity * @param string $ssl_cert_chainfile * optional, requires $ssl = 1, default empty * + * * @access admin - * @throws ErrorException + * @throws Exception * @return array */ public function update() diff --git a/lib/classes/api/commands/class.SubDomains.php b/lib/classes/api/commands/class.SubDomains.php index 4ca9a152..33d529d0 100644 --- a/lib/classes/api/commands/class.SubDomains.php +++ b/lib/classes/api/commands/class.SubDomains.php @@ -846,6 +846,7 @@ class SubDomains extends ApiCommand implements ResourceEntity * @param boolean $_doredirect * * @return string validated path + * @throws Exception */ private function validateDomainDocumentRoot($path = null, $url = null, $customer = null, $completedomain = null, &$_doredirect = false) {