From a656be5ecf30e2821e615dfe1a83dcd760ffe8f7 Mon Sep 17 00:00:00 2001 From: Sebastiaan Hilbers Date: Thu, 4 Apr 2019 12:41:09 +0200 Subject: [PATCH 1/2] use _filter in parsing params --- src/Matomo.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Matomo.php b/src/Matomo.php index d037122..9ce3604 100644 --- a/src/Matomo.php +++ b/src/Matomo.php @@ -41,7 +41,7 @@ class Matomo private $_rangeEnd = null; private $_isJsonDecodeAssoc = false; - private $_limit = ''; + private $_limit = -1; private $_errors = []; @@ -444,7 +444,8 @@ private function _parseUrl($method, array $params = []) 'idSite' => $this->_siteId, 'period' => $this->_period, 'format' => $this->_format, - 'language' => $this->_language + 'language' => $this->_language, + 'filter_limit' => $this->_filter ] + $params; foreach ($params as $key => $value) { From 6c7bb2562b547ee2aaea2b15fdb7c4476fd3a8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Helfensd=C3=B6rfer?= Date: Thu, 11 Apr 2019 19:43:57 +0200 Subject: [PATCH 2/2] Updated filter --- src/Matomo.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Matomo.php b/src/Matomo.php index 9ce3604..ece3ebf 100644 --- a/src/Matomo.php +++ b/src/Matomo.php @@ -37,11 +37,15 @@ class Matomo private $_period = self::PERIOD_DAY; private $_date = ''; + /** + * @var int Defines the number of rows to be returned (-1: All rows). + */ + private $_filter_limit = 100; private $_rangeStart = 'yesterday'; private $_rangeEnd = null; private $_isJsonDecodeAssoc = false; - private $_limit = -1; + /** private $_errors = []; @@ -307,24 +311,24 @@ public function setRange($rangeStart, $rangeEnd = null) } /** - * Get the limit of returned rows + * Get the number rows which should be returned * * @return int */ - public function getLimit() + public function getFilterLimit(): int { - return intval($this->_limit); + return $this->_filter_limit; } /** - * Set the limit of returned rows + * Set the number of rows which should be returned * - * @param int $limit + * @param int $filterLimit * @return $this */ - public function setLimit($limit) + public function setFilterLimit(int $filterLimit): Matomo { - $this->_limit = $limit; + $this->_filter_limit = $filterLimit; return $this; } @@ -445,8 +449,8 @@ private function _parseUrl($method, array $params = []) 'period' => $this->_period, 'format' => $this->_format, 'language' => $this->_language, - 'filter_limit' => $this->_filter - ] + $params; + 'filter_limit' => $this->_filter_limit + ] + $params; foreach ($params as $key => $value) { $params[$key] = urlencode($value);