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. 14
      src/Client.php
  2. 11
      src/Interfaces/ClientInterface.php

14
src/Client.php

@ -102,19 +102,21 @@ class Client implements Interfaces\ClientInterface
/** /**
* Send write query to RouterOS (modern version of write) * 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 * @return \RouterOS\Client
* @throws \RouterOS\Exceptions\QueryException * @throws \RouterOS\Exceptions\QueryException
* @throws \RouterOS\Exceptions\ClientException * @throws \RouterOS\Exceptions\ClientException
* @since 1.0.0 * @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 // If endpoint is string then build Query object
$query = new Query($endpoint);
$query = ($endpoint instanceof Query)
? $endpoint
: new Query($endpoint);
// Parse where array // Parse where array
if (!empty($where)) { if (!empty($where)) {

11
src/Interfaces/ClientInterface.php

@ -3,6 +3,7 @@
namespace RouterOS\Interfaces; namespace RouterOS\Interfaces;
use RouterOS\Client; use RouterOS\Client;
use RouterOS\Query;
/** /**
* Interface ClientInterface * Interface ClientInterface
@ -73,13 +74,13 @@ interface ClientInterface
/** /**
* Send write query to RouterOS (modern version of write) * 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 * @return \RouterOS\Client
* @throws \RouterOS\Exceptions\QueryException * @throws \RouterOS\Exceptions\QueryException
* @since 1.0.0 * @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