Skip to content
Snippets Groups Projects
Commit 34b1353d authored by Demian Katz's avatar Demian Katz
Browse files

Style fixes.

parent 9d067b77
No related merge requests found
...@@ -135,8 +135,8 @@ class Record extends AbstractHelper ...@@ -135,8 +135,8 @@ class Record extends AbstractHelper
} }
/** /**
* Get an array of strings representing formats in which this record's * Get an array of strings representing formats in which this record's
* data may be exported (empty if none). Legal values: "RefWorks", * data may be exported (empty if none). Legal values: "RefWorks",
* "EndNote", "MARC", "RDF". * "EndNote", "MARC", "RDF".
* *
* @return array Strings representing export formats. * @return array Strings representing export formats.
...@@ -360,44 +360,44 @@ class Record extends AbstractHelper ...@@ -360,44 +360,44 @@ class Record extends AbstractHelper
* *
* @return array * @return array
*/ */
public function getLinkDetails() public function getLinkDetails()
{ {
// See if there are any links available: // See if there are any links available:
$urls = $this->driver->tryMethod('getURLs'); $urls = $this->driver->tryMethod('getURLs');
if (empty($urls)) { if (empty($urls)) {
return array(); return array();
} }
// If we found links, we may need to convert from the "route" format // If we found links, we may need to convert from the "route" format
// to the "full URL" format. // to the "full URL" format.
$urlHelper = $this->getView()->plugin('url'); $urlHelper = $this->getView()->plugin('url');
$serverUrlHelper = $this->getView()->plugin('serverurl'); $serverUrlHelper = $this->getView()->plugin('serverurl');
$formatLink = function ($link) use ($urlHelper, $serverUrlHelper) { $formatLink = function ($link) use ($urlHelper, $serverUrlHelper) {
// Error if route AND URL are missing at this point! // Error if route AND URL are missing at this point!
if (!isset($link['route']) && !isset($link['url'])) { if (!isset($link['route']) && !isset($link['url'])) {
throw new \Exception('Invalid URL array.'); throw new \Exception('Invalid URL array.');
} }
// Build URL from route/query details if missing: // Build URL from route/query details if missing:
if (!isset($link['url'])) { if (!isset($link['url'])) {
$routeParams = isset($link['routeParams']) $routeParams = isset($link['routeParams'])
? $link['routeParams'] : array(); ? $link['routeParams'] : array();
$link['url'] = $serverUrlHelper( $link['url'] = $serverUrlHelper(
$urlHelper($link['route'], $routeParams) $urlHelper($link['route'], $routeParams)
); );
if (isset($link['queryString'])) { if (isset($link['queryString'])) {
$link['url'] .= $link['queryString']; $link['url'] .= $link['queryString'];
} }
} }
// Use URL as description if missing: // Use URL as description if missing:
if (!isset($link['desc'])) { if (!isset($link['desc'])) {
$link['desc'] = $link['url']; $link['desc'] = $link['url'];
} }
return $link; return $link;
}; };
return array_map($formatLink, $urls); return array_map($formatLink, $urls);
} }
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment