@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | * @subpackage dlf |
32 | 32 | * @access public |
33 | 33 | */ |
34 | -class BasketController extends AbstractController |
|
35 | -{ |
|
34 | +class BasketController extends AbstractController { |
|
36 | 35 | /** |
37 | 36 | * @var BasketRepository |
38 | 37 | */ |
@@ -41,8 +40,7 @@ discard block |
||
41 | 40 | /** |
42 | 41 | * @param BasketRepository $basketRepository |
43 | 42 | */ |
44 | - public function injectBasketRepository(BasketRepository $basketRepository) |
|
45 | - { |
|
43 | + public function injectBasketRepository(BasketRepository $basketRepository) { |
|
46 | 44 | $this->basketRepository = $basketRepository; |
47 | 45 | } |
48 | 46 | |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | /** |
55 | 53 | * @param MailRepository $mailRepository |
56 | 54 | */ |
57 | - public function injectMailRepository(MailRepository $mailRepository) |
|
58 | - { |
|
55 | + public function injectMailRepository(MailRepository $mailRepository) { |
|
59 | 56 | $this->mailRepository = $mailRepository; |
60 | 57 | } |
61 | 58 | |
@@ -67,8 +64,7 @@ discard block |
||
67 | 64 | /** |
68 | 65 | * @param PrinterRepository $printerRepository |
69 | 66 | */ |
70 | - public function injectPrinterRepository(PrinterRepository $printerRepository) |
|
71 | - { |
|
67 | + public function injectPrinterRepository(PrinterRepository $printerRepository) { |
|
72 | 68 | $this->printerRepository = $printerRepository; |
73 | 69 | } |
74 | 70 | |
@@ -80,8 +76,7 @@ discard block |
||
80 | 76 | /** |
81 | 77 | * @param ActionLogRepository $actionLogRepository |
82 | 78 | */ |
83 | - public function injectActionLogRepository(ActionLogRepository $actionLogRepository) |
|
84 | - { |
|
79 | + public function injectActionLogRepository(ActionLogRepository $actionLogRepository) { |
|
85 | 80 | $this->actionLogRepository = $actionLogRepository; |
86 | 81 | } |
87 | 82 | |
@@ -90,8 +85,7 @@ discard block |
||
90 | 85 | * |
91 | 86 | * @return void |
92 | 87 | */ |
93 | - public function basketAction() |
|
94 | - { |
|
88 | + public function basketAction() { |
|
95 | 89 | $basket = $this->getBasketData(); |
96 | 90 | |
97 | 91 | // action remove from basket |
@@ -137,8 +131,7 @@ discard block |
||
137 | 131 | * |
138 | 132 | * @return void |
139 | 133 | */ |
140 | - public function addAction() |
|
141 | - { |
|
134 | + public function addAction() { |
|
142 | 135 | $basket = $this->getBasketData(); |
143 | 136 | |
144 | 137 | if ( |
@@ -156,8 +149,7 @@ discard block |
||
156 | 149 | * |
157 | 150 | * @return void |
158 | 151 | */ |
159 | - public function mainAction() |
|
160 | - { |
|
152 | + public function mainAction() { |
|
161 | 153 | $basket = $this->getBasketData(); |
162 | 154 | |
163 | 155 | $countDocs = 0; |
@@ -203,8 +195,7 @@ discard block |
||
203 | 195 | * |
204 | 196 | * @return Basket The found data from user session. |
205 | 197 | */ |
206 | - protected function getBasketData() |
|
207 | - { |
|
198 | + protected function getBasketData() { |
|
208 | 199 | // get user session |
209 | 200 | $sessionId = $GLOBALS['TSFE']->fe_user->id; |
210 | 201 | |
@@ -238,8 +229,7 @@ discard block |
||
238 | 229 | * |
239 | 230 | * @return string One basket entry |
240 | 231 | */ |
241 | - protected function getEntry($data) |
|
242 | - { |
|
232 | + protected function getEntry($data) { |
|
243 | 233 | if (is_object($data)) { |
244 | 234 | $data = get_object_vars($data); |
245 | 235 | } |
@@ -291,8 +281,7 @@ discard block |
||
291 | 281 | * |
292 | 282 | * @return mixed download url or false |
293 | 283 | */ |
294 | - protected function getDocumentData($id, $data) |
|
295 | - { |
|
284 | + protected function getDocumentData($id, $data) { |
|
296 | 285 | // get document instance to load further information |
297 | 286 | $this->loadDocument(['id' => $id]); |
298 | 287 | if ($this->document) { |
@@ -360,8 +349,7 @@ discard block |
||
360 | 349 | * |
361 | 350 | * @return array Basket data and JavaScript output |
362 | 351 | */ |
363 | - protected function addToBasket($_piVars, $basket) |
|
364 | - { |
|
352 | + protected function addToBasket($_piVars, $basket) { |
|
365 | 353 | $output = ''; |
366 | 354 | |
367 | 355 | if (!$_piVars['startpage']) { |
@@ -468,8 +456,7 @@ discard block |
||
468 | 456 | * |
469 | 457 | * @return Basket basket |
470 | 458 | */ |
471 | - protected function removeFromBasket($_piVars, $basket) |
|
472 | - { |
|
459 | + protected function removeFromBasket($_piVars, $basket) { |
|
473 | 460 | if (!empty($basket->getDocIds())) { |
474 | 461 | $items = json_decode($basket->getDocIds()); |
475 | 462 | $items = get_object_vars($items); |
@@ -507,8 +494,7 @@ discard block |
||
507 | 494 | * |
508 | 495 | * @return void |
509 | 496 | */ |
510 | - protected function sendMail() |
|
511 | - { |
|
497 | + protected function sendMail() { |
|
512 | 498 | // send mail |
513 | 499 | $mailId = $this->requestData['mail_action']; |
514 | 500 | |
@@ -585,8 +571,7 @@ discard block |
||
585 | 571 | * |
586 | 572 | * @return void |
587 | 573 | */ |
588 | - protected function printDocument($basket) |
|
589 | - { |
|
574 | + protected function printDocument($basket) { |
|
590 | 575 | $pdfUrl = $this->settings['pdfprint']; |
591 | 576 | $numberOfPages = 0; |
592 | 577 | foreach ($this->requestData['selected'] as $docId => $docValue) { |
@@ -46,8 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @return void |
48 | 48 | */ |
49 | - public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) |
|
50 | - { |
|
49 | + public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) { |
|
51 | 50 | $this->xml = $xml; |
52 | 51 | $this->metadata = $metadata; |
53 | 52 |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class Indexer |
|
36 | -{ |
|
35 | +class Indexer { |
|
37 | 36 | /** |
38 | 37 | * The extension key |
39 | 38 | * |
@@ -93,8 +92,7 @@ discard block |
||
93 | 92 | * |
94 | 93 | * @return bool true on success or false on failure |
95 | 94 | */ |
96 | - public static function add(Document $document) |
|
97 | - { |
|
95 | + public static function add(Document $document) { |
|
98 | 96 | if (in_array($document->getUid(), self::$processedDocs)) { |
99 | 97 | return true; |
100 | 98 | } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) { |
@@ -209,8 +207,7 @@ discard block |
||
209 | 207 | * |
210 | 208 | * @return string The field's dynamic index name |
211 | 209 | */ |
212 | - public static function getIndexFieldName($index_name, $pid = 0) |
|
213 | - { |
|
210 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
214 | 211 | // Sanitize input. |
215 | 212 | $pid = max(intval($pid), 0); |
216 | 213 | if (!$pid) { |
@@ -236,8 +233,7 @@ discard block |
||
236 | 233 | * |
237 | 234 | * @return void |
238 | 235 | */ |
239 | - protected static function loadIndexConf($pid) |
|
240 | - { |
|
236 | + protected static function loadIndexConf($pid) { |
|
241 | 237 | if (!self::$fieldsLoaded) { |
242 | 238 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
243 | 239 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
@@ -307,8 +303,7 @@ discard block |
||
307 | 303 | * |
308 | 304 | * @return bool true on success or false on failure |
309 | 305 | */ |
310 | - protected static function processLogical(Document $document, array $logicalUnit) |
|
311 | - { |
|
306 | + protected static function processLogical(Document $document, array $logicalUnit) { |
|
312 | 307 | $success = true; |
313 | 308 | $doc = $document->getDoc(); |
314 | 309 | $doc->cPid = $document->getPid(); |
@@ -346,7 +341,7 @@ discard block |
||
346 | 341 | ) { |
347 | 342 | $solrDoc->setField('date', $metadata['date'][0]); |
348 | 343 | // change date YYYYMMDD to YYYY-MM-DD |
349 | - } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])){ |
|
344 | + } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])) { |
|
350 | 345 | $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0]))); |
351 | 346 | // convert any datetime to proper ISO extended datetime format and timezone for SOLR |
352 | 347 | } else { |
@@ -439,8 +434,7 @@ discard block |
||
439 | 434 | * |
440 | 435 | * @return bool true on success or false on failure |
441 | 436 | */ |
442 | - protected static function processPhysical(Document $document, $page, array $physicalUnit) |
|
443 | - { |
|
437 | + protected static function processPhysical(Document $document, $page, array $physicalUnit) { |
|
444 | 438 | $doc = $document->getDoc(); |
445 | 439 | $doc->cPid = $document->getPid(); |
446 | 440 | if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) { |
@@ -518,8 +512,7 @@ discard block |
||
518 | 512 | * |
519 | 513 | * @return bool true on success or false on failure |
520 | 514 | */ |
521 | - protected static function solrConnect($core, $pid = 0) |
|
522 | - { |
|
515 | + protected static function solrConnect($core, $pid = 0) { |
|
523 | 516 | // Get Solr instance. |
524 | 517 | if (!self::$solr) { |
525 | 518 | // Connect to Solr server. |
@@ -588,8 +581,7 @@ discard block |
||
588 | 581 | * |
589 | 582 | * @access private |
590 | 583 | */ |
591 | - private function __construct() |
|
592 | - { |
|
584 | + private function __construct() { |
|
593 | 585 | // This is a static class, thus no instances should be created. |
594 | 586 | } |
595 | 587 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Client |
|
29 | -{ |
|
28 | +class Client { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * @param RequestFactory $requestFactory a request object to inject |
64 | 63 | * @return void |
65 | 64 | **/ |
66 | - public function __construct($viaf, RequestFactory $requestFactory) |
|
67 | - { |
|
65 | + public function __construct($viaf, RequestFactory $requestFactory) { |
|
68 | 66 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | 67 | $this->viafUrl = 'http://viaf.org/viaf/' . $viaf; |
70 | 68 | $this->requestFactory = $requestFactory; |
@@ -86,8 +84,7 @@ discard block |
||
86 | 84 | * |
87 | 85 | * @return object|bool |
88 | 86 | **/ |
89 | - public function getData() |
|
90 | - { |
|
87 | + public function getData() { |
|
91 | 88 | $url = $this->getApiEndpoint(); |
92 | 89 | try { |
93 | 90 | $response = $this->requestFactory->request($url); |
@@ -103,8 +100,7 @@ discard block |
||
103 | 100 | * |
104 | 101 | * @return string |
105 | 102 | **/ |
106 | - protected function getApiEndpoint() |
|
107 | - { |
|
103 | + protected function getApiEndpoint() { |
|
108 | 104 | return $this->viafUrl . '/' . $this->endpoint; |
109 | 105 | } |
110 | 106 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Profile |
|
29 | -{ |
|
28 | +class Profile { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -57,8 +56,7 @@ discard block |
||
57 | 56 | * |
58 | 57 | * @return void |
59 | 58 | **/ |
60 | - public function __construct($orcid) |
|
61 | - { |
|
59 | + public function __construct($orcid) { |
|
62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
63 | 61 | $this->client = new Client($orcid, GeneralUtility::makeInstance(RequestFactory::class)); |
64 | 62 | } |
@@ -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('person'); |
74 | 71 | if (!empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -88,8 +85,7 @@ discard block |
||
88 | 85 | * |
89 | 86 | * @return string|false |
90 | 87 | **/ |
91 | - public function getAddress() |
|
92 | - { |
|
88 | + public function getAddress() { |
|
93 | 89 | $this->getRaw('address'); |
94 | 90 | if (!empty($this->raw)) { |
95 | 91 | $this->raw->registerXPathNamespace('address', 'http://www.orcid.org/ns/address'); |
@@ -105,8 +101,7 @@ discard block |
||
105 | 101 | * |
106 | 102 | * @return string|false |
107 | 103 | **/ |
108 | - public function getEmail() |
|
109 | - { |
|
104 | + public function getEmail() { |
|
110 | 105 | $this->getRaw('email'); |
111 | 106 | if (!empty($this->raw)) { |
112 | 107 | $this->raw->registerXPathNamespace('email', 'http://www.orcid.org/ns/email'); |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | * |
123 | 118 | * @return string|false |
124 | 119 | **/ |
125 | - public function getFullName() |
|
126 | - { |
|
120 | + public function getFullName() { |
|
127 | 121 | $this->getRaw('personal-details'); |
128 | 122 | if (!empty($this->raw)) { |
129 | 123 | $this->raw->registerXPathNamespace('personal-details', 'http://www.orcid.org/ns/personal-details'); |
@@ -143,8 +137,7 @@ discard block |
||
143 | 137 | * |
144 | 138 | * @return void |
145 | 139 | **/ |
146 | - protected function getRaw($endpoint) |
|
147 | - { |
|
140 | + protected function getRaw($endpoint) { |
|
148 | 141 | $this->client->setEndpoint($endpoint); |
149 | 142 | $data = $this->client->getData(); |
150 | 143 | if (!isset($this->raw) && $data != false) { |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Client |
|
29 | -{ |
|
28 | +class Client { |
|
30 | 29 | /** |
31 | 30 | * constants for API endpoint |
32 | 31 | **/ |
@@ -76,8 +75,7 @@ discard block |
||
76 | 75 | * @param RequestFactory $requestFactory a request object to inject |
77 | 76 | * @return void |
78 | 77 | **/ |
79 | - public function __construct($orcid, RequestFactory $requestFactory) |
|
80 | - { |
|
78 | + public function __construct($orcid, RequestFactory $requestFactory) { |
|
81 | 79 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
82 | 80 | $this->orcid = $orcid; |
83 | 81 | $this->requestFactory = $requestFactory; |
@@ -99,8 +97,7 @@ discard block |
||
99 | 97 | * |
100 | 98 | * @return object|bool |
101 | 99 | **/ |
102 | - public function getData() |
|
103 | - { |
|
100 | + public function getData() { |
|
104 | 101 | $url = $this->getApiEndpoint(); |
105 | 102 | try { |
106 | 103 | $response = $this->requestFactory->request($url); |
@@ -116,8 +113,7 @@ discard block |
||
116 | 113 | * |
117 | 114 | * @return string |
118 | 115 | **/ |
119 | - private function getApiEndpoint() |
|
120 | - { |
|
116 | + private function getApiEndpoint() { |
|
121 | 117 | $url = 'https://' . $this->level . '.' . self::HOSTNAME; |
122 | 118 | $url .= '/v' . self::VERSION . '/'; |
123 | 119 | $url .= $this->orcid; |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @subpackage dlf |
26 | 26 | * @access public |
27 | 27 | **/ |
28 | -class Profile |
|
29 | -{ |
|
28 | +class Profile { |
|
30 | 29 | /** |
31 | 30 | * This holds the logger |
32 | 31 | * |
@@ -57,8 +56,7 @@ discard block |
||
57 | 56 | * |
58 | 57 | * @return void |
59 | 58 | **/ |
60 | - public function __construct($viaf) |
|
61 | - { |
|
59 | + public function __construct($viaf) { |
|
62 | 60 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
63 | 61 | $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class)); |
64 | 62 | } |
@@ -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 (!empty($this->raw)) { |
75 | 72 | $data = []; |
@@ -87,8 +84,7 @@ discard block |
||
87 | 84 | * |
88 | 85 | * @return string|false |
89 | 86 | **/ |
90 | - public function getAddress() |
|
91 | - { |
|
87 | + public function getAddress() { |
|
92 | 88 | $this->getRaw(); |
93 | 89 | if (!empty($this->raw->asXML())) { |
94 | 90 | return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0]; |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | * |
104 | 100 | * @return string|false |
105 | 101 | **/ |
106 | - public function getFullName() |
|
107 | - { |
|
102 | + public function getFullName() { |
|
108 | 103 | $this->getRaw(); |
109 | 104 | if (!empty($this->raw->asXML())) { |
110 | 105 | $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text'); |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | * |
123 | 118 | * @return void |
124 | 119 | **/ |
125 | - protected function getRaw() |
|
126 | - { |
|
120 | + protected function getRaw() { |
|
127 | 121 | $data = $this->client->getData(); |
128 | 122 | if (!isset($this->raw) && $data != false) { |
129 | 123 | $this->raw = Helper::getXmlFileAsString($data); |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | * @subpackage dlf |
30 | 30 | * @access public |
31 | 31 | */ |
32 | -class MetadataController extends AbstractController |
|
33 | -{ |
|
32 | +class MetadataController extends AbstractController { |
|
34 | 33 | /** |
35 | 34 | * @var CollectionRepository |
36 | 35 | */ |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | /** |
40 | 39 | * @param CollectionRepository $collectionRepository |
41 | 40 | */ |
42 | - public function injectCollectionRepository(CollectionRepository $collectionRepository) |
|
43 | - { |
|
41 | + public function injectCollectionRepository(CollectionRepository $collectionRepository) { |
|
44 | 42 | $this->collectionRepository = $collectionRepository; |
45 | 43 | } |
46 | 44 | |
@@ -52,8 +50,7 @@ discard block |
||
52 | 50 | /** |
53 | 51 | * @param MetadataRepository $metadataRepository |
54 | 52 | */ |
55 | - public function injectMetadataRepository(MetadataRepository $metadataRepository) |
|
56 | - { |
|
53 | + public function injectMetadataRepository(MetadataRepository $metadataRepository) { |
|
57 | 54 | $this->metadataRepository = $metadataRepository; |
58 | 55 | } |
59 | 56 | |
@@ -65,16 +62,14 @@ discard block |
||
65 | 62 | /** |
66 | 63 | * @param StructureRepository $structureRepository |
67 | 64 | */ |
68 | - public function injectStructureRepository(StructureRepository $structureRepository) |
|
69 | - { |
|
65 | + public function injectStructureRepository(StructureRepository $structureRepository) { |
|
70 | 66 | $this->structureRepository = $structureRepository; |
71 | 67 | } |
72 | 68 | |
73 | 69 | /** |
74 | 70 | * @return string|void |
75 | 71 | */ |
76 | - public function mainAction() |
|
77 | - { |
|
72 | + public function mainAction() { |
|
78 | 73 | $this->cObj = $this->configurationManager->getContentObject(); |
79 | 74 | |
80 | 75 | // Load current document. |
@@ -130,8 +125,7 @@ discard block |
||
130 | 125 | * |
131 | 126 | * @return string The metadata array ready for output |
132 | 127 | */ |
133 | - protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) |
|
134 | - { |
|
128 | + protected function printMetadata(array $metadata, $useOriginalIiifManifestMetadata = false) { |
|
135 | 129 | if ($useOriginalIiifManifestMetadata) { |
136 | 130 | $iiifData = []; |
137 | 131 | foreach ($metadata as $row) { |
@@ -269,8 +263,7 @@ discard block |
||
269 | 263 | } |
270 | 264 | |
271 | 265 | if (is_array($metadata[$i][$name])) { |
272 | - $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) |
|
273 | - { |
|
266 | + $metadata[$i][$name] = array_values(array_filter($metadata[$i][$name], function($metadataValue) { |
|
274 | 267 | return !empty($metadataValue); |
275 | 268 | })); |
276 | 269 | } |
@@ -294,8 +287,7 @@ discard block |
||
294 | 287 | * |
295 | 288 | * @return array metadata |
296 | 289 | */ |
297 | - private function getMetadata() |
|
298 | - { |
|
290 | + private function getMetadata() { |
|
299 | 291 | $metadata = []; |
300 | 292 | if ($this->settings['rootline'] < 2) { |
301 | 293 | // Get current structure's @ID. |
@@ -333,8 +325,7 @@ discard block |
||
333 | 325 | * |
334 | 326 | * @return array metadata |
335 | 327 | */ |
336 | - private function getMetadataForIds($id, $metadata) |
|
337 | - { |
|
328 | + private function getMetadataForIds($id, $metadata) { |
|
338 | 329 | $useOriginalIiifManifestMetadata = $this->settings['originalIiifMetadata'] == 1 && $this->document->getDoc() instanceof IiifManifest; |
339 | 330 | foreach ($id as $sid) { |
340 | 331 | if ($useOriginalIiifManifestMetadata) { |
@@ -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; |
@@ -420,8 +412,7 @@ discard block |
||
420 | 412 | * {@inheritDoc} |
421 | 413 | * @see \Kitodo\Dlf\Common\Doc::getMetadata() |
422 | 414 | */ |
423 | - public function getMetadata($id, $cPid = 0) |
|
424 | - { |
|
415 | + public function getMetadata($id, $cPid = 0) { |
|
425 | 416 | // Make sure $cPid is a non-negative integer. |
426 | 417 | $cPid = max(intval($cPid), 0); |
427 | 418 | // If $cPid is not given, try to get it elsewhere. |
@@ -675,8 +666,7 @@ discard block |
||
675 | 666 | * @param string $id: The "@ID" attribute of the file node |
676 | 667 | * @return void |
677 | 668 | */ |
678 | - protected function getMetadataIds($id) |
|
679 | - { |
|
669 | + protected function getMetadataIds($id) { |
|
680 | 670 | // Load amdSecChildIds concordance |
681 | 671 | $this->_getMdSec(); |
682 | 672 | $this->_getFileInfos(); |
@@ -723,8 +713,7 @@ discard block |
||
723 | 713 | * {@inheritDoc} |
724 | 714 | * @see \Kitodo\Dlf\Common\Doc::getFullText() |
725 | 715 | */ |
726 | - public function getFullText($id) |
|
727 | - { |
|
716 | + public function getFullText($id) { |
|
728 | 717 | $fullText = ''; |
729 | 718 | |
730 | 719 | // Load fileGrps and check for full text files. |
@@ -739,8 +728,7 @@ discard block |
||
739 | 728 | * {@inheritDoc} |
740 | 729 | * @see Doc::getStructureDepth() |
741 | 730 | */ |
742 | - public function getStructureDepth($logId) |
|
743 | - { |
|
731 | + public function getStructureDepth($logId) { |
|
744 | 732 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
745 | 733 | if (!empty($ancestors)) { |
746 | 734 | return count($ancestors); |
@@ -753,8 +741,7 @@ discard block |
||
753 | 741 | * {@inheritDoc} |
754 | 742 | * @see \Kitodo\Dlf\Common\Doc::init() |
755 | 743 | */ |
756 | - protected function init($location) |
|
757 | - { |
|
744 | + protected function init($location) { |
|
758 | 745 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_class($this)); |
759 | 746 | // Get METS node from XML file. |
760 | 747 | $this->registerNamespaces($this->xml); |
@@ -778,8 +765,7 @@ discard block |
||
778 | 765 | * {@inheritDoc} |
779 | 766 | * @see \Kitodo\Dlf\Common\Doc::loadLocation() |
780 | 767 | */ |
781 | - protected function loadLocation($location) |
|
782 | - { |
|
768 | + protected function loadLocation($location) { |
|
783 | 769 | $fileResource = Helper::getUrl($location); |
784 | 770 | if ($fileResource !== false) { |
785 | 771 | $xml = Helper::getXmlFileAsString($fileResource); |
@@ -797,8 +783,7 @@ discard block |
||
797 | 783 | * {@inheritDoc} |
798 | 784 | * @see \Kitodo\Dlf\Common\Doc::ensureHasFulltextIsSet() |
799 | 785 | */ |
800 | - protected function ensureHasFulltextIsSet() |
|
801 | - { |
|
786 | + protected function ensureHasFulltextIsSet() { |
|
802 | 787 | // Are the fileGrps already loaded? |
803 | 788 | if (!$this->fileGrpsLoaded) { |
804 | 789 | $this->_getFileGrps(); |
@@ -809,8 +794,7 @@ discard block |
||
809 | 794 | * {@inheritDoc} |
810 | 795 | * @see Doc::setPreloadedDocument() |
811 | 796 | */ |
812 | - protected function setPreloadedDocument($preloadedDocument) |
|
813 | - { |
|
797 | + protected function setPreloadedDocument($preloadedDocument) { |
|
814 | 798 | |
815 | 799 | if ($preloadedDocument instanceof \SimpleXMLElement) { |
816 | 800 | $this->xml = $preloadedDocument; |
@@ -823,8 +807,7 @@ discard block |
||
823 | 807 | * {@inheritDoc} |
824 | 808 | * @see Doc::getDocument() |
825 | 809 | */ |
826 | - protected function getDocument() |
|
827 | - { |
|
810 | + protected function getDocument() { |
|
828 | 811 | return $this->mets; |
829 | 812 | } |
830 | 813 | |
@@ -835,8 +818,7 @@ discard block |
||
835 | 818 | * |
836 | 819 | * @return array Array of metadata sections with their IDs as array key |
837 | 820 | */ |
838 | - protected function _getMdSec() |
|
839 | - { |
|
821 | + protected function _getMdSec() { |
|
840 | 822 | if (!$this->mdSecLoaded) { |
841 | 823 | $this->loadFormats(); |
842 | 824 | |
@@ -878,8 +860,7 @@ discard block |
||
878 | 860 | return $this->mdSec; |
879 | 861 | } |
880 | 862 | |
881 | - protected function _getDmdSec() |
|
882 | - { |
|
863 | + protected function _getDmdSec() { |
|
883 | 864 | $this->_getMdSec(); |
884 | 865 | return $this->dmdSec; |
885 | 866 | } |
@@ -893,8 +874,7 @@ discard block |
||
893 | 874 | * |
894 | 875 | * @return array|null The processed metadata section |
895 | 876 | */ |
896 | - protected function processMdSec($element) |
|
897 | - { |
|
877 | + protected function processMdSec($element) { |
|
898 | 878 | $mdId = (string) $element->attributes()->ID; |
899 | 879 | if (empty($mdId)) { |
900 | 880 | return null; |
@@ -934,8 +914,7 @@ discard block |
||
934 | 914 | * |
935 | 915 | * @return array Array of file use groups with file IDs |
936 | 916 | */ |
937 | - protected function _getFileGrps() |
|
938 | - { |
|
917 | + protected function _getFileGrps() { |
|
939 | 918 | if (!$this->fileGrpsLoaded) { |
940 | 919 | // Get configured USE attributes. |
941 | 920 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey); |
@@ -987,8 +966,7 @@ discard block |
||
987 | 966 | * @access protected |
988 | 967 | * @return array |
989 | 968 | */ |
990 | - protected function _getFileInfos() |
|
991 | - { |
|
969 | + protected function _getFileInfos() { |
|
992 | 970 | $this->_getFileGrps(); |
993 | 971 | return $this->fileInfos; |
994 | 972 | } |
@@ -997,8 +975,7 @@ discard block |
||
997 | 975 | * {@inheritDoc} |
998 | 976 | * @see \Kitodo\Dlf\Common\Doc::prepareMetadataArray() |
999 | 977 | */ |
1000 | - protected function prepareMetadataArray($cPid) |
|
1001 | - { |
|
978 | + protected function prepareMetadataArray($cPid) { |
|
1002 | 979 | $ids = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID]/@ID'); |
1003 | 980 | // Get all logical structure nodes with metadata. |
1004 | 981 | if (!empty($ids)) { |
@@ -1016,8 +993,7 @@ discard block |
||
1016 | 993 | * |
1017 | 994 | * @return \SimpleXMLElement The XML's METS part as \SimpleXMLElement object |
1018 | 995 | */ |
1019 | - protected function _getMets() |
|
1020 | - { |
|
996 | + protected function _getMets() { |
|
1021 | 997 | return $this->mets; |
1022 | 998 | } |
1023 | 999 | |
@@ -1025,8 +1001,7 @@ discard block |
||
1025 | 1001 | * {@inheritDoc} |
1026 | 1002 | * @see \Kitodo\Dlf\Common\Doc::_getPhysicalStructure() |
1027 | 1003 | */ |
1028 | - protected function _getPhysicalStructure() |
|
1029 | - { |
|
1004 | + protected function _getPhysicalStructure() { |
|
1030 | 1005 | // Is there no physical structure array yet? |
1031 | 1006 | if (!$this->physicalStructureLoaded) { |
1032 | 1007 | // Does the document have a structMap node of type "PHYSICAL"? |
@@ -1088,8 +1063,7 @@ discard block |
||
1088 | 1063 | * {@inheritDoc} |
1089 | 1064 | * @see \Kitodo\Dlf\Common\Doc::_getSmLinks() |
1090 | 1065 | */ |
1091 | - protected function _getSmLinks() |
|
1092 | - { |
|
1066 | + protected function _getSmLinks() { |
|
1093 | 1067 | if (!$this->smLinksLoaded) { |
1094 | 1068 | $smLinks = $this->mets->xpath('./mets:structLink/mets:smLink'); |
1095 | 1069 | if (!empty($smLinks)) { |
@@ -1107,8 +1081,7 @@ discard block |
||
1107 | 1081 | * {@inheritDoc} |
1108 | 1082 | * @see \Kitodo\Dlf\Common\Doc::_getThumbnail() |
1109 | 1083 | */ |
1110 | - protected function _getThumbnail($forceReload = false) |
|
1111 | - { |
|
1084 | + protected function _getThumbnail($forceReload = false) { |
|
1112 | 1085 | if ( |
1113 | 1086 | !$this->thumbnailLoaded |
1114 | 1087 | || $forceReload |
@@ -1187,8 +1160,7 @@ discard block |
||
1187 | 1160 | * {@inheritDoc} |
1188 | 1161 | * @see \Kitodo\Dlf\Common\Doc::_getToplevelId() |
1189 | 1162 | */ |
1190 | - protected function _getToplevelId() |
|
1191 | - { |
|
1163 | + protected function _getToplevelId() { |
|
1192 | 1164 | if (empty($this->toplevelId)) { |
1193 | 1165 | // Get all logical structure nodes with metadata, but without associated METS-Pointers. |
1194 | 1166 | $divs = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@DMDID and not(./mets:mptr)]'); |
@@ -1217,8 +1189,7 @@ discard block |
||
1217 | 1189 | * |
1218 | 1190 | * @return string|null |
1219 | 1191 | */ |
1220 | - public function _getParentHref() |
|
1221 | - { |
|
1192 | + public function _getParentHref() { |
|
1222 | 1193 | if ($this->parentHref === null) { |
1223 | 1194 | $this->parentHref = ''; |
1224 | 1195 | |
@@ -1240,8 +1211,7 @@ discard block |
||
1240 | 1211 | * |
1241 | 1212 | * @return array Properties to be serialized |
1242 | 1213 | */ |
1243 | - public function __sleep() |
|
1244 | - { |
|
1214 | + public function __sleep() { |
|
1245 | 1215 | // \SimpleXMLElement objects can't be serialized, thus save the XML as string for serialization |
1246 | 1216 | $this->asXML = $this->xml->asXML(); |
1247 | 1217 | return ['uid', 'pid', 'recordId', 'parentId', 'asXML']; |
@@ -1254,8 +1224,7 @@ discard block |
||
1254 | 1224 | * |
1255 | 1225 | * @return string String representing the METS object |
1256 | 1226 | */ |
1257 | - public function __toString() |
|
1258 | - { |
|
1227 | + public function __toString() { |
|
1259 | 1228 | $xml = new \DOMDocument('1.0', 'utf-8'); |
1260 | 1229 | $xml->appendChild($xml->importNode(dom_import_simplexml($this->mets), true)); |
1261 | 1230 | $xml->formatOutput = true; |
@@ -1270,8 +1239,7 @@ discard block |
||
1270 | 1239 | * |
1271 | 1240 | * @return void |
1272 | 1241 | */ |
1273 | - public function __wakeup() |
|
1274 | - { |
|
1242 | + public function __wakeup() { |
|
1275 | 1243 | $xml = Helper::getXmlFileAsString($this->asXML); |
1276 | 1244 | if ($xml !== false) { |
1277 | 1245 | $this->asXML = ''; |