@@ -33,8 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @access public |
35 | 35 | */ |
36 | -class SearchController extends AbstractController |
|
37 | -{ |
|
36 | +class SearchController extends AbstractController { |
|
38 | 37 | /** |
39 | 38 | * @access protected |
40 | 39 | * @var CollectionRepository |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
125 | - $this->searchParams = array_merge($this->searchParams ?: [], $listRequestData['searchParameter']); |
|
125 | + $this->searchParams = array_merge($this->searchParams ? : [], $listRequestData['searchParameter']); |
|
126 | 126 | $listViewSearch = true; |
127 | 127 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams); |
128 | 128 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $simplePagination = new SimplePagination($solrPaginator); |
184 | 184 | |
185 | 185 | $pagination = $this->buildSimplePagination($simplePagination, $solrPaginator); |
186 | - $this->view->assignMultiple([ 'pagination' => $pagination, 'paginator' => $solrPaginator ]); |
|
186 | + $this->view->assignMultiple(['pagination' => $pagination, 'paginator' => $solrPaginator]); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $this->view->assign('documents', !empty($solrResults) ? $solrResults : []); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | // Add uHash parameter to suggest parameter to make a basic protection of this form. |
210 | 210 | if ($this->settings['suggest']) { |
211 | - $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()) . Environment::getExtensionsPath(), 'SearchSuggest')); |
|
211 | + $this->view->assign('uHash', GeneralUtility::hmac((string) (new Typo3Version()).Environment::getExtensionsPath(), 'SearchSuggest')); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | $this->view->assign('viewData', $this->viewData); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | // Get facets from plugin configuration. |
230 | 230 | $facets = []; |
231 | 231 | foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
232 | - $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
232 | + $facets[$facet.'_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | $this->view->assign('facetsMenu', $this->makeFacetsMenuArray($facets)); |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | $searchParams = $this->searchParams; |
266 | 266 | if ( |
267 | 267 | (!empty($searchParams['fulltext'])) |
268 | - || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches) |
|
268 | + || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches) |
|
269 | 269 | ) { |
270 | 270 | // If the query already is a fulltext query e.g using the facets |
271 | 271 | $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1]; |
272 | 272 | // Search in fulltext field if applicable. Query must not be empty! |
273 | 273 | if (!empty($searchParams['query'])) { |
274 | - $search['query'] = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')'; |
|
274 | + $search['query'] = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')'; |
|
275 | 275 | } |
276 | 276 | } else { |
277 | 277 | // Retain given search field if valid. |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | // add filter query for date search |
289 | 289 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
290 | 290 | // combine dateFrom and dateTo into filterquery as range search |
291 | - $search['params']['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}' . $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
291 | + $search['params']['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // Add extended search query. |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | in_array($searchParams['extOperator'][$i], $allowedOperators) |
307 | 307 | ) { |
308 | 308 | if (!empty($search['query'])) { |
309 | - $search['query'] .= ' ' . $searchParams['extOperator'][$i] . ' '; |
|
309 | + $search['query'] .= ' '.$searchParams['extOperator'][$i].' '; |
|
310 | 310 | } |
311 | - $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')'; |
|
311 | + $search['query'] .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')'; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
@@ -397,24 +397,24 @@ discard block |
||
397 | 397 | foreach ($collections as $collectionEntry) { |
398 | 398 | // check for virtual collections query string |
399 | 399 | if ($collectionEntry->getIndexSearch()) { |
400 | - $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')'; |
|
400 | + $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '('.$collectionEntry->getIndexSearch().')' : ' OR ('.$collectionEntry->getIndexSearch().')'; |
|
401 | 401 | } else { |
402 | - $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"'; |
|
402 | + $collectionsQueryString .= empty($collectionsQueryString) ? '"'.$collectionEntry->getIndexName().'"' : ' OR "'.$collectionEntry->getIndexName().'"'; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | 406 | // distinguish between simple collection browsing and actual searching within the collection(s) |
407 | 407 | if (!empty($collectionsQueryString)) { |
408 | 408 | if (empty($query)) { |
409 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)'; |
|
409 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.') AND toplevel:true AND partof:0)'; |
|
410 | 410 | } else { |
411 | - $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))'; |
|
411 | + $collectionsQueryString = '(collection_faceting:('.$collectionsQueryString.'))'; |
|
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | 415 | // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separately |
416 | 416 | if (!empty($virtualCollectionsQueryString)) { |
417 | - $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')'; |
|
417 | + $virtualCollectionsQueryString = '('.$virtualCollectionsQueryString.')'; |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | // combine both querystrings into a single filterquery via OR if both are given, otherwise pass either of those |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $entryArray['doNotLinkIt'] = 0; |
445 | 445 | // Check if facet is already selected. |
446 | 446 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
447 | - $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
|
447 | + $index = array_search($field.':("'.Solr::escapeQuery($value).'")', $queryColumn); |
|
448 | 448 | if ($index !== false) { |
449 | 449 | // Facet is selected, thus remove it from filter. |
450 | 450 | unset($queryColumn[$index]); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | } else { |
460 | 460 | // Facet is not selected, thus add it to filter. |
461 | - $queryColumn[] = $field . ':("' . Solr::escapeQuery($value) . '")'; |
|
461 | + $queryColumn[] = $field.':("'.Solr::escapeQuery($value).'")'; |
|
462 | 462 | $entryArray['ITEM_STATE'] = 'NO'; |
463 | 463 | } |
464 | 464 | $entryArray['queryColumn'] = $queryColumn; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $this->searchParams = $this->getParametersSafely('searchParameter'); |
93 | 93 | |
94 | 94 | // output is done by main action |
95 | - return $this->redirect('main', null, null, ['searchParameter' => $this->searchParams]); |
|
95 | + return $this->redirect('main', NULL, NULL, ['searchParameter' => $this->searchParams]); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function mainAction(): ResponseInterface |
108 | 108 | { |
109 | - $listViewSearch = false; |
|
109 | + $listViewSearch = FALSE; |
|
110 | 110 | // Quit without doing anything if required variables are not set. |
111 | 111 | if (empty($this->settings['solrcore'])) { |
112 | 112 | $this->logger->warning('Incomplete plugin configuration'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | if (isset($listRequestData['searchParameter']) && is_array($listRequestData['searchParameter'])) { |
128 | 128 | $this->searchParams = array_merge($this->searchParams ?: [], $listRequestData['searchParameter']); |
129 | - $listViewSearch = true; |
|
129 | + $listViewSearch = TRUE; |
|
130 | 130 | $GLOBALS['TSFE']->fe_user->setKey('ses', 'search', $this->searchParams); |
131 | 131 | } |
132 | 132 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return $this->redirect( |
159 | 159 | 'main', |
160 | 160 | 'ListView', |
161 | - null, |
|
161 | + NULL, |
|
162 | 162 | [ |
163 | 163 | 'searchParameter' => $this->searchParams, |
164 | 164 | 'page' => $currentPage |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | // An empty form will be shown. |
171 | 171 | if (is_array($this->searchParams) && !empty($this->searchParams)) { |
172 | 172 | // get all sortable metadata records |
173 | - $sortableMetadata = $this->metadataRepository->findByIsSortable(true); |
|
173 | + $sortableMetadata = $this->metadataRepository->findByIsSortable(TRUE); |
|
174 | 174 | |
175 | 175 | // get all metadata records to be shown in results |
176 | - $listedMetadata = $this->metadataRepository->findByIsListed(true); |
|
176 | + $listedMetadata = $this->metadataRepository->findByIsListed(TRUE); |
|
177 | 177 | |
178 | 178 | // get all indexed metadata fields |
179 | - $indexedMetadata = $this->metadataRepository->findByIndexIndexed(true); |
|
179 | + $indexedMetadata = $this->metadataRepository->findByIndexIndexed(TRUE); |
|
180 | 180 | |
181 | - $solrResults = null; |
|
181 | + $solrResults = NULL; |
|
182 | 182 | $numResults = 0; |
183 | 183 | // Do not execute the Solr search if used together with ListView plugin. |
184 | 184 | if (!$listViewSearch) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | // Get facets from plugin configuration. |
242 | 242 | $facets = []; |
243 | - foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], true) as $facet) { |
|
243 | + foreach (GeneralUtility::trimExplode(',', $this->settings['facets'], TRUE) as $facet) { |
|
244 | 244 | $facets[$facet . '_faceting'] = Helper::translate($facet, 'tx_dlf_metadata', $this->settings['storagePid']); |
245 | 245 | } |
246 | 246 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | { |
398 | 398 | // if collections are given, we prepare the collections query string |
399 | 399 | // extract collections from collection parameter |
400 | - $collections = null; |
|
400 | + $collections = NULL; |
|
401 | 401 | if (array_key_exists('collection', $this->searchParams)) { |
402 | 402 | foreach (explode(',', $this->searchParams['collection']) as $collectionEntry) { |
403 | 403 | if (!empty($collectionEntry)) { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // Check if facet is already selected. |
460 | 460 | $queryColumn = array_column($search['params']['filterquery'], 'query'); |
461 | 461 | $index = array_search($field . ':("' . Solr::escapeQuery($value) . '")', $queryColumn); |
462 | - if ($index !== false) { |
|
462 | + if ($index !== FALSE) { |
|
463 | 463 | // Facet is selected, thus remove it from filter. |
464 | 464 | unset($queryColumn[$index]); |
465 | 465 | $queryColumn = array_values($queryColumn); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $state = 'ACTIFSUB'; |
468 | 468 | // Reset facets |
469 | 469 | if ($this->settings['resetFacets']) { |
470 | - $entryArray['resetFacet'] = true; |
|
470 | + $entryArray['resetFacet'] = TRUE; |
|
471 | 471 | $entryArray['queryColumn'] = $queryColumn; |
472 | 472 | } |
473 | 473 | } else { |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | |
580 | 580 | // Get field selector options. |
581 | - $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], true); |
|
581 | + $searchFields = GeneralUtility::trimExplode(',', $this->settings['extendedFields'], TRUE); |
|
582 | 582 | |
583 | 583 | $slotCountArray = []; |
584 | 584 | for ($i = 0; $i < $this->settings['extendedSlotCount']; $i++) { |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $metadata['video_duration'] = [$videoDuration]; |
54 | 54 | } |
55 | 55 | |
56 | - $metadata['duration'] = $metadata['video_duration'] ?: $metadata['audio_duration'] ?: []; |
|
56 | + $metadata['duration'] = $metadata['video_duration'] ? : $metadata['audio_duration'] ? : []; |
|
57 | 57 | |
58 | 58 | if ($useExternalApis) { |
59 | 59 | // TODO? |
@@ -25,8 +25,7 @@ |
||
25 | 25 | * |
26 | 26 | * @access public |
27 | 27 | */ |
28 | -class AudioVideoMD implements MetadataInterface |
|
29 | -{ |
|
28 | +class AudioVideoMD implements MetadataInterface { |
|
30 | 29 | /** |
31 | 30 | * Extract some essential AudioMD/VideoMD metadata. |
32 | 31 | * |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = false): void |
|
41 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = FALSE): void |
|
42 | 42 | { |
43 | 43 | $xml->registerXPathNamespace('audiomd', 'http://www.loc.gov/audioMD/'); |
44 | 44 | $xml->registerXPathNamespace('videomd', 'http://www.loc.gov/videoMD/'); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | return ' '; |
125 | 125 | } |
126 | - return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
|
126 | + return htmlspecialchars((string) $attributes['CONTENT']).' '; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | private function getCoordinates(\SimpleXMLElement $attributes): string |
139 | 139 | { |
140 | - return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
|
140 | + return (string) $attributes['HPOS'].' '.(string) $attributes['VPOS'].' '.(string) $attributes['WIDTH'].' '.(string) $attributes['HEIGHT']; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -147,8 +147,7 @@ |
||
147 | 147 | * |
148 | 148 | * @param \SimpleXMLElement &$xml: The XML to register the namespace for |
149 | 149 | */ |
150 | - private function registerAltoNamespace(\SimpleXMLElement &$xml) |
|
151 | - { |
|
150 | + private function registerAltoNamespace(\SimpleXMLElement &$xml) { |
|
152 | 151 | $namespace = $xml->getDocNamespaces(); |
153 | 152 | |
154 | 153 | if (in_array('http://www.loc.gov/standards/alto/ns-v2#', $namespace, true)) { |
@@ -151,11 +151,11 @@ |
||
151 | 151 | { |
152 | 152 | $namespace = $xml->getDocNamespaces(); |
153 | 153 | |
154 | - if (in_array('http://www.loc.gov/standards/alto/ns-v2#', $namespace, true)) { |
|
154 | + if (in_array('http://www.loc.gov/standards/alto/ns-v2#', $namespace, TRUE)) { |
|
155 | 155 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
156 | - } elseif (in_array('http://www.loc.gov/standards/alto/ns-v3#', $namespace, true)) { |
|
156 | + } elseif (in_array('http://www.loc.gov/standards/alto/ns-v3#', $namespace, TRUE)) { |
|
157 | 157 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v3#'); |
158 | - } elseif (in_array('http://www.loc.gov/standards/alto/ns-v4#', $namespace, true)) { |
|
158 | + } elseif (in_array('http://www.loc.gov/standards/alto/ns-v4#', $namespace, TRUE)) { |
|
159 | 159 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v4#'); |
160 | 160 | } |
161 | 161 | } |
@@ -24,8 +24,7 @@ |
||
24 | 24 | * |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class Mods implements MetadataInterface |
|
28 | -{ |
|
27 | +class Mods implements MetadataInterface { |
|
29 | 28 | /** |
30 | 29 | * @access private |
31 | 30 | * @var \SimpleXMLElement The metadata XML |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (!empty($name)) { |
125 | 125 | $this->metadata['author'][$i] = [ |
126 | 126 | 'name' => $name, |
127 | - 'url' => 'https://orcid.org/' . $orcidId |
|
127 | + 'url' => 'https://orcid.org/'.$orcidId |
|
128 | 128 | ]; |
129 | 129 | } else { |
130 | 130 | //fallback into display form |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | // Append "valueURI" to name using Unicode unit separator. |
183 | 183 | if (!empty($authors[$i]->getValueURI())) { |
184 | - $this->metadata['author'][$i] .= pack('C', 31) . $authors[$i]->getValueURI(); |
|
184 | + $this->metadata['author'][$i] .= pack('C', 31).$authors[$i]->getValueURI(); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (!empty($name)) { |
245 | 245 | $this->metadata['holder'][$i] = [ |
246 | 246 | 'name' => $name, |
247 | - 'url' => 'http://viaf.org/viaf/' . $viafId |
|
247 | + 'url' => 'http://viaf.org/viaf/'.$viafId |
|
248 | 248 | ]; |
249 | 249 | } else { |
250 | 250 | //fallback into display form |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $this->getHolderFromXmlDisplayForm($holders, $i); |
268 | 268 | // Append "valueURI" to name using Unicode unit separator. |
269 | 269 | if (!empty($holders[$i]->getValueURI())) { |
270 | - $this->metadata['holder'][$i] .= pack('C', 31) . $holders[$i]->getValueURI(); |
|
270 | + $this->metadata['holder'][$i] .= pack('C', 31).$holders[$i]->getValueURI(); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 |
@@ -22,8 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @access public |
24 | 24 | */ |
25 | -class TeiHeader implements MetadataInterface |
|
26 | -{ |
|
25 | +class TeiHeader implements MetadataInterface { |
|
27 | 26 | /** |
28 | 27 | * This extracts the essential TEIHDR metadata from XML |
29 | 28 | * |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @return void |
37 | 37 | */ |
38 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = false): void |
|
38 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata, bool $useExternalApis = FALSE): void |
|
39 | 39 | { |
40 | 40 | $xml->registerXPathNamespace('teihdr', 'http://www.tei-c.org/ns/1.0'); |
41 | 41 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function __construct(string $viaf, RequestFactory $requestFactory) |
66 | 66 | { |
67 | 67 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
68 | - $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
|
68 | + $this->viafUrl = 'http://viaf.org/viaf/'.$viaf; |
|
69 | 69 | $this->requestFactory = $requestFactory; |
70 | 70 | } |
71 | 71 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | try { |
96 | 96 | $response = $this->requestFactory->request($url); |
97 | 97 | } catch (\Exception $e) { |
98 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
98 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | return $response->getBody()->getContents(); |
@@ -110,6 +110,6 @@ discard block |
||
110 | 110 | **/ |
111 | 111 | private function getApiEndpoint(): string |
112 | 112 | { |
113 | - return $this->viafUrl . '/' . $this->endpoint; |
|
113 | + return $this->viafUrl.'/'.$this->endpoint; |
|
114 | 114 | } |
115 | 115 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @access public |
28 | 28 | **/ |
29 | -class Client |
|
30 | -{ |
|
29 | +class Client { |
|
31 | 30 | /** |
32 | 31 | * @access protected |
33 | 32 | * @var Logger This holds the logger |
@@ -62,8 +61,7 @@ discard block |
||
62 | 61 | * |
63 | 62 | * @return void |
64 | 63 | **/ |
65 | - public function __construct(string $viaf, RequestFactory $requestFactory) |
|
66 | - { |
|
64 | + public function __construct(string $viaf, RequestFactory $requestFactory) { |
|
67 | 65 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
68 | 66 | $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
69 | 67 | $this->requestFactory = $requestFactory; |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | * |
90 | 88 | * @return object|bool |
91 | 89 | **/ |
92 | - public function getData() |
|
93 | - { |
|
90 | + public function getData() { |
|
94 | 91 | $url = $this->getApiEndpoint(); |
95 | 92 | try { |
96 | 93 | $response = $this->requestFactory->request($url); |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $response = $this->requestFactory->request($url); |
97 | 97 | } catch (\Exception $e) { |
98 | 98 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
99 | - return false; |
|
99 | + return FALSE; |
|
100 | 100 | } |
101 | 101 | return $response->getBody()->getContents(); |
102 | 102 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @access public |
28 | 28 | **/ |
29 | -class Profile |
|
30 | -{ |
|
29 | +class Profile { |
|
31 | 30 | /** |
32 | 31 | * @access private |
33 | 32 | * @var Logger This holds the logger |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | * |
56 | 55 | * @return void |
57 | 56 | **/ |
58 | - public function __construct(string $viaf) |
|
59 | - { |
|
57 | + public function __construct(string $viaf) { |
|
60 | 58 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
61 | 59 | $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class)); |
62 | 60 | } |
@@ -68,8 +66,7 @@ discard block |
||
68 | 66 | * |
69 | 67 | * @return array|false |
70 | 68 | **/ |
71 | - public function getData() |
|
72 | - { |
|
69 | + public function getData() { |
|
73 | 70 | $this->getRaw(); |
74 | 71 | if ($this->raw !== false && !empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -89,8 +86,7 @@ discard block |
||
89 | 86 | * |
90 | 87 | * @return string|false |
91 | 88 | **/ |
92 | - public function getAddress() |
|
93 | - { |
|
89 | + public function getAddress() { |
|
94 | 90 | $this->getRaw(); |
95 | 91 | if ($this->raw !== false && !empty($this->raw->asXML())) { |
96 | 92 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
@@ -107,8 +103,7 @@ discard block |
||
107 | 103 | * |
108 | 104 | * @return string|false |
109 | 105 | **/ |
110 | - public function getFullName() |
|
111 | - { |
|
106 | + public function getFullName() { |
|
112 | 107 | $this->getRaw(); |
113 | 108 | if ($this->raw !== false && !empty($this->raw->asXML())) { |
114 | 109 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @access private |
45 | 45 | * @var \SimpleXmlElement|false The raw VIAF profile or false if not found |
46 | 46 | **/ |
47 | - private $raw = false; |
|
47 | + private $raw = FALSE; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Constructs client instance |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | public function getData() |
72 | 72 | { |
73 | 73 | $this->getRaw(); |
74 | - if ($this->raw !== false && !empty($this->raw)) { |
|
74 | + if ($this->raw !== FALSE && !empty($this->raw)) { |
|
75 | 75 | $data = []; |
76 | 76 | $data['address'] = $this->getAddress(); |
77 | 77 | $data['fullName'] = $this->getFullName(); |
78 | 78 | return $data; |
79 | 79 | } else { |
80 | 80 | $this->logger->warning('No data found for given VIAF URL'); |
81 | - return false; |
|
81 | + return FALSE; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | public function getAddress() |
93 | 93 | { |
94 | 94 | $this->getRaw(); |
95 | - if ($this->raw !== false && !empty($this->raw->asXML())) { |
|
95 | + if ($this->raw !== FALSE && !empty($this->raw->asXML())) { |
|
96 | 96 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
97 | 97 | } else { |
98 | 98 | $this->logger->warning('No address found for given VIAF URL'); |
99 | - return false; |
|
99 | + return FALSE; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | public function getFullName() |
111 | 111 | { |
112 | 112 | $this->getRaw(); |
113 | - if ($this->raw !== false && !empty($this->raw->asXML())) { |
|
113 | + if ($this->raw !== FALSE && !empty($this->raw->asXML())) { |
|
114 | 114 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
115 | 115 | $name = (string) $rawName[0]; |
116 | 116 | $name = trim(trim(trim($name), ','), '.'); |
117 | 117 | return $name; |
118 | 118 | } else { |
119 | 119 | $this->logger->warning('No name found for given VIAF URL'); |
120 | - return false; |
|
120 | + return FALSE; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | private function getRaw(): void |
132 | 132 | { |
133 | 133 | $data = $this->client->getData(); |
134 | - if ($data != false) { |
|
134 | + if ($data != FALSE) { |
|
135 | 135 | $this->raw = Helper::getXmlFileAsString($data); |
136 | - if ($this->raw != false && !empty($this->raw->asXML())) { |
|
136 | + if ($this->raw != FALSE && !empty($this->raw->asXML())) { |
|
137 | 137 | $this->raw->registerXPathNamespace('ns1', 'http://viaf.org/viaf/terms#'); |
138 | 138 | } |
139 | 139 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | try { |
112 | 112 | $response = $this->requestFactory->request($url); |
113 | 113 | } catch (\Exception $e) { |
114 | - $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
|
114 | + $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.'); |
|
115 | 115 | return false; |
116 | 116 | } |
117 | 117 | return $response->getBody()->getContents(); |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | **/ |
127 | 127 | private function getApiEndpoint(): string |
128 | 128 | { |
129 | - $url = 'https://' . $this->level . '.' . self::HOSTNAME; |
|
130 | - $url .= '/v' . self::VERSION . '/'; |
|
129 | + $url = 'https://'.$this->level.'.'.self::HOSTNAME; |
|
130 | + $url .= '/v'.self::VERSION.'/'; |
|
131 | 131 | $url .= $this->orcid; |
132 | - $url .= '/' . $this->endpoint; |
|
132 | + $url .= '/'.$this->endpoint; |
|
133 | 133 | return $url; |
134 | 134 | } |
135 | 135 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @access public |
28 | 28 | **/ |
29 | -class Client |
|
30 | -{ |
|
29 | +class Client { |
|
31 | 30 | /** |
32 | 31 | * @var string constant for API hostname |
33 | 32 | **/ |
@@ -78,8 +77,7 @@ discard block |
||
78 | 77 | * |
79 | 78 | * @return void |
80 | 79 | **/ |
81 | - public function __construct(string $orcid, RequestFactory $requestFactory) |
|
82 | - { |
|
80 | + public function __construct(string $orcid, RequestFactory $requestFactory) { |
|
83 | 81 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
84 | 82 | $this->orcid = $orcid; |
85 | 83 | $this->requestFactory = $requestFactory; |
@@ -105,8 +103,7 @@ discard block |
||
105 | 103 | * |
106 | 104 | * @return object|bool |
107 | 105 | **/ |
108 | - public function getData() |
|
109 | - { |
|
106 | + public function getData() { |
|
110 | 107 | $url = $this->getApiEndpoint(); |
111 | 108 | try { |
112 | 109 | $response = $this->requestFactory->request($url); |
@@ -96,7 +96,7 @@ |
||
96 | 96 | $response = $this->requestFactory->request($url); |
97 | 97 | } catch (\Exception $e) { |
98 | 98 | $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.'); |
99 | - return false; |
|
99 | + return FALSE; |
|
100 | 100 | } |
101 | 101 | return $response->getBody()->getContents(); |
102 | 102 | } |
@@ -23,8 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class StdWrapViewHelper extends AbstractViewHelper |
|
27 | -{ |
|
26 | +class StdWrapViewHelper extends AbstractViewHelper { |
|
28 | 27 | /** |
29 | 28 | * @access protected |
30 | 29 | * @var bool |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @access protected |
30 | 30 | * @var bool |
31 | 31 | */ |
32 | - protected $escapeOutput = false; |
|
32 | + protected $escapeOutput = FALSE; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Initializes arguments. |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | public function initializeArguments(): void |
42 | 42 | { |
43 | 43 | parent::initializeArguments(); |
44 | - $this->registerArgument('wrap', 'string', 'The wrap information', true); |
|
45 | - $this->registerArgument('data', 'array', 'Data for the content object', false); |
|
44 | + $this->registerArgument('wrap', 'string', 'The wrap information', TRUE); |
|
45 | + $this->registerArgument('data', 'array', 'Data for the content object', FALSE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |