diff --git a/src/Config.php b/src/Config.php index 78ef0cc..df9560e 100644 --- a/src/Config.php +++ b/src/Config.php @@ -31,9 +31,10 @@ class Config implements ConfigInterface /** * Config constructor. * - * @param array $parameters List of parameters which can be set on object creation stage - * @throws ConfigException - * @since 0.6 + * @param array $parameters List of parameters which can be set on object creation stage + * + * @throws \RouterOS\Exceptions\ConfigException + * @since 0.6 */ public function __construct(array $parameters = []) { @@ -45,10 +46,11 @@ class Config implements ConfigInterface /** * Set parameter into array * - * @param string $name - * @param mixed $value - * @return \RouterOS\Config - * @throws ConfigException + * @param string $name + * @param mixed $value + * + * @return \RouterOS\Config + * @throws \RouterOS\Exceptions\ConfigException */ public function set(string $name, $value): Config { @@ -71,8 +73,9 @@ class Config implements ConfigInterface /** * Return port number (get from defaults if port is not set by user) * - * @param string $parameter - * @return bool|int + * @param string $parameter + * + * @return bool|int */ private function getPort(string $parameter) { @@ -89,9 +92,10 @@ class Config implements ConfigInterface /** * Remove parameter from array by name * - * @param string $name - * @return \RouterOS\Config - * @throws \RouterOS\Exceptions\ConfigException + * @param string $name + * + * @return \RouterOS\Config + * @throws \RouterOS\Exceptions\ConfigException */ public function delete(string $name): Config { @@ -109,9 +113,10 @@ class Config implements ConfigInterface /** * Return parameter of current config by name * - * @param string $name - * @return mixed - * @throws \RouterOS\Exceptions\ConfigException + * @param string $name + * + * @return mixed + * @throws \RouterOS\Exceptions\ConfigException */ public function get(string $name) { @@ -126,7 +131,7 @@ class Config implements ConfigInterface /** * Return array with all parameters of configuration * - * @return array + * @return array */ public function getParameters(): array { diff --git a/src/Interfaces/ClientInterface.php b/src/Interfaces/ClientInterface.php index 0f4d516..fad30ed 100644 --- a/src/Interfaces/ClientInterface.php +++ b/src/Interfaces/ClientInterface.php @@ -16,37 +16,37 @@ interface ClientInterface /** * By default legacy login on RouterOS pre-6.43 is not supported */ - const LEGACY = false; + public const LEGACY = false; /** * Default port number */ - const PORT = 8728; + public const PORT = 8728; /** * Default ssl port number */ - const PORT_SSL = 8729; + public const PORT_SSL = 8729; /** * Do not use SSL by default */ - const SSL = false; + public const SSL = false; /** * Max timeout for answer from router */ - const TIMEOUT = 10; + public const TIMEOUT = 10; /** * Count of reconnect attempts */ - const ATTEMPTS = 10; + public const ATTEMPTS = 10; /** * Delay between attempts in seconds */ - const ATTEMPTS_DELAY = 1; + public const ATTEMPTS_DELAY = 1; /** * Return socket resource if is exist diff --git a/src/Interfaces/ConfigInterface.php b/src/Interfaces/ConfigInterface.php index f719502..463fc32 100644 --- a/src/Interfaces/ConfigInterface.php +++ b/src/Interfaces/ConfigInterface.php @@ -15,7 +15,7 @@ interface ConfigInterface /** * List of allowed parameters of config */ - const ALLOWED = [ + public const ALLOWED = [ // Address of Mikrotik RouterOS 'host' => 'string', // Username @@ -39,32 +39,35 @@ interface ConfigInterface /** * Set parameter into array * - * @param string $name - * @param mixed $value - * @return Config + * @param string $name + * @param mixed $value + * + * @return \RouterOS\Config */ public function set(string $name, $value): Config; /** * Remove parameter from array by name * - * @param string $parameter - * @return Config + * @param string $parameter + * + * @return \RouterOS\Config */ public function delete(string $parameter): Config; /** * Return parameter of current config by name * - * @param string $parameter - * @return mixed + * @param string $parameter + * + * @return mixed */ public function get(string $parameter); /** * Return array with all parameters of configuration * - * @return array + * @return array */ public function getParameters(): array; } diff --git a/src/Interfaces/QueryInterface.php b/src/Interfaces/QueryInterface.php index 019c875..ff864a4 100644 --- a/src/Interfaces/QueryInterface.php +++ b/src/Interfaces/QueryInterface.php @@ -18,6 +18,7 @@ interface QueryInterface * @param string $key Key which need to find * @param bool|string|int $value Value which need to check (by default true) * @param bool|string|int $operator It may be one from list [-,=,>,<] + * * @return \RouterOS\Query * @throws \RouterOS\Exceptions\ClientException * @since 1.0.0 @@ -28,6 +29,7 @@ interface QueryInterface * Append additional operations * * @param string $operations + * * @since 1.0.0 */ public function operations(string $operations); @@ -36,6 +38,7 @@ interface QueryInterface * Append tag to query (it should be at end) * * @param string $name + * * @since 1.0.0 */ public function tag(string $name); @@ -44,6 +47,7 @@ interface QueryInterface * Append to array yet another attribute of query * * @param string $word + * * @return \RouterOS\Query */ public function add(string $word): Query; @@ -59,6 +63,7 @@ interface QueryInterface * Set array of attributes * * @param array $attributes + * * @return \RouterOS\Query * @since 0.7 */ @@ -75,6 +80,7 @@ interface QueryInterface * Set endpoint of query * * @param string $endpoint + * * @return \RouterOS\Query * @since 0.7 */ diff --git a/src/Interfaces/StreamInterface.php b/src/Interfaces/StreamInterface.php index 4131992..70cb7de 100644 --- a/src/Interfaces/StreamInterface.php +++ b/src/Interfaces/StreamInterface.php @@ -18,8 +18,9 @@ interface StreamInterface * Reads $length bytes from the stream, returns the bytes into a string * Must be binary safe (as fread). * - * @param int $length the numer of bytes to read - * @return string a binary string containing the readed byes + * @param int $length the number of bytes to read + * + * @return string a binary string containing the readed byes */ public function read(int $length): string; @@ -31,9 +32,10 @@ interface StreamInterface * if $length is greater than string length, write all string and return number of writen bytes * if $length os smaller than string length, remaining bytes are losts. * - * @param string $string - * @param int $length the number of bytes to read - * @return int return number of written bytes + * @param string $string + * @param int $length the number of bytes to read + * + * @return int return number of written bytes */ public function write(string $string, int $length = -1): int; @@ -42,5 +44,5 @@ interface StreamInterface * * @return void */ - public function close(); + public function close(): void; } diff --git a/src/Laravel/ClientFacade.php b/src/Laravel/ClientFacade.php index 952650a..1afcd3e 100644 --- a/src/Laravel/ClientFacade.php +++ b/src/Laravel/ClientFacade.php @@ -6,8 +6,13 @@ use Illuminate\Support\Facades\Facade; class ClientFacade extends Facade { - protected static function getFacadeAccessor() + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor(): string { return ClientWrapper::class; } -} \ No newline at end of file +} diff --git a/src/Laravel/ClientServiceProvide.php b/src/Laravel/ClientServiceProvide.php index 42e47d7..c087064 100644 --- a/src/Laravel/ClientServiceProvide.php +++ b/src/Laravel/ClientServiceProvide.php @@ -11,7 +11,7 @@ class ClientServiceProvide extends BaseServiceProvider * * @return void */ - public function boot() + public function boot(): void { $this->publishes([ __DIR__ . '/../../configs/routeros-api.php' => config_path('routeros-api.php'), @@ -23,7 +23,7 @@ class ClientServiceProvide extends BaseServiceProvider * * @return void */ - public function register() + public function register(): void { $this->mergeConfigFrom( __DIR__ . '/../../configs/routeros-api.php', 'routeros-api' diff --git a/src/Laravel/ClientWrapper.php b/src/Laravel/ClientWrapper.php index ed8792f..59cba9a 100644 --- a/src/Laravel/ClientWrapper.php +++ b/src/Laravel/ClientWrapper.php @@ -21,4 +21,4 @@ class ClientWrapper return new Client($configs); } -} \ No newline at end of file +} diff --git a/src/ResponseIterator.php b/src/ResponseIterator.php index 6ff9028..1498a60 100644 --- a/src/ResponseIterator.php +++ b/src/ResponseIterator.php @@ -12,6 +12,7 @@ use \Iterator, * from RouterOS to readable array in safe way. * * @param array $raw Array RAW response from server + * * @return mixed * * Based on RouterOSResponseArray solution by @arily @@ -188,6 +189,7 @@ class ResponseIterator implements Iterator, ArrayAccess, Countable, Serializable * Whether a offset exists * * @param mixed $offset + * * @return bool */ public function offsetExists($offset): bool @@ -209,6 +211,7 @@ class ResponseIterator implements Iterator, ArrayAccess, Countable, Serializable * Offset to retrieve * * @param mixed $offset + * * @return bool|mixed */ public function offsetGet($offset)