@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @access public |
39 | 39 | */ |
40 | -class Helper |
|
41 | -{ |
|
40 | +class Helper { |
|
42 | 41 | /** |
43 | 42 | * @access public |
44 | 43 | * @static |
@@ -198,8 +197,7 @@ discard block |
||
198 | 197 | * |
199 | 198 | * @return mixed The decrypted value or false on error |
200 | 199 | */ |
201 | - public static function decrypt(string $encrypted) |
|
202 | - { |
|
200 | + public static function decrypt(string $encrypted) { |
|
203 | 201 | if ( |
204 | 202 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
205 | 203 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -239,8 +237,7 @@ discard block |
||
239 | 237 | * |
240 | 238 | * @return \SimpleXMLElement|false |
241 | 239 | */ |
242 | - public static function getXmlFileAsString($content) |
|
243 | - { |
|
240 | + public static function getXmlFileAsString($content) { |
|
244 | 241 | // Don't make simplexml_load_string throw (when $content is an array |
245 | 242 | // or object) |
246 | 243 | if (!is_string($content)) { |
@@ -305,8 +302,7 @@ discard block |
||
305 | 302 | * |
306 | 303 | * @return mixed Hashed string or false on error |
307 | 304 | */ |
308 | - public static function digest(string $string) |
|
309 | - { |
|
305 | + public static function digest(string $string) { |
|
310 | 306 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
311 | 307 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
312 | 308 | return false; |
@@ -326,8 +322,7 @@ discard block |
||
326 | 322 | * |
327 | 323 | * @return mixed Encrypted string or false on error |
328 | 324 | */ |
329 | - public static function encrypt(string $string) |
|
330 | - { |
|
325 | + public static function encrypt(string $string) { |
|
331 | 326 | if ( |
332 | 327 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
333 | 328 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -697,8 +692,7 @@ discard block |
||
697 | 692 | * |
698 | 693 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
699 | 694 | */ |
700 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
701 | - { |
|
695 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
702 | 696 | $context = GeneralUtility::makeInstance(Context::class); |
703 | 697 | |
704 | 698 | if ( |
@@ -937,8 +931,7 @@ discard block |
||
937 | 931 | * |
938 | 932 | * @return void |
939 | 933 | */ |
940 | - private function __construct() |
|
941 | - { |
|
934 | + private function __construct() { |
|
942 | 935 | // This is a static class, thus no instances should be created. |
943 | 936 | } |
944 | 937 | |
@@ -969,8 +962,7 @@ discard block |
||
969 | 962 | * |
970 | 963 | * @return string|bool |
971 | 964 | */ |
972 | - public static function getUrl(string $url) |
|
973 | - { |
|
965 | + public static function getUrl(string $url) { |
|
974 | 966 | if (!Helper::isValidHttpUrl($url)) { |
975 | 967 | return false; |
976 | 968 | } |
@@ -31,8 +31,7 @@ |
||
31 | 31 | * |
32 | 32 | * @access public |
33 | 33 | */ |
34 | -class DeleteCommand extends BaseCommand |
|
35 | -{ |
|
34 | +class DeleteCommand extends BaseCommand { |
|
36 | 35 | |
37 | 36 | /** |
38 | 37 | * Configure the command by defining the name, options and arguments |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | * @property-read \SimpleXMLElement $mets this holds the XML file's METS part as \SimpleXMLElement object |
64 | 64 | * @property-read string $parentHref URL of the parent document (determined via mptr element), or empty string if none is available |
65 | 65 | */ |
66 | -final class MetsDocument extends AbstractDocument |
|
67 | -{ |
|
66 | +final class MetsDocument extends AbstractDocument { |
|
68 | 67 | /** |
69 | 68 | * @access protected |
70 | 69 | * @var string[] Subsections / tags that may occur within `<mets:amdSec>` |
@@ -397,8 +396,7 @@ discard block |
||
397 | 396 | * |
398 | 397 | * @return ?string thumbnail or null if not found |
399 | 398 | */ |
400 | - private function getThumbnail(string $id = '') |
|
401 | - { |
|
399 | + private function getThumbnail(string $id = '') { |
|
402 | 400 | // Load plugin configuration. |
403 | 401 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
404 | 402 | $fileGrpsThumb = GeneralUtility::trimExplode(',', $extConf['fileGrpThumbs']); |
@@ -726,8 +724,7 @@ discard block |
||
726 | 724 | * |
727 | 725 | * @return bool true if extraction successful, false otherwise |
728 | 726 | */ |
729 | - private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) |
|
730 | - { |
|
727 | + private function extractMetadataIfTypeSupported(string $dmdId, string $mdSectionType, array &$metadata) { |
|
731 | 728 | // Is this metadata format supported? |
732 | 729 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']])) { |
733 | 730 | if (!empty($this->formats[$this->mdSec[$dmdId]['type']]['class'])) { |
@@ -759,8 +756,7 @@ discard block |
||
759 | 756 | * |
760 | 757 | * @return array additional metadata data queried from database |
761 | 758 | */ |
762 | - private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) |
|
763 | - { |
|
759 | + private function getAdditionalMetadataFromDatabase(int $cPid, string $dmdId) { |
|
764 | 760 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
765 | 761 | ->getQueryBuilderForTable('tx_dlf_metadata'); |
766 | 762 | // Get hidden records, too. |
@@ -905,8 +901,7 @@ discard block |
||
905 | 901 | /** |
906 | 902 | * @see AbstractDocument::getStructureDepth() |
907 | 903 | */ |
908 | - public function getStructureDepth(string $logId) |
|
909 | - { |
|
904 | + public function getStructureDepth(string $logId) { |
|
910 | 905 | $ancestors = $this->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $logId . '"]/ancestor::*'); |
911 | 906 | if (!empty($ancestors)) { |
912 | 907 | return count($ancestors); |
@@ -75,8 +75,7 @@ discard block |
||
75 | 75 | * @property array $mimeTypes this holds the mime types of linked resources in the manifest (extracted during parsing) for later us |
76 | 76 | * |
77 | 77 | */ |
78 | -final class IiifManifest extends AbstractDocument |
|
79 | -{ |
|
78 | +final class IiifManifest extends AbstractDocument { |
|
80 | 79 | /** |
81 | 80 | * @access protected |
82 | 81 | * @var string This holds the manifest file as string for serialization purposes |
@@ -229,8 +228,7 @@ discard block |
||
229 | 228 | * |
230 | 229 | * @return array|string |
231 | 230 | */ |
232 | - protected function getUseGroups(string $use) |
|
233 | - { |
|
231 | + protected function getUseGroups(string $use) { |
|
234 | 232 | if (!$this->useGrpsLoaded) { |
235 | 233 | // Get configured USE attributes. |
236 | 234 | $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(self::$extKey, 'files'); |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @access public |
36 | 36 | */ |
37 | -class PageViewProxy |
|
38 | -{ |
|
37 | +class PageViewProxy { |
|
39 | 38 | /** |
40 | 39 | * @access protected |
41 | 40 | * @var RequestFactory |
@@ -55,8 +54,7 @@ discard block |
||
55 | 54 | * |
56 | 55 | * @return void |
57 | 56 | */ |
58 | - public function __construct() |
|
59 | - { |
|
57 | + public function __construct() { |
|
60 | 58 | $this->requestFactory = GeneralUtility::makeInstance(RequestFactory::class); |
61 | 59 | $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf', 'general'); |
62 | 60 | } |
@@ -15,12 +15,10 @@ discard block |
||
15 | 15 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
16 | 16 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
17 | 17 | |
18 | -class PageViewProxyTest extends FunctionalTestCase |
|
19 | -{ |
|
18 | +class PageViewProxyTest extends FunctionalTestCase { |
|
20 | 19 | protected $disableJsonWrappedResponse = true; |
21 | 20 | |
22 | - protected function getDlfConfiguration() |
|
23 | - { |
|
21 | + protected function getDlfConfiguration() { |
|
24 | 22 | return array_merge(parent::getDlfConfiguration(), [ |
25 | 23 | 'general' => [ |
26 | 24 | 'enableInternalProxy' => true |
@@ -28,8 +26,7 @@ discard block |
||
28 | 26 | ]); |
29 | 27 | } |
30 | 28 | |
31 | - protected function queryProxy(array $query, string $method = 'GET') |
|
32 | - { |
|
29 | + protected function queryProxy(array $query, string $method = 'GET') { |
|
33 | 30 | $query['eID'] = 'tx_dlf_pageview_proxy'; |
34 | 31 | |
35 | 32 | return $this->httpClient->request($method, '', [ |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | use Kitodo\Dlf\Common\AbstractDocument; |
16 | 16 | use Kitodo\Dlf\Tests\Functional\FunctionalTestCase; |
17 | 17 | |
18 | -class MetsDocumentTest extends FunctionalTestCase |
|
19 | -{ |
|
18 | +class MetsDocumentTest extends FunctionalTestCase { |
|
20 | 19 | public function setUp(): void |
21 | 20 | { |
22 | 21 | parent::setUp(); |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv'); |
27 | 26 | } |
28 | 27 | |
29 | - protected function doc(string $file) |
|
30 | - { |
|
28 | + protected function doc(string $file) { |
|
31 | 29 | $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file; |
32 | 30 | $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]); |
33 | 31 | self::assertNotNull($doc); |
@@ -37,8 +35,7 @@ discard block |
||
37 | 35 | /** |
38 | 36 | * @test |
39 | 37 | */ |
40 | - public function canParseDmdAndAmdSec() |
|
41 | - { |
|
38 | + public function canParseDmdAndAmdSec() { |
|
42 | 39 | $doc = $this->doc('av_beispiel.xml'); |
43 | 40 | |
44 | 41 | $toplevelMetadata = $doc->getToplevelMetadata(20000); |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | /** |
57 | 54 | * @test |
58 | 55 | */ |
59 | - public function canReadFileMetadata() |
|
60 | - { |
|
56 | + public function canReadFileMetadata() { |
|
61 | 57 | $doc = $this->doc('av_beispiel.xml'); |
62 | 58 | |
63 | 59 | $thumbsMeta = $doc->getMetadata('FILE_0000_THUMBS', 20000); |
@@ -72,8 +68,7 @@ discard block |
||
72 | 68 | /** |
73 | 69 | * @test |
74 | 70 | */ |
75 | - public function canGetLogicalStructure() |
|
76 | - { |
|
71 | + public function canGetLogicalStructure() { |
|
77 | 72 | $doc = $this->doc('av_beispiel.xml'); |
78 | 73 | |
79 | 74 | $toc = $doc->tableOfContents[0] ?? []; |
@@ -109,8 +104,7 @@ discard block |
||
109 | 104 | /** |
110 | 105 | * @test |
111 | 106 | */ |
112 | - public function doesNotOverwriteFirstDmdSec() |
|
113 | - { |
|
107 | + public function doesNotOverwriteFirstDmdSec() { |
|
114 | 108 | $doc = $this->doc('two_dmdsec.xml'); |
115 | 109 | |
116 | 110 | $toplevelMetadata = $doc->getToplevelMetadata(20000); |
@@ -123,8 +117,7 @@ discard block |
||
123 | 117 | /** |
124 | 118 | * @test |
125 | 119 | */ |
126 | - public function returnsEmptyMetadataWhenNoDmdSec() |
|
127 | - { |
|
120 | + public function returnsEmptyMetadataWhenNoDmdSec() { |
|
128 | 121 | $doc = $this->doc('two_dmdsec.xml'); |
129 | 122 | |
130 | 123 | // DMD and AMD works |
@@ -143,8 +136,7 @@ discard block |
||
143 | 136 | /** |
144 | 137 | * @test |
145 | 138 | */ |
146 | - public function canGetDownloadLocation() |
|
147 | - { |
|
139 | + public function canGetDownloadLocation() { |
|
148 | 140 | $doc = $this->doc('two_dmdsec.xml'); |
149 | 141 | |
150 | 142 | $correct = $doc->getDownloadLocation('FILE_0000_DOWNLOAD'); |
@@ -162,8 +154,7 @@ discard block |
||
162 | 154 | /** |
163 | 155 | * @test |
164 | 156 | */ |
165 | - public function canGetFileLocation() |
|
166 | - { |
|
157 | + public function canGetFileLocation() { |
|
167 | 158 | $doc = $this->doc('two_dmdsec.xml'); |
168 | 159 | |
169 | 160 | $correct = $doc->getFileLocation('FILE_0000_DEFAULT'); |
@@ -176,8 +167,7 @@ discard block |
||
176 | 167 | /** |
177 | 168 | * @test |
178 | 169 | */ |
179 | - public function canGetFileMimeType() |
|
180 | - { |
|
170 | + public function canGetFileMimeType() { |
|
181 | 171 | $doc = $this->doc('two_dmdsec.xml'); |
182 | 172 | |
183 | 173 | $correct = $doc->getFileMimeType('FILE_0000_DEFAULT'); |
@@ -191,8 +181,7 @@ discard block |
||
191 | 181 | /** |
192 | 182 | * @test |
193 | 183 | */ |
194 | - public function canGetPhysicalPage() |
|
195 | - { |
|
184 | + public function canGetPhysicalPage() { |
|
196 | 185 | $doc = $this->doc('mets_with_pages.xml'); |
197 | 186 | |
198 | 187 | // pass orderlabel and retrieve order |
@@ -203,8 +192,7 @@ discard block |
||
203 | 192 | /** |
204 | 193 | * @test |
205 | 194 | */ |
206 | - public function canGetTitle() |
|
207 | - { |
|
195 | + public function canGetTitle() { |
|
208 | 196 | $doc = $this->doc('mets_with_pages.xml'); |
209 | 197 | |
210 | 198 | $correct = $doc->getTitle(1001); |
@@ -217,8 +205,7 @@ discard block |
||
217 | 205 | /** |
218 | 206 | * @test |
219 | 207 | */ |
220 | - public function canGetFullText() |
|
221 | - { |
|
208 | + public function canGetFullText() { |
|
222 | 209 | $doc = $this->doc('mets_with_pages.xml'); |
223 | 210 | |
224 | 211 | $fulltext = $doc->getFullText('PHYS_0003'); |
@@ -234,8 +221,7 @@ discard block |
||
234 | 221 | /** |
235 | 222 | * @test |
236 | 223 | */ |
237 | - public function canGetStructureDepth() |
|
238 | - { |
|
224 | + public function canGetStructureDepth() { |
|
239 | 225 | $doc = $this->doc('mets_with_pages.xml'); |
240 | 226 | |
241 | 227 | $correct = $doc->getStructureDepth('LOG_0001'); |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @access public |
29 | 29 | */ |
30 | -class DocumentValidator |
|
31 | -{ |
|
30 | +class DocumentValidator { |
|
32 | 31 | /** |
33 | 32 | * @access protected |
34 | 33 | * @var Logger This holds the logger |
@@ -63,8 +62,7 @@ discard block |
||
63 | 62 | * |
64 | 63 | * @return void |
65 | 64 | */ |
66 | - public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) |
|
67 | - { |
|
65 | + public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) { |
|
68 | 66 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | 67 | $this->metadata = $metadata; |
70 | 68 | $this->requiredMetadataFields = $requiredMetadataFields; |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | use SimpleXMLElement; |
16 | 16 | use TYPO3\TestingFramework\Core\Unit\UnitTestCase; |
17 | 17 | |
18 | -class DocumentValidatorTest extends UnitTestCase |
|
19 | -{ |
|
18 | +class DocumentValidatorTest extends UnitTestCase { |
|
20 | 19 | public function setUp(): void |
21 | 20 | { |
22 | 21 | parent::setUp(); |
@@ -27,8 +26,7 @@ discard block |
||
27 | 26 | /** |
28 | 27 | * @test |
29 | 28 | */ |
30 | - public function passesHasAllMandatoryMetadataFields() |
|
31 | - { |
|
29 | + public function passesHasAllMandatoryMetadataFields() { |
|
32 | 30 | $metadata = [ |
33 | 31 | 'record_id' => [ |
34 | 32 | 'xyz' |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | /** |
42 | 40 | * @test |
43 | 41 | */ |
44 | - public function notPassesHasAllMandatoryMetadataFields() |
|
45 | - { |
|
42 | + public function notPassesHasAllMandatoryMetadataFields() { |
|
46 | 43 | $metadata = [ |
47 | 44 | 'document_format' => [ |
48 | 45 | 'METS' |
@@ -55,8 +52,7 @@ discard block |
||
55 | 52 | /** |
56 | 53 | * @test |
57 | 54 | */ |
58 | - public function passesHasCorrectLogicalStructure() |
|
59 | - { |
|
55 | + public function passesHasCorrectLogicalStructure() { |
|
60 | 56 | $xml = $this->getXml('av_beispiel.xml'); |
61 | 57 | |
62 | 58 | $documentValidator = new DocumentValidator([], [], $xml); |
@@ -66,8 +62,7 @@ discard block |
||
66 | 62 | /** |
67 | 63 | * @test |
68 | 64 | */ |
69 | - public function notPassesHasCorrectLogicalStructure() |
|
70 | - { |
|
65 | + public function notPassesHasCorrectLogicalStructure() { |
|
71 | 66 | $xml = $this->getXml('av_beispiel.xml'); |
72 | 67 | |
73 | 68 | $documentValidator = new DocumentValidator([], [], $xml); |
@@ -77,8 +72,7 @@ discard block |
||
77 | 72 | /** |
78 | 73 | * @test |
79 | 74 | */ |
80 | - public function passesHasCorrectPhysicalStructure() |
|
81 | - { |
|
75 | + public function passesHasCorrectPhysicalStructure() { |
|
82 | 76 | $xml = $this->getXml('av_beispiel.xml'); |
83 | 77 | |
84 | 78 | $documentValidator = new DocumentValidator([], [], $xml); |
@@ -88,8 +82,7 @@ discard block |
||
88 | 82 | /** |
89 | 83 | * @test |
90 | 84 | */ |
91 | - public function notPassesHasCorrectPhysicalStructure() |
|
92 | - { |
|
85 | + public function notPassesHasCorrectPhysicalStructure() { |
|
93 | 86 | $xml = $this->getXml('two_dmdsec.xml'); |
94 | 87 | |
95 | 88 | $documentValidator = new DocumentValidator([], [], $xml); |