From f88a4d1a1ddfff3562c15a8f117d38f0138674fa Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Sun, 28 Jun 2020 20:31:15 +0300 Subject: [PATCH] PHPDoc fo Config class was updated, small tunes added to ConfigInterface --- src/Config.php | 60 ++++++++++++-------------------------- src/Interfaces/ConfigInterface.php | 10 +++---- 2 files changed, 23 insertions(+), 47 deletions(-) diff --git a/src/Config.php b/src/Config.php index 5e83b7e..1602a0d 100644 --- a/src/Config.php +++ b/src/Config.php @@ -60,26 +60,16 @@ class Config implements ConfigInterface * List of allowed parameters of config */ public const ALLOWED = [ - // Address of Mikrotik RouterOS - 'host' => 'string', - // Username - 'user' => 'string', - // Password - 'pass' => 'string', - // RouterOS API port number for access (if not set use default or default with SSL if SSL enabled) - 'port' => 'integer', - // Enable ssl support (if port is not set this parameter must change default port to ssl port) - 'ssl' => 'boolean', - // Support of legacy login scheme (true - pre 6.43, false - post 6.43) - 'legacy' => 'boolean', - // Max timeout for answer from RouterOS - 'timeout' => 'integer', - // Count of attempts to establish TCP session - 'attempts' => 'integer', - // Delay between attempts in seconds - 'delay' => 'integer', - // Number of SSH port - 'ssh_port' => 'integer', + 'host' => 'string', // Address of Mikrotik RouterOS + 'user' => 'string', // Username + 'pass' => 'string', // Password + 'port' => 'integer', // RouterOS API port number for access (if not set use default or default with SSL if SSL enabled) + 'ssl' => 'boolean', // Enable ssl support (if port is not set this parameter must change default port to ssl port) + 'legacy' => 'boolean', // Support of legacy login scheme (true - pre 6.43, false - post 6.43) + 'timeout' => 'integer', // Max timeout for answer from RouterOS + 'attempts' => 'integer', // Count of attempts to establish TCP session + 'delay' => 'integer', // Delay between attempts in seconds + 'ssh_port' => 'integer', // Number of SSH port ]; /** @@ -112,15 +102,11 @@ class Config implements ConfigInterface } /** - * Set parameter into array + * @inheritDoc * - * @param string $name - * @param mixed $value - * - * @return \RouterOS\Config - * @throws \RouterOS\Exceptions\ConfigException + * @throws \RouterOS\Exceptions\ConfigException when name of configuration key is invalid or not allowed */ - public function set(string $name, $value): Config + public function set(string $name, $value): ConfigInterface { // Check of key in array if (ArrayHelper::checkIfKeyNotExist($name, self::ALLOWED)) { @@ -158,14 +144,11 @@ class Config implements ConfigInterface } /** - * Remove parameter from array by name + * @inheritDoc * - * @param string $name - * - * @return \RouterOS\Config - * @throws \RouterOS\Exceptions\ConfigException + * @throws \RouterOS\Exceptions\ConfigException when parameter is not allowed */ - public function delete(string $name): Config + public function delete(string $name): ConfigInterface { // Check of key in array if (ArrayHelper::checkIfKeyNotExist($name, self::ALLOWED)) { @@ -179,12 +162,9 @@ class Config implements ConfigInterface } /** - * Return parameter of current config by name + * @inheritDoc * - * @param string $name - * - * @return mixed - * @throws \RouterOS\Exceptions\ConfigException + * @throws \RouterOS\Exceptions\ConfigException when parameter is not allowed */ public function get(string $name) { @@ -197,9 +177,7 @@ class Config implements ConfigInterface } /** - * Return array with all parameters of configuration - * - * @return array + * @inheritDoc */ public function getParameters(): array { diff --git a/src/Interfaces/ConfigInterface.php b/src/Interfaces/ConfigInterface.php index 963d4bc..0ce8a29 100644 --- a/src/Interfaces/ConfigInterface.php +++ b/src/Interfaces/ConfigInterface.php @@ -2,8 +2,6 @@ namespace RouterOS\Interfaces; -use RouterOS\Config; - /** * Interface ConfigInterface * @@ -18,18 +16,18 @@ interface ConfigInterface * @param string $name * @param mixed $value * - * @return \RouterOS\Config + * @return \RouterOS\Interfaces\ConfigInterface */ - public function set(string $name, $value): Config; + public function set(string $name, $value): ConfigInterface; /** * Remove parameter from array by name * * @param string $parameter * - * @return \RouterOS\Config + * @return \RouterOS\Interfaces\ConfigInterface */ - public function delete(string $parameter): Config; + public function delete(string $parameter): ConfigInterface; /** * Return parameter of current config by name