From ca205d9df3e1a17487c81de80d73573281b3b9b3 Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Tue, 20 Aug 2019 16:31:25 +0300 Subject: [PATCH] query type fix (it was only string of enpoint) in Client class and ClientInterface --- src/Client.php | 14 ++++++++------ src/Interfaces/ClientInterface.php | 11 ++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Client.php b/src/Client.php index 2e89b9c..f5a8f88 100644 --- a/src/Client.php +++ b/src/Client.php @@ -102,19 +102,21 @@ class Client implements Interfaces\ClientInterface /** * Send write query to RouterOS (modern version of write) * - * @param string $endpoint Path of API query - * @param array|null $where List of where filters - * @param string|null $operations Some operations which need make on response - * @param string|null $tag Mark query with tag + * @param string|Query $endpoint Path of API query or Query object + * @param array|null $where List of where filters + * @param string|null $operations Some operations which need make on response + * @param string|null $tag Mark query with tag * @return \RouterOS\Client * @throws \RouterOS\Exceptions\QueryException * @throws \RouterOS\Exceptions\ClientException * @since 1.0.0 */ - public function query(string $endpoint, array $where = null, string $operations = null, string $tag = null): Client + public function query($endpoint, array $where = null, string $operations = null, string $tag = null): Client { // If endpoint is string then build Query object - $query = new Query($endpoint); + $query = ($endpoint instanceof Query) + ? $endpoint + : new Query($endpoint); // Parse where array if (!empty($where)) { diff --git a/src/Interfaces/ClientInterface.php b/src/Interfaces/ClientInterface.php index 169b766..0f4d516 100644 --- a/src/Interfaces/ClientInterface.php +++ b/src/Interfaces/ClientInterface.php @@ -3,6 +3,7 @@ namespace RouterOS\Interfaces; use RouterOS\Client; +use RouterOS\Query; /** * Interface ClientInterface @@ -73,13 +74,13 @@ interface ClientInterface /** * Send write query to RouterOS (modern version of write) * - * @param string $endpoint Path of API query - * @param array|null $where List of where filters - * @param string|null $operations Some operations which need make on response - * @param string|null $tag Mark query with tag + * @param string|Query $endpoint Path of API query or Query object + * @param array|null $where List of where filters + * @param string|null $operations Some operations which need make on response + * @param string|null $tag Mark query with tag * @return \RouterOS\Client * @throws \RouterOS\Exceptions\QueryException * @since 1.0.0 */ - public function query(string $endpoint, array $where, string $operations, string $tag): Client; + public function query($endpoint, array $where, string $operations, string $tag): Client; }