class Synonym in Google Search Appliance 8
Defines a value object for a synonym.
Hierarchy
- class \Drupal\google_appliance\SearchResults\Synonym
Expanded class hierarchy of Synonym
3 files declare their use of Synonym
- google_appliance.api.php in ./
google_appliance.api.php - Hook documentation.
- Parser.php in src/
Service/ Parser.php - TestSearch.php in tests/
modules/ google_appliance_test/ src/ TestSearch.php
File
- src/
SearchResults/ Synonym.php, line 12
Namespace
Drupal\google_appliance\SearchResultsView source
class Synonym {
/**
* Description.
*
* @var string
*/
protected $description;
/**
* URL.
*
* @var string
*/
protected $url;
/**
* Constructs a new Synonym object.
*
* @param string $description
* Synonym description.
* @param string $url
* Synonym URL.
*/
public function __construct($description, $url) {
$this->description = $description;
$this->url = $url;
}
/**
* Gets value of description.
*
* @return string
* Value of description
*/
public function getDescription() {
return $this->description;
}
/**
* Gets value of url.
*
* @return string
* Value of url
*/
public function getUrl() {
return $this->url;
}
/**
* Gets synonym as link.
*
* @return \Drupal\Core\Link
* Link object.
*/
public function getLink() {
return Link::fromTextAndUrl($this->description, Url::fromRoute(SearchViewRoute::ROUTE_NAME, [
'search_query' => $this->url,
]));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Synonym:: |
protected | property | Description. | |
Synonym:: |
protected | property | URL. | |
Synonym:: |
public | function | Gets value of description. | |
Synonym:: |
public | function | Gets synonym as link. | |
Synonym:: |
public | function | Gets value of url. | |
Synonym:: |
public | function | Constructs a new Synonym object. |