@@ -15,12 +15,10 @@ discard block |
||
15 | 15 | use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; |
16 | 16 | use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
17 | 17 | |
18 | -class StdWrapViewHelper extends AbstractViewHelper |
|
19 | -{ |
|
18 | +class StdWrapViewHelper extends AbstractViewHelper { |
|
20 | 19 | protected $escapeOutput = false; |
21 | 20 | |
22 | - public function initializeArguments() |
|
23 | - { |
|
21 | + public function initializeArguments() { |
|
24 | 22 | parent::initializeArguments(); |
25 | 23 | $this->registerArgument('wrap', 'string', 'The wrap information', true); |
26 | 24 | $this->registerArgument('data', 'array', 'Data for the content object', false); |
@@ -31,8 +29,7 @@ discard block |
||
31 | 29 | * |
32 | 30 | * @return string |
33 | 31 | */ |
34 | - public function render() |
|
35 | - { |
|
32 | + public function render() { |
|
36 | 33 | $wrap = $this->arguments['wrap']; |
37 | 34 | $data = $this->arguments['data'] ?? []; |
38 | 35 |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | use SimpleXMLElement; |
13 | 13 | use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; |
14 | 14 | |
15 | -class OaiPmhTest extends FunctionalTestCase |
|
16 | -{ |
|
15 | +class OaiPmhTest extends FunctionalTestCase { |
|
17 | 16 | protected $disableJsonWrappedResponse = true; |
18 | 17 | |
19 | 18 | protected $coreExtensionsToLoad = [ |
@@ -53,8 +52,7 @@ discard block |
||
53 | 52 | $this->setUpOaiSolr(); |
54 | 53 | } |
55 | 54 | |
56 | - protected function setUpOaiSolr() |
|
57 | - { |
|
55 | + protected function setUpOaiSolr() { |
|
58 | 56 | // Setup Solr only once for all tests in this suite |
59 | 57 | static $solr = null; |
60 | 58 | |
@@ -74,8 +72,7 @@ discard block |
||
74 | 72 | /** |
75 | 73 | * @test |
76 | 74 | */ |
77 | - public function correctlyRespondsOnBadVerb() |
|
78 | - { |
|
75 | + public function correctlyRespondsOnBadVerb() { |
|
79 | 76 | $client = new HttpClient(); |
80 | 77 | $response = $client->get($this->baseUrl, [ |
81 | 78 | 'query' => [ |
@@ -100,8 +97,7 @@ discard block |
||
100 | 97 | /** |
101 | 98 | * @test |
102 | 99 | */ |
103 | - public function canIdentify() |
|
104 | - { |
|
100 | + public function canIdentify() { |
|
105 | 101 | $oai = Endpoint::build($this->oaiUrl); |
106 | 102 | $identity = $oai->identify(); |
107 | 103 | |
@@ -114,8 +110,7 @@ discard block |
||
114 | 110 | /** |
115 | 111 | * @test |
116 | 112 | */ |
117 | - public function identifyGivesFallbackDatestampWhenNoDocuments() |
|
118 | - { |
|
113 | + public function identifyGivesFallbackDatestampWhenNoDocuments() { |
|
119 | 114 | $oai = Endpoint::build($this->oaiUrlNoStoragePid); |
120 | 115 | $identity = $oai->identify(); |
121 | 116 | |
@@ -125,8 +120,7 @@ discard block |
||
125 | 120 | /** |
126 | 121 | * @test |
127 | 122 | */ |
128 | - public function canListMetadataFormats() |
|
129 | - { |
|
123 | + public function canListMetadataFormats() { |
|
130 | 124 | $oai = Endpoint::build($this->oaiUrl); |
131 | 125 | $formats = $oai->listMetadataFormats(); |
132 | 126 | |
@@ -141,8 +135,7 @@ discard block |
||
141 | 135 | /** |
142 | 136 | * @test |
143 | 137 | */ |
144 | - public function canListRecords() |
|
145 | - { |
|
138 | + public function canListRecords() { |
|
146 | 139 | $oai = Endpoint::build($this->oaiUrl); |
147 | 140 | $result = $oai->listRecords('mets'); |
148 | 141 | |
@@ -155,8 +148,7 @@ discard block |
||
155 | 148 | /** |
156 | 149 | * @test |
157 | 150 | */ |
158 | - public function noRecordsUntil1900() |
|
159 | - { |
|
151 | + public function noRecordsUntil1900() { |
|
160 | 152 | $this->expectException(OaipmhException::class); |
161 | 153 | $this->expectExceptionMessage('empty list'); |
162 | 154 | |
@@ -169,8 +161,7 @@ discard block |
||
169 | 161 | /** |
170 | 162 | * @test |
171 | 163 | */ |
172 | - public function canUseResumptionToken() |
|
173 | - { |
|
164 | + public function canUseResumptionToken() { |
|
174 | 165 | // NOTE: cursor and expirationDate are optional by the specification, |
175 | 166 | // but we include them in our implementation |
176 | 167 | |
@@ -228,8 +219,7 @@ discard block |
||
228 | 219 | /** |
229 | 220 | * @test |
230 | 221 | */ |
231 | - public function noResumptionTokenForCompleteList() |
|
232 | - { |
|
222 | + public function noResumptionTokenForCompleteList() { |
|
233 | 223 | $client = new HttpClient(); |
234 | 224 | |
235 | 225 | foreach (['ListIdentifiers', 'ListRecords'] as $verb) { |
@@ -251,8 +241,7 @@ discard block |
||
251 | 241 | /** |
252 | 242 | * @test |
253 | 243 | */ |
254 | - public function canListAndResumeIdentifiers() |
|
255 | - { |
|
244 | + public function canListAndResumeIdentifiers() { |
|
256 | 245 | $oai = Endpoint::build($this->oaiUrl); |
257 | 246 | $result = $oai->listIdentifiers('mets'); |
258 | 247 | |
@@ -265,18 +254,15 @@ discard block |
||
265 | 254 | $this->assertEquals('oai:de:slub-dresden:db:id-476248086', $record->identifier); |
266 | 255 | } |
267 | 256 | |
268 | - protected function parseUtc(string $dateTime) |
|
269 | - { |
|
257 | + protected function parseUtc(string $dateTime) { |
|
270 | 258 | return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $dateTime); |
271 | 259 | } |
272 | 260 | |
273 | - protected function assertUtcDateString(string $dateTime) |
|
274 | - { |
|
261 | + protected function assertUtcDateString(string $dateTime) { |
|
275 | 262 | $this->assertInstanceOf(DateTime::class, $this->parseUtc($dateTime)); |
276 | 263 | } |
277 | 264 | |
278 | - protected function assertInFuture(string $dateTime) |
|
279 | - { |
|
265 | + protected function assertInFuture(string $dateTime) { |
|
280 | 266 | $this->assertGreaterThan(new DateTime(), $this->parseUtc($dateTime)); |
281 | 267 | } |
282 | 268 | } |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | use TYPO3\CMS\Extbase\Object\ObjectManager; |
17 | 17 | use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; |
18 | 18 | |
19 | -class SolrIndexingTest extends FunctionalTestCase |
|
20 | -{ |
|
19 | +class SolrIndexingTest extends FunctionalTestCase { |
|
21 | 20 | /** @var PersistenceManager */ |
22 | 21 | protected $persistenceManager; |
23 | 22 | |
@@ -51,8 +50,7 @@ discard block |
||
51 | 50 | /** |
52 | 51 | * @test |
53 | 52 | */ |
54 | - public function canCreateCore() |
|
55 | - { |
|
53 | + public function canCreateCore() { |
|
56 | 54 | $coreName = uniqid('testCore'); |
57 | 55 | $solr = Solr::getInstance($coreName); |
58 | 56 | $this->assertNull($solr->core); |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | /** |
68 | 66 | * @test |
69 | 67 | */ |
70 | - public function canIndexAndSearchDocument() |
|
71 | - { |
|
68 | + public function canIndexAndSearchDocument() { |
|
72 | 69 | $core = $this->createSolrCore(); |
73 | 70 | |
74 | 71 | $document = $this->documentRepository->findByUid(1001); |
@@ -108,8 +105,7 @@ discard block |
||
108 | 105 | /** |
109 | 106 | * @test |
110 | 107 | */ |
111 | - public function canSearchInCollections() |
|
112 | - { |
|
108 | + public function canSearchInCollections() { |
|
113 | 109 | $core = $this->createSolrCore(); |
114 | 110 | |
115 | 111 | $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_fulltext.xml'); |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | * @subpackage dlf |
25 | 25 | * @access public |
26 | 26 | */ |
27 | -class TableOfContentsController extends AbstractController |
|
28 | -{ |
|
27 | +class TableOfContentsController extends AbstractController { |
|
29 | 28 | /** |
30 | 29 | * This holds the active entries according to the currently selected page |
31 | 30 | * |
@@ -44,8 +43,7 @@ discard block |
||
44 | 43 | * |
45 | 44 | * @return array HMENU array for menu entry |
46 | 45 | */ |
47 | - protected function getMenuEntry(array $entry, $recursive = false) |
|
48 | - { |
|
46 | + protected function getMenuEntry(array $entry, $recursive = false) { |
|
49 | 47 | $entry = $this->resolveMenuEntry($entry); |
50 | 48 | |
51 | 49 | $entryArray = []; |
@@ -139,8 +137,7 @@ discard block |
||
139 | 137 | * @param array $entry |
140 | 138 | * @return array |
141 | 139 | */ |
142 | - protected function resolveMenuEntry($entry) |
|
143 | - { |
|
140 | + protected function resolveMenuEntry($entry) { |
|
144 | 141 | // If the menu entry points to the parent document, |
145 | 142 | // resolve to the parent UID set on indexation. |
146 | 143 | $doc = $this->document->getDoc(); |
@@ -161,8 +158,7 @@ discard block |
||
161 | 158 | * |
162 | 159 | * @return void |
163 | 160 | */ |
164 | - public function mainAction() |
|
165 | - { |
|
161 | + public function mainAction() { |
|
166 | 162 | $this->view->assign('toc', $this->makeMenuArray()); |
167 | 163 | } |
168 | 164 | |
@@ -172,8 +168,7 @@ discard block |
||
172 | 168 | * @access public |
173 | 169 | * @return array HMENU array |
174 | 170 | */ |
175 | - public function makeMenuArray() |
|
176 | - { |
|
171 | + public function makeMenuArray() { |
|
177 | 172 | // Load current document. |
178 | 173 | $this->loadDocument($this->requestData); |
179 | 174 | if ( |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | * @subpackage dlf |
27 | 27 | * @access public |
28 | 28 | */ |
29 | -class CalendarController extends AbstractController |
|
30 | -{ |
|
29 | +class CalendarController extends AbstractController { |
|
31 | 30 | /** |
32 | 31 | * @var StructureRepository |
33 | 32 | */ |
@@ -36,8 +35,7 @@ discard block |
||
36 | 35 | /** |
37 | 36 | * @param StructureRepository $structureRepository |
38 | 37 | */ |
39 | - public function injectStructureRepository(StructureRepository $structureRepository) |
|
40 | - { |
|
38 | + public function injectStructureRepository(StructureRepository $structureRepository) { |
|
41 | 39 | $this->structureRepository = $structureRepository; |
42 | 40 | } |
43 | 41 | |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | * |
55 | 53 | * @return void |
56 | 54 | */ |
57 | - public function mainAction() |
|
58 | - { |
|
55 | + public function mainAction() { |
|
59 | 56 | // Set initial document (anchor or year file) if configured. |
60 | 57 | if (empty($this->requestData['id']) && !empty($this->settings['initialDocument'])) { |
61 | 58 | $this->requestData['id'] = $this->settings['initialDocument']; |
@@ -100,8 +97,7 @@ discard block |
||
100 | 97 | * |
101 | 98 | * @return void |
102 | 99 | */ |
103 | - public function calendarAction() |
|
104 | - { |
|
100 | + public function calendarAction() { |
|
105 | 101 | // access arguments passed by the mainAction() |
106 | 102 | $mainrequestData = $this->request->getArguments(); |
107 | 103 | |
@@ -206,8 +202,7 @@ discard block |
||
206 | 202 | * |
207 | 203 | * @return void |
208 | 204 | */ |
209 | - public function yearsAction() |
|
210 | - { |
|
205 | + public function yearsAction() { |
|
211 | 206 | // access arguments passed by the mainAction() |
212 | 207 | $mainrequestData = $this->request->getArguments(); |
213 | 208 | |
@@ -262,8 +257,7 @@ discard block |
||
262 | 257 | * |
263 | 258 | * @return string Content for template subpart |
264 | 259 | */ |
265 | - protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12) |
|
266 | - { |
|
260 | + protected function getCalendarYear(&$calendarData, $calendarIssuesByMonth, $year, $firstMonth = 1, $lastMonth = 12) { |
|
267 | 261 | for ($i = $firstMonth; $i <= $lastMonth; $i++) { |
268 | 262 | $key = $year . '-' . $i; |
269 | 263 |
@@ -21,13 +21,11 @@ |
||
21 | 21 | * @subpackage dlf |
22 | 22 | * @access public |
23 | 23 | */ |
24 | -class View3DController extends AbstractController |
|
25 | -{ |
|
24 | +class View3DController extends AbstractController { |
|
26 | 25 | /** |
27 | 26 | * @return string|void |
28 | 27 | */ |
29 | - public function mainAction() |
|
30 | - { |
|
28 | + public function mainAction() { |
|
31 | 29 | $this->cObj = $this->configurationManager->getContentObject(); |
32 | 30 | // Load current document. |
33 | 31 | $this->loadDocument($this->requestData); |
@@ -35,8 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @return void |
37 | 37 | */ |
38 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
39 | - { |
|
38 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
40 | 39 | $xml->registerXPathNamespace('audiomd', 'http://www.loc.gov/audioMD/'); |
41 | 40 | $xml->registerXPathNamespace('videomd', 'http://www.loc.gov/videoMD/'); |
42 | 41 |
@@ -49,8 +49,7 @@ discard block |
||
49 | 49 | * @property-read string $toplevelId This holds the toplevel structure's "@ID" (METS) or the manifest's "@id" (IIIF) |
50 | 50 | * @abstract |
51 | 51 | */ |
52 | -abstract class Doc |
|
53 | -{ |
|
52 | +abstract class Doc { |
|
54 | 53 | /** |
55 | 54 | * This holds the logger |
56 | 55 | * |
@@ -326,8 +325,7 @@ discard block |
||
326 | 325 | * |
327 | 326 | * @return void |
328 | 327 | */ |
329 | - public static function clearRegistry() |
|
330 | - { |
|
328 | + public static function clearRegistry() { |
|
331 | 329 | // Reset registry array. |
332 | 330 | self::$registry = []; |
333 | 331 | } |
@@ -505,8 +503,7 @@ discard block |
||
505 | 503 | * |
506 | 504 | * @return int The physical page number |
507 | 505 | */ |
508 | - public function getPhysicalPage($logicalPage) |
|
509 | - { |
|
506 | + public function getPhysicalPage($logicalPage) { |
|
510 | 507 | if ( |
511 | 508 | !empty($this->lastSearchedPhysicalPage['logicalPage']) |
512 | 509 | && $this->lastSearchedPhysicalPage['logicalPage'] == $logicalPage |
@@ -551,8 +548,7 @@ discard block |
||
551 | 548 | * |
552 | 549 | * @return string The OCR full text |
553 | 550 | */ |
554 | - protected function getFullTextFromXml($id) |
|
555 | - { |
|
551 | + protected function getFullTextFromXml($id) { |
|
556 | 552 | $fullText = ''; |
557 | 553 | // Load available text formats, ... |
558 | 554 | $this->loadFormats(); |
@@ -614,8 +610,7 @@ discard block |
||
614 | 610 | * |
615 | 611 | * @return string The format of the OCR full text |
616 | 612 | */ |
617 | - private function getTextFormat($fileContent) |
|
618 | - { |
|
613 | + private function getTextFormat($fileContent) { |
|
619 | 614 | $xml = Helper::getXmlFileAsString($fileContent); |
620 | 615 | |
621 | 616 | if ($xml !== false) { |
@@ -638,8 +633,7 @@ discard block |
||
638 | 633 | * |
639 | 634 | * @return string The title of the document itself or a parent document |
640 | 635 | */ |
641 | - public static function getTitle($uid, $recursive = false) |
|
642 | - { |
|
636 | + public static function getTitle($uid, $recursive = false) { |
|
643 | 637 | $title = ''; |
644 | 638 | // Sanitize input. |
645 | 639 | $uid = max(intval($uid), 0); |
@@ -691,8 +685,7 @@ discard block |
||
691 | 685 | * |
692 | 686 | * @return array The logical structure node's / resource's parsed metadata array |
693 | 687 | */ |
694 | - public function getTitledata($cPid = 0) |
|
695 | - { |
|
688 | + public function getTitledata($cPid = 0) { |
|
696 | 689 | $titledata = $this->getMetadata($this->_getToplevelId(), $cPid); |
697 | 690 | // Add information from METS structural map to titledata array. |
698 | 691 | if ($this instanceof MetsDocument) { |
@@ -725,8 +718,7 @@ discard block |
||
725 | 718 | * @return int|bool: false if structure with $logId is not a child of this substructure, |
726 | 719 | * or the actual depth. |
727 | 720 | */ |
728 | - protected function getTreeDepth($structure, $depth, $logId) |
|
729 | - { |
|
721 | + protected function getTreeDepth($structure, $depth, $logId) { |
|
730 | 722 | foreach ($structure as $element) { |
731 | 723 | if ($element['id'] == $logId) { |
732 | 724 | return $depth; |
@@ -748,8 +740,7 @@ discard block |
||
748 | 740 | * @param string $logId: The id of the logical structure element whose depth is requested |
749 | 741 | * @return int|bool tree depth as integer or false if no element with $logId exists within the TOC. |
750 | 742 | */ |
751 | - public function getStructureDepth($logId) |
|
752 | - { |
|
743 | + public function getStructureDepth($logId) { |
|
753 | 744 | return $this->getTreeDepth($this->_getTableOfContents(), 1, $logId); |
754 | 745 | } |
755 | 746 | |
@@ -801,8 +792,7 @@ discard block |
||
801 | 792 | * |
802 | 793 | * @return bool true on success or false on failure |
803 | 794 | */ |
804 | - protected function load($location) |
|
805 | - { |
|
795 | + protected function load($location) { |
|
806 | 796 | // Load XML / JSON-LD file. |
807 | 797 | if (GeneralUtility::isValidUrl($location)) { |
808 | 798 | // the actual loading is format specific |
@@ -829,8 +819,7 @@ discard block |
||
829 | 819 | * |
830 | 820 | * @return void |
831 | 821 | */ |
832 | - protected function loadFormats() |
|
833 | - { |
|
822 | + protected function loadFormats() { |
|
834 | 823 | if (!$this->formatsLoaded) { |
835 | 824 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
836 | 825 | ->getQueryBuilderForTable('tx_dlf_formats'); |
@@ -870,8 +859,7 @@ discard block |
||
870 | 859 | * |
871 | 860 | * @return void |
872 | 861 | */ |
873 | - public function registerNamespaces(&$obj) |
|
874 | - { |
|
862 | + public function registerNamespaces(&$obj) { |
|
875 | 863 | // TODO Check usage. XML specific method does not seem to be used anywhere outside this class within the project, but it is public and may be used by extensions. |
876 | 864 | $this->loadFormats(); |
877 | 865 | // Do we have a \SimpleXMLElement or \DOMXPath object? |
@@ -896,8 +884,7 @@ discard block |
||
896 | 884 | * |
897 | 885 | * @return int The PID of the metadata definitions |
898 | 886 | */ |
899 | - protected function _getCPid() |
|
900 | - { |
|
887 | + protected function _getCPid() { |
|
901 | 888 | return $this->cPid; |
902 | 889 | } |
903 | 890 | |
@@ -908,8 +895,7 @@ discard block |
||
908 | 895 | * |
909 | 896 | * @return bool Are there any fulltext files available? |
910 | 897 | */ |
911 | - protected function _getHasFulltext() |
|
912 | - { |
|
898 | + protected function _getHasFulltext() { |
|
913 | 899 | $this->ensureHasFulltextIsSet(); |
914 | 900 | return $this->hasFulltext; |
915 | 901 | } |
@@ -921,8 +907,7 @@ discard block |
||
921 | 907 | * |
922 | 908 | * @return string The location of the document |
923 | 909 | */ |
924 | - protected function _getLocation() |
|
925 | - { |
|
910 | + protected function _getLocation() { |
|
926 | 911 | return $this->location; |
927 | 912 | } |
928 | 913 | |
@@ -944,8 +929,7 @@ discard block |
||
944 | 929 | * |
945 | 930 | * @return array Array of metadata with their corresponding logical structure node ID as key |
946 | 931 | */ |
947 | - protected function _getMetadataArray() |
|
948 | - { |
|
932 | + protected function _getMetadataArray() { |
|
949 | 933 | // Set metadata definitions' PID. |
950 | 934 | $cPid = ($this->cPid ? $this->cPid : $this->pid); |
951 | 935 | if (!$cPid) { |
@@ -970,8 +954,7 @@ discard block |
||
970 | 954 | * |
971 | 955 | * @return int The total number of pages and/or tracks |
972 | 956 | */ |
973 | - protected function _getNumPages() |
|
974 | - { |
|
957 | + protected function _getNumPages() { |
|
975 | 958 | $this->_getPhysicalStructure(); |
976 | 959 | return $this->numPages; |
977 | 960 | } |
@@ -983,8 +966,7 @@ discard block |
||
983 | 966 | * |
984 | 967 | * @return int The UID of the parent document or zero if not applicable |
985 | 968 | */ |
986 | - protected function _getParentId() |
|
987 | - { |
|
969 | + protected function _getParentId() { |
|
988 | 970 | return $this->parentId; |
989 | 971 | } |
990 | 972 | |
@@ -1007,8 +989,7 @@ discard block |
||
1007 | 989 | * |
1008 | 990 | * @return array Array of elements' type, label and file representations ordered by "@ID" attribute / Canvas order |
1009 | 991 | */ |
1010 | - protected function _getPhysicalStructureInfo() |
|
1011 | - { |
|
992 | + protected function _getPhysicalStructureInfo() { |
|
1012 | 993 | // Is there no physical structure array yet? |
1013 | 994 | if (!$this->physicalStructureLoaded) { |
1014 | 995 | // Build physical structure array. |
@@ -1024,8 +1005,7 @@ discard block |
||
1024 | 1005 | * |
1025 | 1006 | * @return int The PID of the document or zero if not in database |
1026 | 1007 | */ |
1027 | - protected function _getPid() |
|
1028 | - { |
|
1008 | + protected function _getPid() { |
|
1029 | 1009 | return $this->pid; |
1030 | 1010 | } |
1031 | 1011 | |
@@ -1036,8 +1016,7 @@ discard block |
||
1036 | 1016 | * |
1037 | 1017 | * @return bool Is the document instantiated successfully? |
1038 | 1018 | */ |
1039 | - protected function _getReady() |
|
1040 | - { |
|
1019 | + protected function _getReady() { |
|
1041 | 1020 | return $this->ready; |
1042 | 1021 | } |
1043 | 1022 | |
@@ -1048,8 +1027,7 @@ discard block |
||
1048 | 1027 | * |
1049 | 1028 | * @return mixed The METS file's / IIIF manifest's record identifier |
1050 | 1029 | */ |
1051 | - protected function _getRecordId() |
|
1052 | - { |
|
1030 | + protected function _getRecordId() { |
|
1053 | 1031 | return $this->recordId; |
1054 | 1032 | } |
1055 | 1033 | |
@@ -1060,8 +1038,7 @@ discard block |
||
1060 | 1038 | * |
1061 | 1039 | * @return int The UID of the root document or zero if not applicable |
1062 | 1040 | */ |
1063 | - protected function _getRootId() |
|
1064 | - { |
|
1041 | + protected function _getRootId() { |
|
1065 | 1042 | if (!$this->rootIdLoaded) { |
1066 | 1043 | if ($this->parentId) { |
1067 | 1044 | $parent = self::getInstance($this->parentId, ['storagePid' => $this->pid]); |
@@ -1091,8 +1068,7 @@ discard block |
||
1091 | 1068 | * |
1092 | 1069 | * @return array Array of structure nodes' id, label, type and physical page indexes/mptr / Canvas link with original hierarchy preserved |
1093 | 1070 | */ |
1094 | - protected function _getTableOfContents() |
|
1095 | - { |
|
1071 | + protected function _getTableOfContents() { |
|
1096 | 1072 | // Is there no logical structure array yet? |
1097 | 1073 | if (!$this->tableOfContentsLoaded) { |
1098 | 1074 | // Get all logical structures. |
@@ -1133,8 +1109,7 @@ discard block |
||
1133 | 1109 | * |
1134 | 1110 | * @return mixed The UID or the URL of the document |
1135 | 1111 | */ |
1136 | - protected function _getUid() |
|
1137 | - { |
|
1112 | + protected function _getUid() { |
|
1138 | 1113 | return $this->uid; |
1139 | 1114 | } |
1140 | 1115 | |
@@ -1147,8 +1122,7 @@ discard block |
||
1147 | 1122 | * |
1148 | 1123 | * @return void |
1149 | 1124 | */ |
1150 | - protected function _setCPid($value) |
|
1151 | - { |
|
1125 | + protected function _setCPid($value) { |
|
1152 | 1126 | $this->cPid = max(intval($value), 0); |
1153 | 1127 | } |
1154 | 1128 | |
@@ -1165,8 +1139,7 @@ discard block |
||
1165 | 1139 | * |
1166 | 1140 | * @return void |
1167 | 1141 | */ |
1168 | - protected function __construct($location, $pid, $preloadedDocument) |
|
1169 | - { |
|
1142 | + protected function __construct($location, $pid, $preloadedDocument) { |
|
1170 | 1143 | $this->pid = $pid; |
1171 | 1144 | $this->setPreloadedDocument($preloadedDocument); |
1172 | 1145 | $this->init($location); |
@@ -1183,8 +1156,7 @@ discard block |
||
1183 | 1156 | * |
1184 | 1157 | * @return mixed Value of $this->$var |
1185 | 1158 | */ |
1186 | - public function __get($var) |
|
1187 | - { |
|
1159 | + public function __get($var) { |
|
1188 | 1160 | $method = '_get' . ucfirst($var); |
1189 | 1161 | if ( |
1190 | 1162 | !property_exists($this, $var) |
@@ -1206,8 +1178,7 @@ discard block |
||
1206 | 1178 | * |
1207 | 1179 | * @return bool true if variable is set and not empty, false otherwise |
1208 | 1180 | */ |
1209 | - public function __isset($var) |
|
1210 | - { |
|
1181 | + public function __isset($var) { |
|
1211 | 1182 | return !empty($this->__get($var)); |
1212 | 1183 | } |
1213 | 1184 | |
@@ -1221,8 +1192,7 @@ discard block |
||
1221 | 1192 | * |
1222 | 1193 | * @return void |
1223 | 1194 | */ |
1224 | - public function __set($var, $value) |
|
1225 | - { |
|
1195 | + public function __set($var, $value) { |
|
1226 | 1196 | $method = '_set' . ucfirst($var); |
1227 | 1197 | if ( |
1228 | 1198 | !property_exists($this, $var) |
@@ -1240,8 +1210,7 @@ discard block |
||
1240 | 1210 | * @param string $location |
1241 | 1211 | * @return Doc|false |
1242 | 1212 | */ |
1243 | - private static function getDocCache(string $location) |
|
1244 | - { |
|
1213 | + private static function getDocCache(string $location) { |
|
1245 | 1214 | $cacheIdentifier = md5($location); |
1246 | 1215 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1247 | 1216 | $cacheHit = $cache->get($cacheIdentifier); |
@@ -1256,8 +1225,7 @@ discard block |
||
1256 | 1225 | * @param Doc $doc |
1257 | 1226 | * @return void |
1258 | 1227 | */ |
1259 | - private static function setDocCache(string $location, Doc $doc) |
|
1260 | - { |
|
1228 | + private static function setDocCache(string $location, Doc $doc) { |
|
1261 | 1229 | $cacheIdentifier = md5($location); |
1262 | 1230 | $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_doc'); |
1263 | 1231 |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | * @property-read string $toplevelId This holds the toplevel structure's @ID (METS) or the manifest's @id (IIIF) |
51 | 51 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
52 | 52 | */ |
53 | -final class MetsDocument extends Doc |
|
54 | -{ |
|
53 | +final class MetsDocument extends Doc { |
|
55 | 54 | /** |
56 | 55 | * Subsections / tags that may occur within `<mets:amdSec>`. |
57 | 56 | * |
@@ -176,8 +175,7 @@ discard block |
||
176 | 175 | * |
177 | 176 | * @return void |
178 | 177 | */ |
179 | - public function addMetadataFromMets(&$metadata, $id) |
|
180 | - { |
|
178 | + public function addMetadataFromMets(&$metadata, $id) { |
|
181 | 179 | $details = $this->getLogicalStructure($id); |
182 | 180 | if (!empty($details)) { |
183 | 181 | $metadata['mets_order'][0] = $details['order']; |
@@ -191,8 +189,7 @@ discard block |
||
191 | 189 | * {@inheritDoc} |
192 | 190 | * @see \Kitodo\Dlf\Common\Doc::establishRecordId() |
193 | 191 | */ |
194 | - protected function establishRecordId($pid) |
|
195 | - { |
|
192 | + protected function establishRecordId($pid) { |
|
196 | 193 | // Check for METS object @ID. |
197 | 194 | if (!empty($this->mets['OBJID'])) { |
198 | 195 | $this->recordId = (string) $this->mets['OBJID']; |
@@ -212,8 +209,7 @@ discard block |
||
212 | 209 | * {@inheritDoc} |
213 | 210 | * @see \Kitodo\Dlf\Common\Doc::getDownloadLocation() |
214 | 211 | */ |
215 | - public function getDownloadLocation($id) |
|
216 | - { |
|
212 | + public function getDownloadLocation($id) { |
|
217 | 213 | $fileMimeType = $this->getFileMimeType($id); |
218 | 214 | $fileLocation = $this->getFileLocation($id); |
219 | 215 | if ($fileMimeType === 'application/vnd.kitodo.iiif') { |
@@ -238,8 +234,7 @@ discard block |
||
238 | 234 | * {@inheritDoc} |
239 | 235 | * @see \Kitodo\Dlf\Common\Doc::getFileLocation() |
240 | 236 | */ |
241 | - public function getFileLocation($id) |
|
242 | - { |
|
237 | + public function getFileLocation($id) { |
|
243 | 238 | $location = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/mets:FLocat[@LOCTYPE="URL"]'); |
244 | 239 | if ( |
245 | 240 | !empty($id) |
@@ -256,8 +251,7 @@ discard block |
||
256 | 251 | * {@inheritDoc} |
257 | 252 | * @see \Kitodo\Dlf\Common\Doc::getFileMimeType() |
258 | 253 | */ |
259 | - public function getFileMimeType($id) |
|
260 | - { |
|
254 | + public function getFileMimeType($id) { |
|
261 | 255 | $mimetype = $this->mets->xpath('./mets:fileSec/mets:fileGrp/mets:file[@ID="' . $id . '"]/@MIMETYPE'); |
262 | 256 | if ( |
263 | 257 | !empty($id) |
@@ -274,8 +268,7 @@ discard block |
||
274 | 268 | * {@inheritDoc} |
275 | 269 | * @see \Kitodo\Dlf\Common\Doc::getLogicalStructure() |
276 | 270 | */ |
277 | - public function getLogicalStructure($id, $recursive = false) |
|
278 | - { |
|
271 | + public function getLogicalStructure($id, $recursive = false) { |
|
279 | 272 | $details = []; |
280 | 273 | // Is the requested logical unit already loaded? |
281 | 274 | if ( |
@@ -315,8 +308,7 @@ discard block |
||
315 | 308 | * |
316 | 309 | * @return array Array of the element's id, label, type and physical page indexes/mptr link |
317 | 310 | */ |
318 | - protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) |
|
319 | - { |
|
311 | + protected function getLogicalStructureInfo(\SimpleXMLElement $structure, $recursive = false) { |
|
320 | 312 | // Get attributes. |
321 | 313 | foreach ($structure->attributes() as $attribute => $value) { |
322 | 314 | $attributes[$attribute] = (string) $value; |
@@ -415,8 +407,7 @@ discard block |
||
415 | 407 | * {@inheritDoc} |
416 | 408 | * @see \Kitodo\Dlf\Common\Doc::getMetadata() |
417 | 409 | */ |
418 | - public function getMetadata($id, $cPid = 0) |
|
419 | - { |
|
410 | + public function getMetadata($id, $cPid = 0) { |
|
420 | 411 | // Make sure $cPid is a non-negative integer. |
421 | 412 | $cPid = max(intval($cPid), 0); |
422 | 413 | // If $cPid is not given, try to get it elsewhere. |
@@ -659,8 +650,7 @@ discard block |
||
659 | 650 | * @param string $id: The "@ID" attribute of the file node |
660 | 651 | * @return void |
661 | 652 | */ |
662 | - protected function getMetadataIds($id) |
|
663 | - { |
|
653 | + protected function getMetadataIds($id) { |
|
664 | 654 | // Load amdSecChildIds concordance |
665 | 655 | $this->_getMdSec(); |
666 | 656 | $this->_getFileInfos(); |
@@ -707,8 +697,7 @@ discard block |
||
707 | 697 | * {@inheritDoc} |
708 | 698 | * @see \Kitodo\Dlf\Common\Doc::getFullText() |
709 | 699 | */ |
710 | - public function getFullText($id) |
|
711 | - { |
|
700 | + public function getFullText($id) { |
|
712 | 701 | $fullText = ''; |
713 | 702 | |
714 | 703 | // Load fileGrps and check for full text files. |
@@ -723,8 +712,7 @@ discard block |
||
723 | 712 | * {@inheritDoc} |
724 | 713 | * @see Doc::getStructureDepth() |
725 | 714 | */ |
726 | - public function getStructureDepth($logId) |
|
727 | - { |
|
715 | + public function getStructureDepth($logId) { |
|
728 | 716 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
729 | 717 | if (!empty($ancestors)) { |
730 | 718 | return count($ancestors); |
@@ -737,8 +725,7 @@ discard block |
||
737 | 725 | * {@inheritDoc} |
738 | 726 | * @see \Kitodo\Dlf\Common\Doc::init() |
739 | 727 | */ |
740 | - protected function init($location) |
|
741 | - { |
|
728 | + protected function init($location) { |
|
742 | 729 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this)); |
743 | 730 | // Get METS node from XML file. |
744 | 731 | $this->registerNamespaces($this->xml); |
@@ -762,8 +749,7 @@ discard block |
||
762 | 749 | * {@inheritDoc} |
763 | 750 | * @see \Kitodo\Dlf\Common\Doc::loadLocation() |
764 | 751 | */ |
765 | - protected function loadLocation($location) |
|
766 | - { |
|
752 | + protected function loadLocation($location) { |
|
767 | 753 | $fileResource = Helper::getUrl($location); |
768 | 754 | if ($fileResource !== false) { |
769 | 755 | $xml = Helper::getXmlFileAsString($fileResource); |
@@ -781,8 +767,7 @@ discard block |
||
781 | 767 | * {@inheritDoc} |
782 | 768 | * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet() |
783 | 769 | */ |
784 | - protected function ensureHasFulltextIsSet() |
|
785 | - { |
|
770 | + protected function ensureHasFulltextIsSet() { |
|
786 | 771 | // Are the fileGrps already loaded? |
787 | 772 | if (!$this->fileGrpsLoaded) { |
788 | 773 | $this->_getFileGrps(); |
@@ -793,8 +778,7 @@ discard block |
||
793 | 778 | * {@inheritDoc} |
794 | 779 | * @see Doc::setPreloadedDocument() |
795 | 780 | */ |
796 | - protected function setPreloadedDocument($preloadedDocument) |
|
797 | - { |
|
781 | + protected function setPreloadedDocument($preloadedDocument) { |
|
798 | 782 | |
799 | 783 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
800 | 784 | $this->xml = $preloadedDocument; |
@@ -807,8 +791,7 @@ discard block |
||
807 | 791 | * {@inheritDoc} |
808 | 792 | * @see Doc::getDocument() |
809 | 793 | */ |
810 | - protected function getDocument() |
|
811 | - { |
|
794 | + protected function getDocument() { |
|
812 | 795 | return $this->mets; |
813 | 796 | } |
814 | 797 | |
@@ -819,8 +802,7 @@ discard block |
||
819 | 802 | * |
820 | 803 | * @return array Array of metadata sections with their IDs as array key |
821 | 804 | */ |
822 | - protected function _getMdSec() |
|
823 | - { |
|
805 | + protected function _getMdSec() { |
|
824 | 806 | if (!$this->mdSecLoaded) { |
825 | 807 | $this->loadFormats(); |
826 | 808 | |
@@ -862,8 +844,7 @@ discard block |
||
862 | 844 | return $this->mdSec; |
863 | 845 | } |
864 | 846 | |
865 | - protected function _getDmdSec() |
|
866 | - { |
|
847 | + protected function _getDmdSec() { |
|
867 | 848 | $this->_getMdSec(); |
868 | 849 | return $this->dmdSec; |
869 | 850 | } |
@@ -877,8 +858,7 @@ discard block |
||
877 | 858 | * |
878 | 859 | * @return array|null The processed metadata section |
879 | 860 | */ |
880 | - protected function processMdSec($element) |
|
881 | - { |
|
861 | + protected function processMdSec($element) { |
|
882 | 862 | $mdId = (string) $element->attributes()->ID; |
883 | 863 | if (empty($mdId)) { |
884 | 864 | return null; |
@@ -918,8 +898,7 @@ discard block |
||
918 | 898 | * |
919 | 899 | * @return array Array of file use groups with file IDs |
920 | 900 | */ |
921 | - protected function _getFileGrps() |
|
922 | - { |
|
901 | + protected function _getFileGrps() { |
|
923 | 902 | if (!$this->fileGrpsLoaded) { |
924 | 903 | // Get configured USE attributes. |
925 | 904 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -971,8 +950,7 @@ discard block |
||
971 | 950 | * @access protected |
972 | 951 | * @return array |
973 | 952 | */ |
974 | - protected function _getFileInfos() |
|
975 | - { |
|
953 | + protected function _getFileInfos() { |
|
976 | 954 | $this->_getFileGrps(); |
977 | 955 | return $this->fileInfos; |
978 | 956 | } |
@@ -981,8 +959,7 @@ discard block |
||
981 | 959 | * {@inheritDoc} |
982 | 960 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
983 | 961 | */ |
984 | - protected function prepareMetadataArray($cPid) |
|
985 | - { |
|
962 | + protected function prepareMetadataArray($cPid) { |
|
986 | 963 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
987 | 964 | // Get all logical structure nodes with metadata. |
988 | 965 | if (!empty($ids)) { |
@@ -1000,8 +977,7 @@ discard block |
||
1000 | 977 | * |
1001 | 978 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
1002 | 979 | */ |
1003 | - protected function _getMets() |
|
1004 | - { |
|
980 | + protected function _getMets() { |
|
1005 | 981 | return $this->mets; |
1006 | 982 | } |
1007 | 983 | |
@@ -1009,8 +985,7 @@ discard block |
||
1009 | 985 | * {@inheritDoc} |
1010 | 986 | * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure() |
1011 | 987 | */ |
1012 | - protected function _getPhysicalStructure() |
|
1013 | - { |
|
988 | + protected function _getPhysicalStructure() { |
|
1014 | 989 | // Is there no physical structure array yet? |
1015 | 990 | if (!$this->physicalStructureLoaded) { |
1016 | 991 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -1072,8 +1047,7 @@ discard block |
||
1072 | 1047 | * {@inheritDoc} |
1073 | 1048 | * @see \Kitodo\Dlf\Common\Doc::_getSmLinks() |
1074 | 1049 | */ |
1075 | - protected function _getSmLinks() |
|
1076 | - { |
|
1050 | + protected function _getSmLinks() { |
|
1077 | 1051 | if (!$this->smLinksLoaded) { |
1078 | 1052 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
1079 | 1053 | if (!empty($smLinks)) { |
@@ -1091,8 +1065,7 @@ discard block |
||
1091 | 1065 | * {@inheritDoc} |
1092 | 1066 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
1093 | 1067 | */ |
1094 | - protected function _getThumbnail($forceReload = false) |
|
1095 | - { |
|
1068 | + protected function _getThumbnail($forceReload = false) { |
|
1096 | 1069 | if ( |
1097 | 1070 | !$this->thumbnailLoaded |
1098 | 1071 | || $forceReload |
@@ -1171,8 +1144,7 @@ discard block |
||
1171 | 1144 | * {@inheritDoc} |
1172 | 1145 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
1173 | 1146 | */ |
1174 | - protected function _getToplevelId() |
|
1175 | - { |
|
1147 | + protected function _getToplevelId() { |
|
1176 | 1148 | if (empty($this->toplevelId)) { |
1177 | 1149 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
1178 | 1150 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1201,8 +1173,7 @@ discard block |
||
1201 | 1173 | * |
1202 | 1174 | * @return string|null |
1203 | 1175 | */ |
1204 | - public function _getParentHref() |
|
1205 | - { |
|
1176 | + public function _getParentHref() { |
|
1206 | 1177 | if ($this->parentHref === null) { |
1207 | 1178 | $this->parentHref = ''; |
1208 | 1179 | |
@@ -1224,8 +1195,7 @@ discard block |
||
1224 | 1195 | * |
1225 | 1196 | * @return array Properties to be serialized |
1226 | 1197 | */ |
1227 | - public function __sleep() |
|
1228 | - { |
|
1198 | + public function __sleep() { |
|
1229 | 1199 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
1230 | 1200 | $this->asXML = $this->xml->asXML(); |
1231 | 1201 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1238,8 +1208,7 @@ discard block |
||
1238 | 1208 | * |
1239 | 1209 | * @return string String representing the METS object |
1240 | 1210 | */ |
1241 | - public function __toString() |
|
1242 | - { |
|
1211 | + public function __toString() { |
|
1243 | 1212 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1244 | 1213 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
1245 | 1214 | $xml->formatOutput = true; |
@@ -1254,8 +1223,7 @@ discard block |
||
1254 | 1223 | * |
1255 | 1224 | * @return void |
1256 | 1225 | */ |
1257 | - public function __wakeup() |
|
1258 | - { |
|
1226 | + public function __wakeup() { |
|
1259 | 1227 | $xml = Helper::getXmlFileAsString($this->asXML); |
1260 | 1228 | if ($xml !== false) { |
1261 | 1229 | $this->asXML = ''; |