@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
99 | 99 | |
100 | 100 | if ($this->disableJsonWrappedResponse) { |
101 | - $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) { |
|
101 | + $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) { |
|
102 | 102 | return $ext !== 'Resources/Core/Functional/Extensions/json_response'; |
103 | 103 | }); |
104 | 104 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
112 | 112 | $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); |
113 | 113 | |
114 | - $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
|
114 | + $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/'; |
|
115 | 115 | $this->httpClient = new HttpClient([ |
116 | - 'base_uri' => $this->baseUrl . 'index.php', |
|
116 | + 'base_uri' => $this->baseUrl.'index.php', |
|
117 | 117 | 'http_errors' => false, |
118 | 118 | ]); |
119 | 119 | |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | |
165 | 165 | protected function addSiteConfig($identifier) |
166 | 166 | { |
167 | - $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
|
167 | + $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml'); |
|
168 | 168 | $siteConfig['base'] = $this->baseUrl; |
169 | 169 | $siteConfig['languages'][0]['base'] = $this->baseUrl; |
170 | 170 | |
171 | - $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
|
171 | + $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier; |
|
172 | 172 | @mkdir($siteConfigPath, 0775, true); |
173 | - file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
|
173 | + file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | protected function initializeRepository(string $className, int $storagePid) |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $jsonDocuments = json_decode(file_get_contents($path), true); |
190 | 190 | |
191 | 191 | $updateQuery = $solr->service->createUpdate(); |
192 | - $documents = array_map(function ($jsonDoc) use ($updateQuery) { |
|
192 | + $documents = array_map(function($jsonDoc) use ($updateQuery) { |
|
193 | 193 | $document = $updateQuery->createDocument(); |
194 | 194 | foreach ($jsonDoc as $key => $value) { |
195 | 195 | $document->setField($key, $value); |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected $httpClient; |
93 | 93 | |
94 | - public function __construct() |
|
95 | - { |
|
94 | + public function __construct() { |
|
96 | 95 | parent::__construct(); |
97 | 96 | |
98 | 97 | $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration(); |
@@ -120,8 +119,7 @@ discard block |
||
120 | 119 | $this->addSiteConfig('dlf-testing'); |
121 | 120 | } |
122 | 121 | |
123 | - protected function getDlfConfiguration() |
|
124 | - { |
|
122 | + protected function getDlfConfiguration() { |
|
125 | 123 | $dotenv = Dotenv::createImmutable('/home/runner/work/kitodo-presentation/kitodo-presentation/Build/Test/', 'test.env'); |
126 | 124 | $dotenv->load(); |
127 | 125 | |
@@ -162,8 +160,7 @@ discard block |
||
162 | 160 | ]; |
163 | 161 | } |
164 | 162 | |
165 | - protected function addSiteConfig($identifier) |
|
166 | - { |
|
163 | + protected function addSiteConfig($identifier) { |
|
167 | 164 | $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml'); |
168 | 165 | $siteConfig['base'] = $this->baseUrl; |
169 | 166 | $siteConfig['languages'][0]['base'] = $this->baseUrl; |
@@ -173,8 +170,7 @@ discard block |
||
173 | 170 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
174 | 171 | } |
175 | 172 | |
176 | - protected function initializeRepository(string $className, int $storagePid) |
|
177 | - { |
|
173 | + protected function initializeRepository(string $className, int $storagePid) { |
|
178 | 174 | $repository = $this->objectManager->get($className); |
179 | 175 | |
180 | 176 | $querySettings = $this->objectManager->get(Typo3QuerySettings::class); |
@@ -184,8 +180,7 @@ discard block |
||
184 | 180 | return $repository; |
185 | 181 | } |
186 | 182 | |
187 | - protected function importSolrDocuments(Solr $solr, string $path) |
|
188 | - { |
|
183 | + protected function importSolrDocuments(Solr $solr, string $path) { |
|
189 | 184 | $jsonDocuments = json_decode(file_get_contents($path), true); |
190 | 185 | |
191 | 186 | $updateQuery = $solr->service->createUpdate(); |
@@ -204,16 +199,14 @@ discard block |
||
204 | 199 | $solr->service->update($updateQuery); |
205 | 200 | } |
206 | 201 | |
207 | - protected function initLanguageService(string $locale) |
|
208 | - { |
|
202 | + protected function initLanguageService(string $locale) { |
|
209 | 203 | $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->create($locale); |
210 | 204 | } |
211 | 205 | |
212 | 206 | /** |
213 | 207 | * Assert that $sub is recursively contained within $super. |
214 | 208 | */ |
215 | - protected function assertArrayMatches(array $sub, array $super, string $message = '') |
|
216 | - { |
|
209 | + protected function assertArrayMatches(array $sub, array $super, string $message = '') { |
|
217 | 210 | self::assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message); |
218 | 211 | } |
219 | 212 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ], |
50 | 50 | 'FE' => [ |
51 | 51 | 'cacheHash' => [ |
52 | - 'enforceValidation' => false, |
|
52 | + 'enforceValidation' => FALSE, |
|
53 | 53 | ], |
54 | 54 | ], |
55 | 55 | 'DB' => [ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @var bool |
71 | 71 | */ |
72 | - protected $disableJsonWrappedResponse = false; |
|
72 | + protected $disableJsonWrappedResponse = FALSE; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @var ObjectManager |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/'; |
115 | 115 | $this->httpClient = new HttpClient([ |
116 | 116 | 'base_uri' => $this->baseUrl . 'index.php', |
117 | - 'http_errors' => false, |
|
117 | + 'http_errors' => FALSE, |
|
118 | 118 | ]); |
119 | 119 | |
120 | 120 | $this->addSiteConfig('dlf-testing'); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $siteConfig['languages'][0]['base'] = $this->baseUrl; |
170 | 170 | |
171 | 171 | $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier; |
172 | - @mkdir($siteConfigPath, 0775, true); |
|
172 | + @mkdir($siteConfigPath, 0775, TRUE); |
|
173 | 173 | file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig)); |
174 | 174 | } |
175 | 175 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | protected function importSolrDocuments(Solr $solr, string $path) |
188 | 188 | { |
189 | - $jsonDocuments = json_decode(file_get_contents($path), true); |
|
189 | + $jsonDocuments = json_decode(file_get_contents($path), TRUE); |
|
190 | 190 | |
191 | 191 | $updateQuery = $solr->service->createUpdate(); |
192 | 192 | $documents = array_map(function ($jsonDoc) use ($updateQuery) { |
@@ -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 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->initializeRepositories((int) $input->getOption('pid')); |
85 | 85 | |
86 | 86 | if ($this->storagePid == 0) { |
87 | - $io->error('ERROR: No valid PID (' . $this->storagePid . ') given.'); |
|
87 | + $io->error('ERROR: No valid PID ('.$this->storagePid.') given.'); |
|
88 | 88 | return BaseCommand::FAILURE; |
89 | 89 | } |
90 | 90 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | if (empty($solrCoreUid) || !in_array($solrCoreUid, $allSolrCores)) { |
100 | 100 | $outputSolrCores = []; |
101 | 101 | foreach ($allSolrCores as $indexName => $uid) { |
102 | - $outputSolrCores[] = $uid . ' : ' . $indexName; |
|
102 | + $outputSolrCores[] = $uid.' : '.$indexName; |
|
103 | 103 | } |
104 | 104 | if (empty($outputSolrCores)) { |
105 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. No valid cores found on PID ' . $this->storagePid . ".\n"); |
|
105 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. No valid cores found on PID '.$this->storagePid.".\n"); |
|
106 | 106 | return BaseCommand::FAILURE; |
107 | 107 | } else { |
108 | - $io->error('ERROR: No valid Solr core ("' . $input->getOption('solr') . '") given. ' . "Valid cores are (<uid>:<index_name>):\n" . implode("\n", $outputSolrCores) . "\n"); |
|
108 | + $io->error('ERROR: No valid Solr core ("'.$input->getOption('solr').'") given. '."Valid cores are (<uid>:<index_name>):\n".implode("\n", $outputSolrCores)."\n"); |
|
109 | 109 | return BaseCommand::FAILURE; |
110 | 110 | } |
111 | 111 | } |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | $document = $this->getDocument($input); |
148 | 148 | |
149 | 149 | if ($document === null) { |
150 | - $io->info('INFO: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . '. It is probably already deleted from DB.'); |
|
150 | + $io->info('INFO: Document with UID "'.$input->getOption('doc').'" could not be found on PID '.$this->storagePid.'. It is probably already deleted from DB.'); |
|
151 | 151 | } else { |
152 | 152 | if ($io->isVerbose()) { |
153 | - $io->section('Deleting ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
153 | + $io->section('Deleting '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
154 | 154 | } |
155 | 155 | $this->documentRepository->remove($document); |
156 | 156 | $this->persistenceManager->persistAll(); |
157 | 157 | if ($io->isVerbose()) { |
158 | - $io->success('Deleted ' . $document->getUid() . ' ("' . $document->getLocation() . '") on PID ' . $this->storagePid . '.'); |
|
158 | + $io->success('Deleted '.$document->getUid().' ("'.$document->getLocation().'") on PID '.$this->storagePid.'.'); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | private function deleteFromSolr($input, $io, $solrCoreUid): void |
175 | 175 | { |
176 | 176 | if ($io->isVerbose()) { |
177 | - $io->section('Deleting ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.'); |
|
177 | + $io->section('Deleting '.$input->getOption('doc').' on Solr core '.$solrCoreUid.'.'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $isDeleted = false; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | if ($isDeleted) { |
189 | 189 | if ($io->isVerbose()) { |
190 | - $io->success('Deleted ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.'); |
|
190 | + $io->success('Deleted '.$input->getOption('doc').' on Solr core '.$solrCoreUid.'.'); |
|
191 | 191 | } |
192 | 192 | $io->success('All done!'); |
193 | 193 | } else { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ) |
67 | 67 | ->addOption( |
68 | 68 | 'softCommit', |
69 | - null, |
|
69 | + NULL, |
|
70 | 70 | InputOption::VALUE_NONE, |
71 | 71 | 'If this option is set, documents are just deleted from the index by a soft commit.' |
72 | 72 | ); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | $document = $this->getDocument($input); |
154 | 154 | |
155 | - if ($document === null) { |
|
155 | + if ($document === NULL) { |
|
156 | 156 | $io->info('INFO: Document with UID "' . $input->getOption('doc') . '" could not be found on PID ' . $this->storagePid . '. It is probably already deleted from DB.'); |
157 | 157 | } else { |
158 | 158 | if ($io->isVerbose()) { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $io->section('Deleting ' . $input->getOption('doc') . ' on Solr core ' . $solrCoreUid . '.'); |
184 | 184 | } |
185 | 185 | |
186 | - $isDeleted = false; |
|
186 | + $isDeleted = FALSE; |
|
187 | 187 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
188 | 188 | $isDeleted = Indexer::delete($input, 'uid', $solrCoreUid, $input->getOption('softCommit')); |
189 | 189 | |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | */ |
213 | 213 | private function getDocument($input): ?Document |
214 | 214 | { |
215 | - $document = null; |
|
215 | + $document = NULL; |
|
216 | 216 | |
217 | 217 | if (MathUtility::canBeInterpretedAsInteger($input->getOption('doc'))) { |
218 | 218 | $document = $this->documentRepository->findByUid($input->getOption('doc')); |
219 | 219 | } elseif (GeneralUtility::isValidUrl($input->getOption('doc'))) { |
220 | - $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], true); |
|
220 | + $doc = AbstractDocument::getInstance($input->getOption('doc'), ['storagePid' => $this->storagePid], TRUE); |
|
221 | 221 | |
222 | 222 | if ($doc->recordId) { |
223 | 223 | $document = $this->documentRepository->findOneByRecordId($doc->recordId); |
@@ -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 | } |
@@ -21,14 +21,14 @@ |
||
21 | 21 | { |
22 | 22 | parent::setUp(); |
23 | 23 | |
24 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.csv'); |
|
25 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/Common/metadata.csv'); |
|
26 | - $this->importCSVDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.csv'); |
|
24 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/documents_1.csv'); |
|
25 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/Common/metadata.csv'); |
|
26 | + $this->importCSVDataSet(__DIR__.'/../../Fixtures/MetsDocument/metadata_mets.csv'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function doc(string $file) |
30 | 30 | { |
31 | - $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file; |
|
31 | + $url = 'http://web:8001/Tests/Fixtures/MetsDocument/'.$file; |
|
32 | 32 | $doc = AbstractDocument::getInstance($url, ['general' => ['useExternalApisForMetadata' => 0]]); |
33 | 33 | self::assertNotNull($doc); |
34 | 34 | return $doc; |
@@ -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'); |
@@ -29,10 +29,10 @@ |
||
29 | 29 | */ |
30 | 30 | class DocumentValidator |
31 | 31 | { |
32 | - /** |
|
33 | - * @access protected |
|
34 | - * @var Logger This holds the logger |
|
35 | - */ |
|
32 | + /** |
|
33 | + * @access protected |
|
34 | + * @var Logger This holds the logger |
|
35 | + */ |
|
36 | 36 | protected Logger $logger; |
37 | 37 | |
38 | 38 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | foreach ($this->requiredMetadataFields as $requiredMetadataField) { |
84 | 84 | if (empty($this->metadata[$requiredMetadataField][0])) { |
85 | - $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".'); |
|
85 | + $this->logger->error('Missing required metadata field "'.$requiredMetadataField.'".'); |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | } |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function hasCorrectLogicalStructure(string $type): bool |
102 | 102 | { |
103 | - $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]'); |
|
103 | + $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="'.$type.'"]'); |
|
104 | 104 | if ($expectedNodes) { |
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
109 | 109 | if ($existingNodes) { |
110 | - $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.'); |
|
110 | + $this->logger->error('Document contains logical structure but @TYPE="'.$type.'" is missing.'); |
|
111 | 111 | return false; |
112 | 112 | } |
113 | 113 |
@@ -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; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = null) |
|
66 | + public function __construct(array $metadata = [], array $requiredMetadataFields = [], ?\SimpleXMLElement $xml = NULL) |
|
67 | 67 | { |
68 | 68 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
69 | 69 | $this->metadata = $metadata; |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | foreach ($this->requiredMetadataFields as $requiredMetadataField) { |
84 | 84 | if (empty($this->metadata[$requiredMetadataField][0])) { |
85 | 85 | $this->logger->error('Missing required metadata field "' . $requiredMetadataField . '".'); |
86 | - return false; |
|
86 | + return FALSE; |
|
87 | 87 | } |
88 | 88 | } |
89 | - return true; |
|
89 | + return TRUE; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | { |
103 | 103 | $expectedNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div[@TYPE="' . $type . '"]'); |
104 | 104 | if ($expectedNodes) { |
105 | - return true; |
|
105 | + return TRUE; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | $existingNodes = $this->xml->xpath('./mets:structMap[@TYPE="LOGICAL"]/mets:div'); |
109 | 109 | if ($existingNodes) { |
110 | 110 | $this->logger->error('Document contains logical structure but @TYPE="' . $type . '" is missing.'); |
111 | - return false; |
|
111 | + return FALSE; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | $this->logger->error('Document does not contain logical structure.'); |
115 | - return false; |
|
115 | + return FALSE; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | { |
127 | 127 | $physSequenceNodes = $this->xml->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div[@TYPE="physSequence"]'); |
128 | 128 | if ($physSequenceNodes) { |
129 | - return true; |
|
129 | + return TRUE; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $physicalStructureNodes = $this->xml->xpath('./mets:structMap[@TYPE="PHYSICAL"]/mets:div'); |
133 | 133 | if ($physicalStructureNodes) { |
134 | 134 | $this->logger->error('Document contains physical structure but @TYPE="physSequence" is missing.'); |
135 | - return false; |
|
135 | + return FALSE; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | $this->logger->error('Document does not contain physical structure.'); |
139 | - return false; |
|
139 | + return FALSE; |
|
140 | 140 | } |
141 | 141 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | |
106 | 106 | private function getXml(string $file): SimpleXMLElement |
107 | 107 | { |
108 | - $xml = simplexml_load_file(__DIR__ . '/../../Fixtures/MetsDocument/' . $file); |
|
108 | + $xml = simplexml_load_file(__DIR__.'/../../Fixtures/MetsDocument/'.$file); |
|
109 | 109 | self::assertNotFalse($xml); |
110 | 110 | return $xml; |
111 | 111 | } |
@@ -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); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | parent::setUp(); |
23 | 23 | |
24 | - $this->resetSingletonInstances = true; |
|
24 | + $this->resetSingletonInstances = TRUE; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return FlashMessageQueue The queue the message was added to |
89 | 89 | */ |
90 | - public static function addMessage(string $message, string $title, int $severity, bool $session = false, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue |
|
90 | + public static function addMessage(string $message, string $title, int $severity, bool $session = FALSE, string $queue = 'kitodo.default.flashMessages'): FlashMessageQueue |
|
91 | 91 | { |
92 | 92 | $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); |
93 | 93 | $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue); |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | $checksum = 'X'; |
127 | 127 | } |
128 | 128 | if (!preg_match('/\d{8}[\dX]{1}/i', $id)) { |
129 | - return false; |
|
129 | + return FALSE; |
|
130 | 130 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
131 | - return false; |
|
131 | + return FALSE; |
|
132 | 132 | } |
133 | 133 | break; |
134 | 134 | case 'ZDB': |
@@ -136,21 +136,21 @@ discard block |
||
136 | 136 | $checksum = 'X'; |
137 | 137 | } |
138 | 138 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
139 | - return false; |
|
139 | + return FALSE; |
|
140 | 140 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
141 | - return false; |
|
141 | + return FALSE; |
|
142 | 142 | } |
143 | 143 | break; |
144 | 144 | case 'SWD': |
145 | 145 | $checksum = 11 - $checksum; |
146 | 146 | if (!preg_match('/\d{8}-\d{1}/i', $id)) { |
147 | - return false; |
|
147 | + return FALSE; |
|
148 | 148 | } elseif ($checksum == 10) { |
149 | 149 | //TODO: Binary operation "+" between string and 1 results in an error. |
150 | 150 | // @phpstan-ignore-next-line |
151 | 151 | return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
152 | 152 | } elseif (substr($id, -1, 1) != $checksum) { |
153 | - return false; |
|
153 | + return FALSE; |
|
154 | 154 | } |
155 | 155 | break; |
156 | 156 | case 'GKD': |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | $checksum = 'X'; |
160 | 160 | } |
161 | 161 | if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) { |
162 | - return false; |
|
162 | + return FALSE; |
|
163 | 163 | } elseif (strtoupper(substr($id, -1, 1)) != $checksum) { |
164 | - return false; |
|
164 | + return FALSE; |
|
165 | 165 | } |
166 | 166 | break; |
167 | 167 | } |
168 | - return true; |
|
168 | + return TRUE; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -202,28 +202,28 @@ discard block |
||
202 | 202 | public static function decrypt(string $encrypted) |
203 | 203 | { |
204 | 204 | if ( |
205 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
206 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
205 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
206 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
207 | 207 | ) { |
208 | 208 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
209 | - return false; |
|
209 | + return FALSE; |
|
210 | 210 | } |
211 | 211 | if (empty(self::getEncryptionKey())) { |
212 | 212 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
213 | - return false; |
|
213 | + return FALSE; |
|
214 | 214 | } |
215 | 215 | if ( |
216 | 216 | empty($encrypted) |
217 | 217 | || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm) |
218 | 218 | ) { |
219 | 219 | self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR); |
220 | - return false; |
|
220 | + return FALSE; |
|
221 | 221 | } |
222 | 222 | // Split initialisation vector and encrypted data. |
223 | 223 | $binary = base64_decode($encrypted); |
224 | 224 | $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
225 | 225 | $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm)); |
226 | - $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, true); |
|
226 | + $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, TRUE); |
|
227 | 227 | // Decrypt data. |
228 | 228 | return openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
229 | 229 | } |
@@ -245,15 +245,15 @@ discard block |
||
245 | 245 | // Don't make simplexml_load_string throw (when $content is an array |
246 | 246 | // or object) |
247 | 247 | if (!is_string($content)) { |
248 | - return false; |
|
248 | + return FALSE; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // Turn off libxml's error logging. |
252 | - $libxmlErrors = libxml_use_internal_errors(true); |
|
252 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
253 | 253 | |
254 | 254 | if (\PHP_VERSION_ID < 80000) { |
255 | 255 | // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept |
256 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(true); |
|
256 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | // Try to load XML from file. |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public static function digest(string $string) |
317 | 317 | { |
318 | - if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
|
318 | + if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) { |
|
319 | 319 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
320 | - return false; |
|
320 | + return FALSE; |
|
321 | 321 | } |
322 | 322 | // Hash string. |
323 | 323 | return openssl_digest($string, self::$hashAlgorithm); |
@@ -337,23 +337,23 @@ discard block |
||
337 | 337 | public static function encrypt(string $string) |
338 | 338 | { |
339 | 339 | if ( |
340 | - !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
|
341 | - || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
|
340 | + !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE)) |
|
341 | + || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE)) |
|
342 | 342 | ) { |
343 | 343 | self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR); |
344 | - return false; |
|
344 | + return FALSE; |
|
345 | 345 | } |
346 | 346 | if (empty(self::getEncryptionKey())) { |
347 | 347 | self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR); |
348 | - return false; |
|
348 | + return FALSE; |
|
349 | 349 | } |
350 | 350 | // Generate random initialization vector. |
351 | 351 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm)); |
352 | - $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, true); |
|
352 | + $key = openssl_digest(self::getEncryptionKey(), self::$hashAlgorithm, TRUE); |
|
353 | 353 | // Encrypt data. |
354 | 354 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
355 | 355 | // Merge initialization vector and encrypted data. |
356 | - if ($encrypted !== false) { |
|
356 | + if ($encrypted !== FALSE) { |
|
357 | 357 | $encrypted = base64_encode($iv . $encrypted); |
358 | 358 | } |
359 | 359 | return $encrypted; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | public static function isValidHttpUrl(string $url): bool |
555 | 555 | { |
556 | 556 | if (!GeneralUtility::isValidUrl($url)) { |
557 | - return false; |
|
557 | + return FALSE; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | try { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | return !empty($uri->getScheme()); |
563 | 563 | } catch (\InvalidArgumentException $e) { |
564 | 564 | self::log($e->getMessage(), LOG_SEVERITY_ERROR); |
565 | - return false; |
|
565 | + return FALSE; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * |
579 | 579 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
580 | 580 | */ |
581 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
581 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = FALSE, $cmdFirst = FALSE) |
|
582 | 582 | { |
583 | 583 | $context = GeneralUtility::makeInstance(Context::class); |
584 | 584 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | // Instantiate TYPO3 core engine. |
590 | 590 | $dataHandler = GeneralUtility::makeInstance(DataHandler::class); |
591 | 591 | // We do not use workspaces and have to bypass restrictions in DataHandler. |
592 | - $dataHandler->bypassWorkspaceRestrictions = true; |
|
592 | + $dataHandler->bypassWorkspaceRestrictions = TRUE; |
|
593 | 593 | // Load data and command arrays. |
594 | 594 | $dataHandler->start($data, $cmd); |
595 | 595 | // Process command map first if default order is reversed. |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | ->where( |
689 | 689 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
690 | 690 | $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
691 | - self::whereExpression($table, true) |
|
691 | + self::whereExpression($table, TRUE) |
|
692 | 692 | ) |
693 | 693 | ->setMaxResults(1) |
694 | 694 | ->execute(); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
705 | 705 | $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
706 | 706 | $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
707 | - self::whereExpression($table, true) |
|
707 | + self::whereExpression($table, TRUE) |
|
708 | 708 | ) |
709 | 709 | ->setMaxResults(1) |
710 | 710 | ->execute(); |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | ->where( |
740 | 740 | $queryBuilder->expr()->eq($table . '.pid', $pid), |
741 | 741 | $additionalWhere, |
742 | - self::whereExpression($table, true) |
|
742 | + self::whereExpression($table, TRUE) |
|
743 | 743 | ) |
744 | 744 | ->setMaxResults(10000) |
745 | 745 | ->execute(); |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return string Additional WHERE expression |
783 | 783 | */ |
784 | - public static function whereExpression(string $table, bool $showHidden = false): string |
|
784 | + public static function whereExpression(string $table, bool $showHidden = FALSE): string |
|
785 | 785 | { |
786 | 786 | // TODO: Check with applicationType; TYPO3_MODE is removed in v12 |
787 | 787 | if (\TYPO3_MODE === 'FE') { |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | public static function getUrl(string $url) |
854 | 854 | { |
855 | 855 | if (!Helper::isValidHttpUrl($url)) { |
856 | - return false; |
|
856 | + return FALSE; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | // Get extension configuration. |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | $response = $requestFactory->request($url, 'GET', $configuration); |
872 | 872 | } catch (\Exception $e) { |
873 | 873 | self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
874 | - return false; |
|
874 | + return FALSE; |
|
875 | 875 | } |
876 | 876 | return $response->getBody()->getContents(); |
877 | 877 | } |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @access public |
40 | 40 | */ |
41 | -class Helper |
|
42 | -{ |
|
41 | +class Helper { |
|
43 | 42 | /** |
44 | 43 | * @access public |
45 | 44 | * @static |
@@ -199,8 +198,7 @@ discard block |
||
199 | 198 | * |
200 | 199 | * @return mixed The decrypted value or false on error |
201 | 200 | */ |
202 | - public static function decrypt(string $encrypted) |
|
203 | - { |
|
201 | + public static function decrypt(string $encrypted) { |
|
204 | 202 | if ( |
205 | 203 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
206 | 204 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -240,8 +238,7 @@ discard block |
||
240 | 238 | * |
241 | 239 | * @return \SimpleXMLElement|false |
242 | 240 | */ |
243 | - public static function getXmlFileAsString($content) |
|
244 | - { |
|
241 | + public static function getXmlFileAsString($content) { |
|
245 | 242 | // Don't make simplexml_load_string throw (when $content is an array |
246 | 243 | // or object) |
247 | 244 | if (!is_string($content)) { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | * |
314 | 311 | * @return mixed Hashed string or false on error |
315 | 312 | */ |
316 | - public static function digest(string $string) |
|
317 | - { |
|
313 | + public static function digest(string $string) { |
|
318 | 314 | if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) { |
319 | 315 | self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR); |
320 | 316 | return false; |
@@ -334,8 +330,7 @@ discard block |
||
334 | 330 | * |
335 | 331 | * @return mixed Encrypted string or false on error |
336 | 332 | */ |
337 | - public static function encrypt(string $string) |
|
338 | - { |
|
333 | + public static function encrypt(string $string) { |
|
339 | 334 | if ( |
340 | 335 | !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true)) |
341 | 336 | || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true)) |
@@ -578,8 +573,7 @@ discard block |
||
578 | 573 | * |
579 | 574 | * @return array Array of substituted "NEW..." identifiers and their actual UIDs. |
580 | 575 | */ |
581 | - public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) |
|
582 | - { |
|
576 | + public static function processDatabaseAsAdmin(array $data = [], array $cmd = [], $reverseOrder = false, $cmdFirst = false) { |
|
583 | 577 | $context = GeneralUtility::makeInstance(Context::class); |
584 | 578 | |
585 | 579 | if ( |
@@ -818,8 +812,7 @@ discard block |
||
818 | 812 | * |
819 | 813 | * @return void |
820 | 814 | */ |
821 | - private function __construct() |
|
822 | - { |
|
815 | + private function __construct() { |
|
823 | 816 | // This is a static class, thus no instances should be created. |
824 | 817 | } |
825 | 818 | |
@@ -850,8 +843,7 @@ discard block |
||
850 | 843 | * |
851 | 844 | * @return string|bool |
852 | 845 | */ |
853 | - public static function getUrl(string $url) |
|
854 | - { |
|
846 | + public static function getUrl(string $url) { |
|
855 | 847 | if (!Helper::isValidHttpUrl($url)) { |
856 | 848 | return false; |
857 | 849 | } |
@@ -932,8 +924,7 @@ discard block |
||
932 | 924 | * |
933 | 925 | * @return mixed |
934 | 926 | */ |
935 | - private static function getLocalConfigurationByPath(string $path) |
|
936 | - { |
|
927 | + private static function getLocalConfigurationByPath(string $path) { |
|
937 | 928 | $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class); |
938 | 929 | |
939 | 930 | if (array_key_exists(strtok($path, '/'), $configurationManager->getLocalConfiguration())) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } elseif ($checksum == 10) { |
149 | 149 | //TODO: Binary operation "+" between string and 1 results in an error. |
150 | 150 | // @phpstan-ignore-next-line |
151 | - return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD'); |
|
151 | + return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD'); |
|
152 | 152 | } elseif (substr($id, -1, 1) != $checksum) { |
153 | 153 | return false; |
154 | 154 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv); |
355 | 355 | // Merge initialization vector and encrypted data. |
356 | 356 | if ($encrypted !== false) { |
357 | - $encrypted = base64_encode($iv . $encrypted); |
|
357 | + $encrypted = base64_encode($iv.$encrypted); |
|
358 | 358 | } |
359 | 359 | return $encrypted; |
360 | 360 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | public static function getHookObjects(string $scriptRelPath): array |
397 | 397 | { |
398 | 398 | $hookObjects = []; |
399 | - if (is_array(self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'])) { |
|
400 | - foreach (self::getOptions()[self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) { |
|
399 | + if (is_array(self::getOptions()[self::$extKey.'/'.$scriptRelPath]['hookClass'])) { |
|
400 | + foreach (self::getOptions()[self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) { |
|
401 | 401 | $hookObjects[] = GeneralUtility::makeInstance($classRef); |
402 | 402 | } |
403 | 403 | } |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | // NOTE: Only use tables that don't have too many entries! |
427 | 427 | || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_metadatasubentries', 'tx_dlf_structures', 'tx_dlf_solrcores']) |
428 | 428 | ) { |
429 | - self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR); |
|
429 | + self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR); |
|
430 | 430 | return ''; |
431 | 431 | } |
432 | 432 | |
433 | - $makeCacheKey = function ($pid, $uid) { |
|
434 | - return $pid . '.' . $uid; |
|
433 | + $makeCacheKey = function($pid, $uid) { |
|
434 | + return $pid.'.'.$uid; |
|
435 | 435 | }; |
436 | 436 | |
437 | 437 | static $cache = []; |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | |
442 | 442 | $result = $queryBuilder |
443 | 443 | ->select( |
444 | - $table . '.index_name AS index_name', |
|
445 | - $table . '.uid AS uid', |
|
446 | - $table . '.pid AS pid', |
|
444 | + $table.'.index_name AS index_name', |
|
445 | + $table.'.uid AS uid', |
|
446 | + $table.'.pid AS pid', |
|
447 | 447 | ) |
448 | 448 | ->from($table) |
449 | 449 | ->execute(); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $result = $cache[$table][$cacheKey] ?? ''; |
462 | 462 | |
463 | 463 | if ($result === '') { |
464 | - self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
464 | + self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return $result; |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | // No ISO code, return unchanged. |
491 | 491 | return $code; |
492 | 492 | } |
493 | - $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code); |
|
493 | + $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code); |
|
494 | 494 | if (!empty($lang)) { |
495 | 495 | return $lang; |
496 | 496 | } else { |
497 | - self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
497 | + self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE); |
|
498 | 498 | return $code; |
499 | 499 | } |
500 | 500 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | // Sanitize input. |
659 | 659 | $pid = max((int) $pid, 0); |
660 | 660 | if (!$pid) { |
661 | - self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING); |
|
661 | + self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING); |
|
662 | 662 | return $indexName; |
663 | 663 | } |
664 | 664 | /** @var PageRepository $pageRepository */ |
@@ -681,13 +681,13 @@ discard block |
||
681 | 681 | // First fetch the uid of the received index_name |
682 | 682 | $result = $queryBuilder |
683 | 683 | ->select( |
684 | - $table . '.uid AS uid', |
|
685 | - $table . '.l18n_parent AS l18n_parent' |
|
684 | + $table.'.uid AS uid', |
|
685 | + $table.'.l18n_parent AS l18n_parent' |
|
686 | 686 | ) |
687 | 687 | ->from($table) |
688 | 688 | ->where( |
689 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
690 | - $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($indexName)), |
|
689 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
690 | + $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($indexName)), |
|
691 | 691 | self::whereExpression($table, true) |
692 | 692 | ) |
693 | 693 | ->setMaxResults(1) |
@@ -698,12 +698,12 @@ discard block |
||
698 | 698 | if ($row) { |
699 | 699 | // Now we use the uid of the l18_parent to fetch the index_name of the translated content element. |
700 | 700 | $result = $queryBuilder |
701 | - ->select($table . '.index_name AS index_name') |
|
701 | + ->select($table.'.index_name AS index_name') |
|
702 | 702 | ->from($table) |
703 | 703 | ->where( |
704 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
705 | - $queryBuilder->expr()->eq($table . '.uid', $row['l18n_parent']), |
|
706 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId), |
|
704 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
705 | + $queryBuilder->expr()->eq($table.'.uid', $row['l18n_parent']), |
|
706 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId), |
|
707 | 707 | self::whereExpression($table, true) |
708 | 708 | ) |
709 | 709 | ->setMaxResults(1) |
@@ -721,14 +721,14 @@ discard block |
||
721 | 721 | if (empty($labels[$table][$pid][$languageContentId][$indexName])) { |
722 | 722 | // Check if this table is allowed for translation. |
723 | 723 | if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_metadatasubentries', 'tx_dlf_structures'])) { |
724 | - $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]); |
|
724 | + $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]); |
|
725 | 725 | if ($languageContentId > 0) { |
726 | 726 | $additionalWhere = $queryBuilder->expr()->andX( |
727 | 727 | $queryBuilder->expr()->orX( |
728 | - $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]), |
|
729 | - $queryBuilder->expr()->eq($table . '.sys_language_uid', (int) $languageContentId) |
|
728 | + $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]), |
|
729 | + $queryBuilder->expr()->eq($table.'.sys_language_uid', (int) $languageContentId) |
|
730 | 730 | ), |
731 | - $queryBuilder->expr()->eq($table . '.l18n_parent', 0) |
|
731 | + $queryBuilder->expr()->eq($table.'.l18n_parent', 0) |
|
732 | 732 | ); |
733 | 733 | } |
734 | 734 | |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | ->select('*') |
738 | 738 | ->from($table) |
739 | 739 | ->where( |
740 | - $queryBuilder->expr()->eq($table . '.pid', $pid), |
|
740 | + $queryBuilder->expr()->eq($table.'.pid', $pid), |
|
741 | 741 | $additionalWhere, |
742 | 742 | self::whereExpression($table, true) |
743 | 743 | ) |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | } |
756 | 756 | } |
757 | 757 | } else { |
758 | - self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
758 | + self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE); |
|
759 | 759 | } |
760 | 760 | } else { |
761 | - self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING); |
|
761 | + self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING); |
|
762 | 762 | } |
763 | 763 | } |
764 | 764 | |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | return GeneralUtility::makeInstance(ConnectionPool::class) |
805 | 805 | ->getQueryBuilderForTable($table) |
806 | 806 | ->expr() |
807 | - ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
807 | + ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0); |
|
808 | 808 | } else { |
809 | 809 | self::log('Unexpected TYPO3_MODE', LOG_SEVERITY_ERROR); |
810 | 810 | return '1=-1'; |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | try { |
871 | 871 | $response = $requestFactory->request($url, 'GET', $configuration); |
872 | 872 | } catch (\Exception $e) { |
873 | - self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING); |
|
873 | + self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING); |
|
874 | 874 | return false; |
875 | 875 | } |
876 | 876 | return $response->getBody()->getContents(); |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Region |
|
24 | -{ |
|
23 | +class Region { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * @access private |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | * |
88 | 87 | * @return void |
89 | 88 | */ |
90 | - public function __construct(int $id, array $region) |
|
91 | - { |
|
89 | + public function __construct(int $id, array $region) { |
|
92 | 90 | $this->id = $id; |
93 | 91 | $this->pageId = $region['pageIdx'] ?? null; |
94 | 92 | $this->xBeginPosition = $region['ulx']; |
@@ -90,7 +90,7 @@ |
||
90 | 90 | public function __construct(int $id, array $region) |
91 | 91 | { |
92 | 92 | $this->id = $id; |
93 | - $this->pageId = $region['pageIdx'] ?? null; |
|
93 | + $this->pageId = $region['pageIdx'] ?? NULL; |
|
94 | 94 | $this->xBeginPosition = $region['ulx']; |
95 | 95 | $this->xEndPosition = $region['lrx']; |
96 | 96 | $this->yBeginPosition = $region['uly']; |
@@ -59,8 +59,8 @@ |
||
59 | 59 | |
60 | 60 | // Text field for document URL |
61 | 61 | $fieldName = 'doc'; |
62 | - $fieldId = 'task_' . $fieldName; |
|
63 | - $fieldHtml = '<input type="text" name="tx_scheduler[' . $fieldName . ']" id="' . $fieldId . '" value="' . $taskInfo[$fieldName] . '" >'; |
|
62 | + $fieldId = 'task_'.$fieldName; |
|
63 | + $fieldHtml = '<input type="text" name="tx_scheduler['.$fieldName.']" id="'.$fieldId.'" value="'.$taskInfo[$fieldName].'" >'; |
|
64 | 64 | $additionalFields[$fieldId] = [ |
65 | 65 | 'code' => $fieldHtml, |
66 | 66 | 'label' => 'LLL:EXT:dlf/Resources/Private/Language/locallang_tasks.xlf:additionalFields.doc', |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @access public |
25 | 25 | */ |
26 | -class IndexAdditionalFieldProvider extends BaseAdditionalFieldProvider |
|
27 | -{ |
|
26 | +class IndexAdditionalFieldProvider extends BaseAdditionalFieldProvider { |
|
28 | 27 | /** |
29 | 28 | * Gets additional fields to render in the form to add/edit a task |
30 | 29 | * |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module |
34 | 33 | * @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => '')) |
35 | 34 | */ |
36 | - public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
|
37 | - { |
|
35 | + public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) { |
|
38 | 36 | $currentSchedulerModuleAction = $schedulerModule->getCurrentAction(); |
39 | 37 | |
40 | 38 | /** @var BaseTask $task */ |
@@ -46,12 +46,12 @@ |
||
46 | 46 | $taskInfo['owner'] = $task->getOwner(); |
47 | 47 | $taskInfo['softCommit'] = $task->isSoftCommit(); |
48 | 48 | } else { |
49 | - $taskInfo['dryRun'] = false; |
|
49 | + $taskInfo['dryRun'] = FALSE; |
|
50 | 50 | $taskInfo['doc'] = 'https://'; |
51 | 51 | $taskInfo['pid'] = - 1; |
52 | 52 | $taskInfo['solr'] = - 1; |
53 | 53 | $taskInfo['owner'] = ''; |
54 | - $taskInfo['softCommit'] = false; |
|
54 | + $taskInfo['softCommit'] = FALSE; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $additionalFields = []; |