From 55c94f15c625d9467341eda41d1226f48022f49e Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 9 Jan 2015 15:11:59 -0500 Subject: [PATCH] Eliminated redundant/verbose code. --- .../Backend/EDS/SearchRequestModel.php | 66 +------------------ 1 file changed, 2 insertions(+), 64 deletions(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php index 13fc3306ee0..5778aba5146 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/EDS/SearchRequestModel.php @@ -204,69 +204,7 @@ class SearchRequestModel */ public function convertToQueryString() { - $qs = ''; - if (isset($this->query) && 0 < sizeof($this->query)) { - for ($x=0; $x<sizeof($this->query); $x++) { - $qs .= 'query-'.($x+1).'='.$this->query[$x].'&'; - } - } - - if (isset($this->facetFilters) && 0 < sizeof($this->facetFilters)) { - for ($x=0; $x<sizeof($this->facetFilters); $x++) { - $qs .= 'facetfilter='.$this->facetFilters[$x].'&'; - } - } - - if (isset($this->limiters) && 0 < sizeof($this->limiters)) { - for ($x=0; $x<sizeof($this->limiters); $x++) { - $qs .= 'limiter='.$this->limiters[$x].'&'; - } - } - - if (isset($this->expanders) && 0 < sizeof($this->expanders)) { - $expand = implode(",", $this->expanders); - $qs .= 'expander='.$expand.'&'; - } - - if (isset($this->includeFacets)) { - $qs .= 'includefacets='.$this->includeFacets.'&'; - } - - if (isset($this->sort)) { - $qs .= 'sort='.$this->sort.'&';; - } - - if (isset($this->searchMode)) { - $qs .= 'searchmode='.$this->searchMode.'&'; - } - - if (isset($this->view)) { - $qs .= 'view='.$this->view.'&'; - } - - if (isset($this->resultsPerPage)) { - $qs .= 'resultsperpage='.$this->resultsPerPage.'&'; - } - - if (isset($this->pageNumber)) { - $qs .= 'pagenumber='.$this->pageNumber.'&'; - } - - if (isset($this->highlight)) { - $highlightVal = $this->highlight ? 'y' : 'n'; - $qs .= 'highlight='.$highlightVal.'&'; - } - - if (isset($this->actions) && 0 < sizeof($this->actions)) { - for ($x=0; $x<sizeof($this->actions); $x++) { - $qs .= 'action-'.($x+1).'='.$this->actions[$x].'&'; - } - } - - if ($this->endsWith($qs, '&')) { - $qs = substr($qs, 0, -1); - } - return $qs; + return http_build_query($this->convertToQueryStringParameterArray()); } /** @@ -353,7 +291,7 @@ class SearchRequestModel public static function isParameterIndexed($value) { //Indexed parameter names end with '-x' - return SearchRequestModel::endsWith($value, '-x'); + return static::endsWith($value, '-x'); } /** -- GitLab