Browse Source

query type fix (it was only string of enpoint) in Client class and ClientInterface

tags/1.0.1 1.0.1
Paul Rock 6 years ago
parent
commit
ca205d9df3
  1. 8
      src/Client.php
  2. 5
      src/Interfaces/ClientInterface.php

8
src/Client.php

@ -102,7 +102,7 @@ class Client implements Interfaces\ClientInterface
/**
* Send write query to RouterOS (modern version of write)
*
* @param string $endpoint Path of API query
* @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
@ -111,10 +111,12 @@ class Client implements Interfaces\ClientInterface
* @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)) {

5
src/Interfaces/ClientInterface.php

@ -3,6 +3,7 @@
namespace RouterOS\Interfaces;
use RouterOS\Client;
use RouterOS\Query;
/**
* Interface ClientInterface
@ -73,7 +74,7 @@ interface ClientInterface
/**
* Send write query to RouterOS (modern version of write)
*
* @param string $endpoint Path of API query
* @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
@ -81,5 +82,5 @@ interface ClientInterface
* @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;
}
Loading…
Cancel
Save