From e506768ecb3cf293409d17e46726ccf0ff859eb2 Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Sun, 28 Jun 2020 20:37:30 +0300 Subject: [PATCH] Deprecated method w, wr, wri was removed from ShortsTrait, tests fixed --- src/ShortsTrait.php | 87 +++++++++------------------------- tests/Laravel/ServiceProviderTests.php | 4 -- 2 files changed, 22 insertions(+), 69 deletions(-) diff --git a/src/ShortsTrait.php b/src/ShortsTrait.php index 92c2a3a..2287a41 100644 --- a/src/ShortsTrait.php +++ b/src/ShortsTrait.php @@ -14,30 +14,17 @@ namespace RouterOS; trait ShortsTrait { /** - * Alias for ->write() method - * - * @param string|array|\RouterOS\Query $query - * @return \RouterOS\Client - * @throws \RouterOS\Exceptions\QueryException - * @deprecated - */ - public function w($query): Client - { - return $this->write($query); - } - - /** * Alias for ->query() method * - * @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 array|string|\RouterOS\Interfaces\QueryInterface $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 q(string $endpoint, array $where = null, string $operations = null, string $tag = null): Client + public function q($endpoint, array $where = null, string $operations = null, string $tag = null): Client { return $this->query($endpoint, $where, $operations, $tag); } @@ -45,7 +32,8 @@ trait ShortsTrait /** * Alias for ->read() method * - * @param bool $parse + * @param bool $parse If need parse output to array + * * @return mixed * @since 0.7 */ @@ -66,65 +54,34 @@ trait ShortsTrait } /** - * Alias for ->write()->read() combination of methods + * Alias for ->query()->read() combination of methods * - * @param string|array|\RouterOS\Query $query - * @param bool $parse - * @return array - * @throws \RouterOS\Exceptions\ClientException - * @throws \RouterOS\Exceptions\QueryException - * @since 0.6 - * @deprecated - */ - public function wr($query, bool $parse = true): array - { - return $this->write($query)->read($parse); - } - - /** - * Alias for ->write()->read() combination of methods + * @param array|string|\RouterOS\Interfaces\QueryInterface $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 + * @param bool $parse If need parse output to array * - * @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 bool $parse - * @return \RouterOS\Client - * @throws \RouterOS\Exceptions\QueryException + * @return array * @since 1.0.0 */ - public function qr(string $endpoint, array $where = null, string $operations = null, string $tag = null, bool $parse = true): array + public function qr($endpoint, array $where = null, string $operations = null, string $tag = null, bool $parse = true): array { return $this->query($endpoint, $where, $operations, $tag)->read($parse); } /** - * Alias for ->write()->readAsIterator() combination of methods + * Alias for ->query()->readAsIterator() combination of methods * - * @param string|array|\RouterOS\Query $query - * @return \RouterOS\ResponseIterator - * @throws \RouterOS\Exceptions\ClientException - * @throws \RouterOS\Exceptions\QueryException - * @since 1.0.0 - * @deprecated - */ - public function wri($query): ResponseIterator - { - return $this->write($query)->readAsIterator(); - } - - /** - * Alias for ->write()->read() combination of methods + * @param array|string|\RouterOS\Interfaces\QueryInterface $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 * - * @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 * @return \RouterOS\ResponseIterator - * @throws \RouterOS\Exceptions\QueryException * @since 1.0.0 */ - public function qri(string $endpoint, array $where = null, string $operations = null, string $tag = null): ResponseIterator + public function qri($endpoint, array $where = null, string $operations = null, string $tag = null): ResponseIterator { return $this->query($endpoint, $where, $operations, $tag)->readAsIterator(); } diff --git a/tests/Laravel/ServiceProviderTests.php b/tests/Laravel/ServiceProviderTests.php index 9548b19..468fc2f 100644 --- a/tests/Laravel/ServiceProviderTests.php +++ b/tests/Laravel/ServiceProviderTests.php @@ -9,7 +9,6 @@ class ServiceProviderTests extends TestCase { private $client = [ "__construct", - "write", "query", "read", "readAsIterator", @@ -17,13 +16,10 @@ class ServiceProviderTests extends TestCase "connect", "export", "getSocket", - "w", "q", "r", "ri", - "wr", "qr", - "wri", "qri", ];