Skip to content

Commit

Permalink
style: remove spaces before multiline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Chloe070196 committed Aug 23, 2024
1 parent cda045b commit 4badf7e
Showing 1 changed file with 85 additions and 85 deletions.
170 changes: 85 additions & 85 deletions code/web/sys/SearchObject/SummonSearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -51,33 +51,33 @@ 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;
protected $journalTitle = false;
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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)){
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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 = [];
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -702,39 +702,39 @@ 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());
$this->queryStartTime = $time[1] + $time[0];
}

/**
* 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];
$this->queryTime = $this->queryEndTime - $this->queryStartTime;
}

/**
* 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([
Expand Down

0 comments on commit 4badf7e

Please sign in to comment.