From 4badf7e4c498bf924403fa099c04df72d430c6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Fri, 23 Aug 2024 12:30:54 +0100 Subject: [PATCH] style: remove spaces before multiline comments --- code/web/sys/SearchObject/SummonSearcher.php | 170 +++++++++---------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/code/web/sys/SearchObject/SummonSearcher.php b/code/web/sys/SearchObject/SummonSearcher.php index 258901ba37..406d8813e0 100644 --- a/code/web/sys/SearchObject/SummonSearcher.php +++ b/code/web/sys/SearchObject/SummonSearcher.php @@ -39,7 +39,7 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{ protected $searchSource = 'local'; protected $searchType = 'basic'; -/** Values for the options array*/ +/** Values for the options array */ protected $holdings = true; protected $didYouMean = false; protected $language = 'en'; @@ -51,24 +51,24 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{ protected $expand = false; protected $sortOptions = array(); /** - * @var string - */ + * @var string + */ protected $defaultSort = 'relevance'; protected $query; protected $filters = array(); protected $rangeFilters = array(); /** - * @var int - */ + * @var int + */ protected $limit= 20; /** - * @var int - */ + * @var int + */ protected $page = 1; /** - * @var int - */ + * @var int + */ protected $maxRecDb = 2; protected $bookMark; protected $debug = false; @@ -76,8 +76,8 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{ protected $lightWeightRes = false; protected $sort = null; /** - * @var string mixed - */ + * @var string mixed + */ private $searchIndex = 'Title'; /**Facets, filters and limiters */ //Values for the main facets - each has an array of available values @@ -114,12 +114,12 @@ public function __construct() { } /** - * Initialise the object from the global - * search parameters in $_REQUEST. - * @access public - * @param string $searchSource - * @return boolean - */ + * Initialise the object from the global + * search parameters in $_REQUEST. + * @access public + * @param string $searchSource + * @return boolean + */ public function init($searchSource = null) { //******************** // Check if we have a saved search to restore -- if restored successfully, @@ -156,9 +156,9 @@ public function init($searchSource = null) { } /** - * Create an instance of the Summon Searcher - * @return SearchObject_SummonSearcher - */ + * Create an instance of the Summon Searcher + * @return SearchObject_SummonSearcher + */ public static function getInstance() { if (SearchObject_SummonSearcher::$instance == null) { SearchObject_SummonSearcher::$instance = new SearchObject_SummonSearcher(); @@ -167,7 +167,7 @@ public static function getInstance() { } /** - * Retreive settings for institution's summon connector + * Retreive settings for institution's summon connector */ private function getSettings() { global $library; @@ -206,7 +206,7 @@ public function getHeaders() { } /** - * Use Institution's Summon API credentials to authenticate and allow connection with the Summon API + * Use Institution's Summon API credentials to authenticate and allow connection with the Summon API */ public function authenticate($settings, $queryString) { $headers = $this->getHeaders(); @@ -278,8 +278,8 @@ public function getOptions () { } /** - * Use the data that is returned when from the API and process it to assign it to variables - */ + * Use the data that is returned when from the API and process it to assign it to variables + */ public function processData($recordData, $textQuery = null) { $recordData = $this->process($recordData, $textQuery); if (is_array($recordData)){ @@ -313,37 +313,37 @@ public function splitFacets($combinedFacets) { } /** - * Return an array of data summarising the results of a search. - * - * @access public - * @return array summary of results - */ + * Return an array of data summarising the results of a search. + * + * @access public + * @return array summary of results + */ public function getResultSummary() { $summary = []; $summary['page'] = $this->page; $summary['perPage'] = $this->limit; $summary['resultTotal'] = (int)$this->resultsTotal; // 1st record is easy, work out the start of this page - $summary['startRecord'] = (($this->page - 1) * $this->limit) + 1; + $summary['startRecord'] = (($this->page - 1)* $this->limit) + 1; // Last record needs more care if ($this->resultsTotal < $this->limit) { // There are less records returned than one page, then use total results $summary['endRecord'] = $this->resultsTotal; - } elseif (($this->page * $this->limit) > $this->resultsTotal) { + } elseif (($this->page* $this->limit) > $this->resultsTotal) { // The end of the current page runs past the last record, use total results $summary['endRecord'] = $this->resultsTotal; } else { // Otherwise use the last record on this page - $summary['endRecord'] = $this->page * $this->limit; + $summary['endRecord'] = $this->page* $this->limit; } return $summary; } /** Return a url for use by pagination template - * - * @access public - * @return string URL of a new search - */ + * + * @access public + * @return string URL of a new search + */ public function renderLinkPageTemplate() { // Stash our old data for a minute $oldPage = $this->page; @@ -358,12 +358,12 @@ public function renderLinkPageTemplate() { } /** - * Use the record driver to build an array of HTML displays from the search - * results. Called by results.php. - * - * @access public - * @return array Array of HTML chunks for individual records. - */ + * Use the record driver to build an array of HTML displays from the search + * results. Called by results.php. + * + * @access public + * @return array Array of HTML chunks for individual records. + */ public function getResultRecordHTML() { global $interface; global $timer; @@ -373,7 +373,7 @@ public function getResultRecordHTML() { for ($x = 0; $x < count($this->lastSearchResults); $x++) { $current = &$this->lastSearchResults[$x]; $interface->assign('recordIndex', $x + 1); - $interface->assign('resultIndex', $x + 1 + (($this->page - 1) * $this->limit)); + $interface->assign('resultIndex', $x + 1 + (($this->page - 1)* $this->limit)); require_once ROOT_DIR . '/RecordDrivers/SummonRecordDriver.php'; $record = new SummonRecordDriver($current); @@ -389,19 +389,19 @@ public function getResultRecordHTML() { } /** - * Use the record driver to build an array of HTML displays from the search - * results. - * - * @access public - * @return array Array of HTML chunks for individual records. - */ + * Use the record driver to build an array of HTML displays from the search + * results. + * + * @access public + * @return array Array of HTML chunks for individual records. + */ public function getCombinedResultHTML() { global $interface; $html = []; if (isset($this->lastSearchResults)) { foreach($this->lastSearchResults as $key=>$value){ $interface->assign('recordIndex', $key + 1); - $interface->assign('resultIndex', $key + 1 + (($this->page - 1) * $this->limit)); + $interface->assign('resultIndex', $key + 1 + (($this->page - 1)* $this->limit)); require_once ROOT_DIR . '/RecordDrivers/SummonRecordDriver.php'; $record = new SummonRecordDriver($value); @@ -435,12 +435,12 @@ public function getSortList() { } /** - * Return a url for the current search with a new sort - * - * @access public - * @param string $newSort A field to sort by - * @return string URL of a new search - */ + * Return a url for the current search with a new sort + * + * @access public + * @param string $newSort A field to sort by + * @return string URL of a new search + */ public function renderLinkWithSort($newSort) { // Stash our old data for a minute $oldSort = $this->sort; @@ -455,9 +455,9 @@ public function renderLinkWithSort($newSort) { } /** - * Called in Results.php - * Controls side facets - */ + * Called in Results.php + * Controls side facets + */ public function getFacetSet() { $availableFacets = []; $this->filters = []; @@ -577,12 +577,12 @@ public function getSummonFilters() { /** - * Generate an HMAC hash for authentication - * - * @param string $key Hash key - * @param string $data Data to hash - * - * @return string Generated hash + * Generate an HMAC hash for authentication + * + * @param string $key Hash key + * @param string $data Data to hash + * + * @return string Generated hash */ protected function hmacsha1($key, $data) { $blocksize=64; @@ -606,10 +606,10 @@ protected function hmacsha1($key, $data) { } /** - * Send a fully built query string to the API with user authentication - called in Results.php - * @throws Exception - * @return object API response - */ + * Send a fully built query string to the API with user authentication - called in Results.php + * @throws Exception + * @return object API response + */ public function sendRequest() { $baseUrl = $this->summonBaseApi . '/' .$this->version . '/' .$this->service; $settings = $this->getSettings(); @@ -680,8 +680,8 @@ public function process($input, $textQuery = null) { } /** - * Send HTTP request with headers modified to meet Summon API requirements - */ + * Send HTTP request with headers modified to meet Summon API requirements + */ protected function httpRequest($baseUrl, $queryString, $headers) { foreach ($headers as $key =>$value) { $modified_headers[] = $key.": ".$value; @@ -702,11 +702,11 @@ protected function httpRequest($baseUrl, $queryString, $headers) { } /** - * Start the timer to work out how long a query takes. Complements - * stopQueryTimer(). - * - * @access protected - */ + * Start the timer to work out how long a query takes. Complements + * stopQueryTimer(). + * + * @access protected + */ protected function startQueryTimer() { // Get time before the query $time = explode(" ", microtime()); @@ -714,11 +714,11 @@ protected function startQueryTimer() { } /** - * End the timer to work out how long a query takes. Complements - * startQueryTimer(). - * - * @access protected - */ + * End the timer to work out how long a query takes. Complements + * startQueryTimer(). + * + * @access protected + */ protected function stopQueryTimer() { $time = explode(" ", microtime()); $this->queryEndTime = $time[1] + $time[0]; @@ -726,15 +726,15 @@ protected function stopQueryTimer() { } /** - * Work out how long the query took - */ + * Work out how long the query took + */ public function getQuerySpeed() { return $this->queryTime; } /** - * Search indexes - */ + * Search indexes + */ public function getSearchIndexes() { return [ "Title" => translate([