Skip to content

Commit

Permalink
Add comments for private methods in ResultDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Apr 14, 2021
1 parent 22597c9 commit 9f3a235
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Classes/Common/SolrSearchResult/ResultDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,28 @@ public function getHighlightsIds() {
return $highlightsIds;
}

/**
* Parse snippets array to string for displaying purpose.
* Snippets are stored in 'text' field of 'snippets' object.
*
* @access private
*
* @return void
*/
private function parseSnippets() {
$snippetArray = $this->getArrayByIndex('text');

$this->snippets = !empty($snippetArray) ? implode(' [...] ', $snippetArray) : '';
}

/**
* Parse pages array to array of Page objects.
* Pages are stored in 'pages' field of 'snippets' object.
*
* @access private
*
* @return void
*/
private function parsePages() {
$pageArray = $this->getArrayByIndex('pages');

Expand All @@ -225,6 +241,14 @@ private function parsePages() {
}
}

/**
* Parse regions array to array of Region objects.
* Regions are stored in 'regions' field of 'snippets' object.
*
* @access private
*
* @return void
*/
private function parseRegions() {
$regionArray = $this->getArrayByIndex('regions');

Expand All @@ -237,6 +261,14 @@ private function parseRegions() {
}
}

/**
* Parse highlights array to array of Highlight objects.
* Highlights are stored in 'highlights' field of 'snippets' object.
*
* @access private
*
* @return void
*/
private function parseHighlights() {
$highlightArray = $this->getArrayByIndex('highlights');

Expand All @@ -249,6 +281,15 @@ private function parseHighlights() {
}
}

/**
* Get array for given index.
*
* @access private
*
* @param string $index: Name of field for which array is going be created
*
* @return array
*/
private function getArrayByIndex($index) {
$objectArray = [];
foreach ($this->snippetsForRecord as $snippet) {
Expand Down

0 comments on commit 9f3a235

Please sign in to comment.