We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | // Add filter query for date search |
213 | 213 | if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) { |
214 | 214 | // combine dateFrom and dateTo into range search |
215 | - $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
215 | + $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}' . $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']'; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | // Add filter query for faceting. |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | $virtualCollectionsQueryString = ''; |
244 | 244 | foreach ($this->collection as $collectionEntry) { |
245 | 245 | // check for virtual collections query string |
246 | - if($collectionEntry->getIndexSearch()) { |
|
247 | - $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR ('. $collectionEntry->getIndexSearch() . ')' ; |
|
246 | + if ($collectionEntry->getIndexSearch()) { |
|
247 | + $virtualCollectionsQueryString .= empty($virtualCollectionsQueryString) ? '(' . $collectionEntry->getIndexSearch() . ')' : ' OR (' . $collectionEntry->getIndexSearch() . ')'; |
|
248 | 248 | } else { |
249 | 249 | $collectionsQueryString .= empty($collectionsQueryString) ? '"' . $collectionEntry->getIndexName() . '"' : ' OR "' . $collectionEntry->getIndexName() . '"'; |
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | 253 | // distinguish between simple collection browsing and actual searching within the collection(s) |
254 | - if(!empty($collectionsQueryString)) { |
|
255 | - if(empty($query)) { |
|
254 | + if (!empty($collectionsQueryString)) { |
|
255 | + if (empty($query)) { |
|
256 | 256 | $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . ') AND toplevel:true AND partof:0)'; |
257 | 257 | } else { |
258 | 258 | $collectionsQueryString = '(collection_faceting:(' . $collectionsQueryString . '))'; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | // virtual collections might query documents that are neither toplevel:true nor partof:0 and need to be searched separatly |
263 | - if(!empty($virtualCollectionsQueryString)) { |
|
263 | + if (!empty($virtualCollectionsQueryString)) { |
|
264 | 264 | $virtualCollectionsQueryString = '(' . $virtualCollectionsQueryString . ')'; |
265 | 265 | } |
266 | 266 | |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | } |
338 | 338 | if ($documents[$doc['uid']]) { |
339 | 339 | // translate language code if applicable |
340 | - if($doc['metadata']['language']) { |
|
341 | - foreach($doc['metadata']['language'] as $indexName => $language) { |
|
340 | + if ($doc['metadata']['language']) { |
|
341 | + foreach ($doc['metadata']['language'] as $indexName => $language) { |
|
342 | 342 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]); |
343 | 343 | } |
344 | 344 | } |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | |
439 | 439 | foreach ($result['documents'] as $doc) { |
440 | 440 | // translate language code if applicable |
441 | - if($doc['metadata']['language']) { |
|
442 | - foreach($doc['metadata']['language'] as $indexName => $language) { |
|
441 | + if ($doc['metadata']['language']) { |
|
442 | + foreach ($doc['metadata']['language'] as $indexName => $language) { |
|
443 | 443 | $doc['metadata']['language'][$indexName] = Helper::getLanguageName($doc['metadata']['language'][$indexName]); |
444 | 444 | } |
445 | 445 | } |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function extractAuthorsIfNoAutRoleTermAssigned(): void |
52 | 52 | { |
53 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsAuthorNoAutRoleTerm.xml'); |
|
53 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsAuthorNoAutRoleTerm.xml'); |
|
54 | 54 | $mods = new Mods(); |
55 | 55 | |
56 | - $mods->extractMetadata($xml,$this->metadata); |
|
56 | + $mods->extractMetadata($xml, $this->metadata); |
|
57 | 57 | |
58 | 58 | $this->assertEquals( |
59 | 59 | [ |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function extractAuthorsWithAutRoleTermAssigned(): void |
72 | 72 | { |
73 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsAuthorWithAutRoleTerm.xml'); |
|
73 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsAuthorWithAutRoleTerm.xml'); |
|
74 | 74 | $mods = new Mods(); |
75 | 75 | |
76 | - $mods->extractMetadata($xml,$this->metadata); |
|
76 | + $mods->extractMetadata($xml, $this->metadata); |
|
77 | 77 | $this->assertEquals( |
78 | 78 | [ |
79 | 79 | 'May, Jack, I', |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function extractPlaces(): void |
94 | 94 | { |
95 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml'); |
|
95 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml'); |
|
96 | 96 | $mods = new Mods(); |
97 | 97 | |
98 | - $mods->extractMetadata($xml,$this->metadata); |
|
98 | + $mods->extractMetadata($xml, $this->metadata); |
|
99 | 99 | |
100 | 100 | $this->assertEquals( |
101 | 101 | [ |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function extractYears(): void |
123 | 123 | { |
124 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml'); |
|
124 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfo.xml'); |
|
125 | 125 | $mods = new Mods(); |
126 | 126 | |
127 | - $mods->extractMetadata($xml,$this->metadata); |
|
127 | + $mods->extractMetadata($xml, $this->metadata); |
|
128 | 128 | |
129 | 129 | $this->assertEquals( |
130 | 130 | [ |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function extractPlacesWithElectronicEdInside(): void |
152 | 152 | { |
153 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectonicEd.xml'); |
|
153 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectonicEd.xml'); |
|
154 | 154 | $mods = new Mods(); |
155 | 155 | |
156 | - $mods->extractMetadata($xml,$this->metadata); |
|
156 | + $mods->extractMetadata($xml, $this->metadata); |
|
157 | 157 | |
158 | 158 | $this->assertEquals( |
159 | 159 | [ |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function extractYearsWithElectronicEdInside(): void |
181 | 181 | { |
182 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectonicEd.xml'); |
|
182 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/modsOriginInfoWithEditionElectonicEd.xml'); |
|
183 | 183 | $mods = new Mods(); |
184 | 184 | |
185 | - $mods->extractMetadata($xml,$this->metadata); |
|
185 | + $mods->extractMetadata($xml, $this->metadata); |
|
186 | 186 | |
187 | 187 | $this->assertEquals( |
188 | 188 | [ |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Kitodo\Dlf\Tests\Unit\Format; |
4 | 4 | |
5 | -use Kitodo\Dlf\Format\TeiHeader ; |
|
5 | +use Kitodo\Dlf\Format\TeiHeader; |
|
6 | 6 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
7 | 7 | |
8 | 8 | class TeiHeaderTest extends UnitTestCase |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function canExtractVideoDuration(): void |
28 | 28 | { |
29 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/audioVideo.xml'); |
|
29 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/audioVideo.xml'); |
|
30 | 30 | $audioVideoMD = new AudioVideoMD(); |
31 | 31 | |
32 | 32 | $videoXml = $xml->xpath('//videomd:VIDEOMD')[0]; |
33 | 33 | |
34 | - $audioVideoMD->extractMetadata($videoXml,$this->metadata); |
|
34 | + $audioVideoMD->extractMetadata($videoXml, $this->metadata); |
|
35 | 35 | |
36 | 36 | $this->assertEquals( |
37 | 37 | ["00:01:30.07"], |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function canExtractAudioDuration(): void |
57 | 57 | { |
58 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/audioVideo.xml'); |
|
58 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/audioVideo.xml'); |
|
59 | 59 | $audioVideoMD = new AudioVideoMD(); |
60 | 60 | |
61 | 61 | $audioXml = $xml->xpath('//audiomd:AUDIOMD')[0]; |
62 | 62 | |
63 | - $audioVideoMD->extractMetadata($audioXml,$this->metadata); |
|
63 | + $audioVideoMD->extractMetadata($audioXml, $this->metadata); |
|
64 | 64 | |
65 | 65 | $this->assertEquals( |
66 | 66 | ["01:10:35.08"], |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function noDuration(): void |
86 | 86 | { |
87 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/audioVideo.xml'); |
|
87 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/audioVideo.xml'); |
|
88 | 88 | $audioVideoMD = new AudioVideoMD(); |
89 | 89 | |
90 | 90 | $videoXml = $xml->xpath('//audiomd:AUDIOMD')[1]; |
91 | 91 | |
92 | - $audioVideoMD->extractMetadata($videoXml,$this->metadata); |
|
92 | + $audioVideoMD->extractMetadata($videoXml, $this->metadata); |
|
93 | 93 | |
94 | 94 | $this->assertEquals( |
95 | 95 | [], |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function getRawData(): void |
15 | 15 | { |
16 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/alto.xml'); |
|
16 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/alto.xml'); |
|
17 | 17 | $alto = new Alto(); |
18 | 18 | |
19 | 19 | $rawText = $alto->getRawText($xml); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function getTextAsMiniOcr(): void |
29 | 29 | { |
30 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/alto.xml'); |
|
30 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/alto.xml'); |
|
31 | 31 | $alto = new Alto(); |
32 | 32 | |
33 | 33 | $rawText = $alto->getTextAsMiniOcr($xml); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getTextAsMiniOcrNoTextBlock(): void |
67 | 67 | { |
68 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/altoNoTextBlock.xml'); |
|
68 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/altoNoTextBlock.xml'); |
|
69 | 69 | $alto = new Alto(); |
70 | 70 | |
71 | 71 | $rawText = $alto->getTextAsMiniOcr($xml); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getTextAsMiniOcrNoTextline(): void |
81 | 81 | { |
82 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/altoNoTextLine.xml'); |
|
82 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/altoNoTextLine.xml'); |
|
83 | 83 | $alto = new Alto(); |
84 | 84 | |
85 | 85 | $rawText = $alto->getTextAsMiniOcr($xml); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getTextAsMiniOcrNoString(): void |
95 | 95 | { |
96 | - $xml = simplexml_load_file( __DIR__ . '/../../Fixtures/Format/altoNoString.xml'); |
|
96 | + $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/Format/altoNoString.xml'); |
|
97 | 97 | $alto = new Alto(); |
98 | 98 | |
99 | 99 | $rawText = $alto->getTextAsMiniOcr($xml); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
338 | 338 | $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
339 | 339 | // verify date formatting |
340 | - if(strtotime($metadata['date'][0])) { |
|
340 | + if (strtotime($metadata['date'][0])) { |
|
341 | 341 | // do not alter dates YYYY or YYYY-MM or YYYY-MM-DD |
342 | 342 | if ( |
343 | 343 | preg_match("/^[\d]{4}$/", $metadata['date'][0]) |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | ) { |
347 | 347 | $solrDoc->setField('date', $metadata['date'][0]); |
348 | 348 | // change date YYYYMMDD to YYYY-MM-DD |
349 | - } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])){ |
|
349 | + } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])) { |
|
350 | 350 | $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0]))); |
351 | 351 | // convert any datetime to proper ISO extended datetime format and timezone for SOLR |
352 | 352 | } else { |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | !empty($data) |
485 | 485 | && substr($index_name, -8) == '_sorting' |
486 | 486 | ) { |
487 | - $solrDoc->setField($index_name , $doc->metadataArray[$doc->toplevelId][$index_name]); |
|
487 | + $solrDoc->setField($index_name, $doc->metadataArray[$doc->toplevelId][$index_name]); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | foreach ($year['children'] as $month) { |
128 | 128 | foreach ($month['children'] as $day) { |
129 | 129 | foreach ($day['children'] as $issue) { |
130 | - $title = $issue['label'] ?: $issue['orderlabel']; |
|
130 | + $title = $issue['label'] ? : $issue['orderlabel']; |
|
131 | 131 | if (strtotime($title) !== false) { |
132 | 132 | $title = strftime('%x', strtotime($title)); |
133 | 133 | } |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | $this->view->assign('calendarData', $calendarData); |
219 | 219 | $this->view->assign('documentId', $this->document->getUid()); |
220 | 220 | $this->view->assign('yearLinkTitle', $yearLinkTitle); |
221 | - $this->view->assign('parentDocumentId', $this->document->getPartof() ?: $this->document->getDoc()->tableOfContents[0]['points']); |
|
222 | - $this->view->assign('allYearDocTitle', $this->document->getDoc()->getTitle($this->document->getPartof()) ?: $this->document->getDoc()->tableOfContents[0]['label']); |
|
221 | + $this->view->assign('parentDocumentId', $this->document->getPartof() ? : $this->document->getDoc()->tableOfContents[0]['points']); |
|
222 | + $this->view->assign('allYearDocTitle', $this->document->getDoc()->getTitle($this->document->getPartof()) ? : $this->document->getDoc()->tableOfContents[0]['label']); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | if (empty($yearLabel)) { |
257 | 257 | // if neither order nor orderlabel is set, use the id... |
258 | - $yearLabel = (string)$id; |
|
258 | + $yearLabel = (string) $id; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | $years[] = [ |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if (is_int($key)) { |
295 | 295 | $yearFilled[] = $yearArray[$key]; |
296 | 296 | } else { |
297 | - $yearFilled[] = ['title' => $min+$i, 'documentId' => '']; |
|
297 | + $yearFilled[] = ['title' => $min + $i, 'documentId' => '']; |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | $yearArray = $yearFilled; |