From 6ef7d7217821c42949b126f53337c6d2595c35fb Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Sat, 20 Jul 2019 15:19:10 +0300 Subject: [PATCH] short methods was moved to separated trait --- src/ShortsTrait.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/ShortsTrait.php diff --git a/src/ShortsTrait.php b/src/ShortsTrait.php new file mode 100644 index 0000000..ac1ddc0 --- /dev/null +++ b/src/ShortsTrait.php @@ -0,0 +1,55 @@ +write() method + * + * @param string|array|\RouterOS\Query $query + * @return \RouterOS\Interfaces\ClientInterface + * @throws \RouterOS\Exceptions\QueryException + */ + public function w($query): ClientInterface + { + return $this->write($query); + } + + /** + * Alias for ->read() method + * + * @param bool $parse + * @return mixed + * @since 0.7 + */ + public function r(bool $parse = true) + { + return $this->read($parse); + } + + /** + * Alias for ->write()->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 + */ + public function wr($query, bool $parse = true): array + { + return $this->write($query)->read($parse); + } +}