From a59c4998e816bdd35f001433cdda151d9e05a01a Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 27 Feb 2018 14:04:43 -0500 Subject: [PATCH] Make ParamBag Countable. - Fixes PHP 7.2 compatibility. --- module/VuFindSearch/src/VuFindSearch/ParamBag.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/module/VuFindSearch/src/VuFindSearch/ParamBag.php b/module/VuFindSearch/src/VuFindSearch/ParamBag.php index 2702c40e27e..51095778e8a 100644 --- a/module/VuFindSearch/src/VuFindSearch/ParamBag.php +++ b/module/VuFindSearch/src/VuFindSearch/ParamBag.php @@ -41,7 +41,7 @@ namespace VuFindSearch; * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org */ -class ParamBag +class ParamBag implements \Countable { /** * Parameters @@ -76,6 +76,16 @@ class ParamBag return isset($this->params[$name]) ? $this->params[$name] : null; } + /** + * Count parameters in internal array. Needed for Countable interface. + * + * @return int + */ + public function count() + { + return count($this->params); + } + /** * Return true if the bag contains any value(s) for the specified parameter. * -- GitLab