Passed
Pull Request — master (#123)
by
unknown
05:25
created
Classes/Controller/AbstractController.php 1 patch
Braces   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
  *
40 40
  * @abstract
41 41
  */
42
-abstract class AbstractController extends ActionController implements LoggerAwareInterface
43
-{
42
+abstract class AbstractController extends ActionController implements LoggerAwareInterface {
44 43
     use LoggerAwareTrait;
45 44
 
46 45
     /**
@@ -248,8 +247,7 @@  discard block
 block discarded – undo
248 247
      *
249 248
      * @return null|string|array
250 249
      */
251
-    protected function getParametersSafely(string $parameterName)
252
-    {
250
+    protected function getParametersSafely(string $parameterName) {
253 251
         if ($this->request->hasArgument($parameterName)) {
254 252
             return $this->request->getArgument($parameterName);
255 253
         }
@@ -444,7 +442,8 @@  discard block
 block discarded – undo
444 442
         $lastStartRecordNumberGrid = 0; // due to validity outside the loop
445 443
         foreach (range($firstPage, $lastPage) as $i) {
446 444
             // detect which pagination is active: ListView or GridView
447
-            if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') {  // ListView
445
+            if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') {
446
+// ListView
448 447
                 $lastStartRecordNumberGrid = $i; // save last $startRecordNumber for LastPage button
449 448
 
450 449
                 $pages[$i] = [
@@ -457,7 +456,8 @@  discard block
 block discarded – undo
457 456
                 if (in_array($i, $aRange)) {
458 457
                     array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $i]);
459 458
                 };
460
-            } else { // GridView
459
+            } else {
460
+// GridView
461 461
                 // to calculate the values for generation the links for the pagination pages
462 462
                 /** @var \Kitodo\Dlf\Pagination\PageGridPaginator $paginator */
463 463
                 $itemsPerPage = $paginator->getPublicItemsPerPage();
@@ -537,8 +537,7 @@  discard block
 block discarded – undo
537 537
      *
538 538
      * @return AbstractDocument
539 539
      */
540
-    private function getDocumentByUid(int $documentId)
541
-    {
540
+    private function getDocumentByUid(int $documentId) {
542 541
         // TODO: implement multiView as it is in getDocumentByUrl
543 542
         $doc = null;
544 543
         $this->document = $this->documentRepository->findOneByIdAndSettings($documentId);
@@ -563,8 +562,7 @@  discard block
 block discarded – undo
563 562
      *
564 563
      * @return AbstractDocument
565 564
      */
566
-    protected function getDocumentByUrl(string $documentId)
567
-    {
565
+    protected function getDocumentByUrl(string $documentId) {
568 566
         $doc = AbstractDocument::getInstance($documentId, $this->settings, true);
569 567
 
570 568
         if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) {
Please login to merge, or discard this patch.
Classes/Controller/OaiPmhController.php 1 patch
Braces   +19 added lines, -38 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @access public
29 29
  */
30
-class OaiPmhController extends AbstractController
31
-{
30
+class OaiPmhController extends AbstractController {
32 31
     /**
33 32
      * @access protected
34 33
      * @var TokenRepository
@@ -42,8 +41,7 @@  discard block
 block discarded – undo
42 41
      *
43 42
      * @return void
44 43
      */
45
-    public function injectTokenRepository(TokenRepository $tokenRepository)
46
-    {
44
+    public function injectTokenRepository(TokenRepository $tokenRepository) {
47 45
         $this->tokenRepository = $tokenRepository;
48 46
     }
49 47
 
@@ -60,8 +58,7 @@  discard block
 block discarded – undo
60 58
      *
61 59
      * @return void
62 60
      */
63
-    public function injectCollectionRepository(CollectionRepository $collectionRepository)
64
-    {
61
+    public function injectCollectionRepository(CollectionRepository $collectionRepository) {
65 62
         $this->collectionRepository = $collectionRepository;
66 63
     }
67 64
 
@@ -78,8 +75,7 @@  discard block
 block discarded – undo
78 75
      *
79 76
      * @return void
80 77
      */
81
-    public function injectLibraryRepository(LibraryRepository $libraryRepository)
82
-    {
78
+    public function injectLibraryRepository(LibraryRepository $libraryRepository) {
83 79
         $this->libraryRepository = $libraryRepository;
84 80
     }
85 81
 
@@ -90,8 +86,7 @@  discard block
 block discarded – undo
90 86
      *
91 87
      * @return void
92 88
      */
93
-    public function initializeAction()
94
-    {
89
+    public function initializeAction() {
95 90
         $this->request = $this->request->withFormat("xml");
96 91
     }
97 92
 
@@ -136,8 +131,7 @@  discard block
 block discarded – undo
136 131
      *
137 132
      * @return void
138 133
      */
139
-    protected function deleteExpiredTokens()
140
-    {
134
+    protected function deleteExpiredTokens() {
141 135
         // Delete expired resumption tokens.
142 136
         $this->tokenRepository->deleteExpiredTokens($this->settings['expired']);
143 137
     }
@@ -149,8 +143,7 @@  discard block
 block discarded – undo
149 143
      *
150 144
      * @return void
151 145
      */
152
-    protected function getUrlParams()
153
-    {
146
+    protected function getUrlParams() {
154 147
         $allowedParams = [
155 148
             'verb',
156 149
             'identifier',
@@ -181,8 +174,7 @@  discard block
 block discarded – undo
181 174
      *
182 175
      * @return array The mapped metadata array
183 176
      */
184
-    private function getDublinCoreData(array $record)
185
-    {
177
+    private function getDublinCoreData(array $record) {
186 178
         $metadata = [];
187 179
 
188 180
         $metadata[] = ['dc:identifier' => $record['record_id']];
@@ -224,8 +216,7 @@  discard block
 block discarded – undo
224 216
      *
225 217
      * @return void
226 218
      */
227
-    private function addDublinCoreData(&$metadata, $key, $value)
228
-    {
219
+    private function addDublinCoreData(&$metadata, $key, $value) {
229 220
         if (!empty($value)) {
230 221
             $metadata[] = [$key => $value];
231 222
         }
@@ -241,8 +232,7 @@  discard block
 block discarded – undo
241 232
      *
242 233
      * @return string The fetched METS XML
243 234
      */
244
-    protected function getMetsData(array $record)
245
-    {
235
+    protected function getMetsData(array $record) {
246 236
         $mets = null;
247 237
         // Load METS file.
248 238
         $xml = new \DOMDocument();
@@ -335,8 +325,7 @@  discard block
 block discarded – undo
335 325
      *
336 326
      * @return void
337 327
      */
338
-    protected function verbGetRecord()
339
-    {
328
+    protected function verbGetRecord() {
340 329
         if (count($this->parameters) !== 3 || empty($this->parameters['metadataPrefix']) || empty($this->parameters['identifier'])) {
341 330
             $this->error = 'badArgument';
342 331
             return;
@@ -388,8 +377,7 @@  discard block
 block discarded – undo
388 377
      *
389 378
      * @return void
390 379
      */
391
-    protected function verbIdentify()
392
-    {
380
+    protected function verbIdentify() {
393 381
         $library = $this->libraryRepository->findByUid($this->settings['library']);
394 382
 
395 383
         $oaiIdentifyInfo = [];
@@ -438,8 +426,7 @@  discard block
 block discarded – undo
438 426
      *
439 427
      * @return void
440 428
      */
441
-    protected function verbListIdentifiers()
442
-    {
429
+    protected function verbListIdentifiers() {
443 430
         // If we have a resumption token we can continue our work
444 431
         if (!empty($this->parameters['resumptionToken'])) {
445 432
             // "resumptionToken" is an exclusive argument.
@@ -493,8 +480,7 @@  discard block
 block discarded – undo
493 480
      *
494 481
      * @return void
495 482
      */
496
-    protected function verbListMetadataFormats()
497
-    {
483
+    protected function verbListMetadataFormats() {
498 484
         $resArray = [];
499 485
         // check for the optional "identifier" parameter
500 486
         if (isset($this->parameters['identifier'])) {
@@ -526,8 +512,7 @@  discard block
 block discarded – undo
526 512
      *
527 513
      * @return void
528 514
      */
529
-    protected function verbListRecords()
530
-    {
515
+    protected function verbListRecords() {
531 516
         // Check for invalid arguments.
532 517
         if (!empty($this->parameters['resumptionToken'])) {
533 518
             // "resumptionToken" is an exclusive argument.
@@ -582,8 +567,7 @@  discard block
 block discarded – undo
582 567
      *
583 568
      * @return void
584 569
      */
585
-    protected function verbListSets()
586
-    {
570
+    protected function verbListSets() {
587 571
         // It is required to set a oai_name inside the collection record to be shown in oai-pmh plugin.
588 572
         $this->settings['hideEmptyOaiNames'] = true;
589 573
 
@@ -729,8 +713,7 @@  discard block
 block discarded – undo
729 713
      *
730 714
      * @return array|false
731 715
      */
732
-    private function getDate(string $dateType)
733
-    {
716
+    private function getDate(string $dateType) {
734 717
         return strptime($this->parameters[$dateType], '%Y-%m-%dT%H:%M:%SZ') ?: strptime($this->parameters[$dateType], '%Y-%m-%d');
735 718
     }
736 719
 
@@ -785,8 +768,7 @@  discard block
 block discarded – undo
785 768
      *
786 769
      * @return array of enriched records
787 770
      */
788
-    protected function generateOutputForDocumentList(array $documentListSet)
789
-    {
771
+    protected function generateOutputForDocumentList(array $documentListSet) {
790 772
         // check whether any result elements are available
791 773
         if (empty($documentListSet) || empty($documentListSet['elements'])) {
792 774
             $this->error = 'noRecordsMatch';
@@ -841,8 +823,7 @@  discard block
 block discarded – undo
841 823
      *
842 824
      * @return void
843 825
      */
844
-    protected function generateResumptionTokenForDocumentListSet(array $documentListSet, int $numShownDocuments)
845
-    {
826
+    protected function generateResumptionTokenForDocumentListSet(array $documentListSet, int $numShownDocuments) {
846 827
         // The cursor specifies how many elements have already been returned in previous requests
847 828
         // See http://www.openarchives.org/OAI/openarchivesprotocol.html#FlowControl
848 829
         $currentCursor = $documentListSet['metadata']['cursor'];
Please login to merge, or discard this patch.
Classes/Controller/AnnotationController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
  * @subpackage dlf
23 23
  * @access public
24 24
  */
25
-class AnnotationController extends AbstractController
26
-{
25
+class AnnotationController extends AbstractController {
27 26
     /**
28 27
      * The main method of the plugin
29 28
      *
Please login to merge, or discard this patch.
Classes/Controller/PageViewController.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @access public
33 33
  */
34
-class PageViewController extends AbstractController
35
-{
34
+class PageViewController extends AbstractController {
36 35
     /**
37 36
      * @access protected
38 37
      * @var array Holds the controls to add to the map
@@ -258,8 +257,7 @@  discard block
 block discarded – undo
258 257
      * @param $page
259 258
      * @return false|int|mixed|string|null
260 259
      */
261
-    public function convertMeasureOrPage($document, $measure = null, $page = null)
262
-    {
260
+    public function convertMeasureOrPage($document, $measure = null, $page = null) {
263 261
         $return = null;
264 262
         $measure2Page = array_column($document->musicalStructure, 'page');
265 263
         if ($measure) {
@@ -370,8 +368,7 @@  discard block
 block discarded – undo
370 368
      *
371 369
      * @return array URL and MIME type of fulltext file
372 370
      */
373
-    protected function getScore(int $page, MetsDocument $specificDoc = null)
374
-    {
371
+    protected function getScore(int $page, MetsDocument $specificDoc = null) {
375 372
         $score = [];
376 373
         $loc = '';
377 374
         if ($specificDoc) {
Please login to merge, or discard this patch.
Classes/Common/Solr/SolrSearchQuery.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
  * @property int $limit
17 17
  * @property int $offset
18 18
  */
19
-class SolrSearchQuery extends Query
20
-{
19
+class SolrSearchQuery extends Query {
21 20
     /**
22 21
      * @access private
23 22
      * @var SolrSearch
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function __construct($solrSearch)
37
-    {
35
+    public function __construct($solrSearch) {
38 36
         $this->solrSearch = $solrSearch;
39 37
 
40 38
         $this->offset = 0;
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      */
53 51
     // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable<object>&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute()
54 52
     // @phpstan-ignore-next-line
55
-    public function execute($returnRawQueryResult = false)
56
-    {
53
+    public function execute($returnRawQueryResult = false) {
57 54
         $this->solrSearch->submit($this->offset, $this->limit);
58 55
 
59 56
         // solrSearch now only contains the results in range, indexed in [0, n)
Please login to merge, or discard this patch.
Tests/Functional/Api/OaiPmhTest.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 use Phpoaipmh\Exception\OaipmhException;
22 22
 use SimpleXMLElement;
23 23
 
24
-class OaiPmhTest extends FunctionalTestCase
25
-{
24
+class OaiPmhTest extends FunctionalTestCase {
26 25
     protected $disableJsonWrappedResponse = true;
27 26
 
28 27
     protected array $coreExtensionsToLoad = [
@@ -66,8 +65,7 @@  discard block
 block discarded – undo
66 65
         $this->setUpOaiSolr();
67 66
     }
68 67
 
69
-    protected function setUpOaiSolr()
70
-    {
68
+    protected function setUpOaiSolr() {
71 69
         // Setup Solr only once for all tests in this suite
72 70
         static $solr = null;
73 71
 
@@ -87,8 +85,7 @@  discard block
 block discarded – undo
87 85
     /**
88 86
      * @test
89 87
      */
90
-    public function correctlyRespondsOnBadVerb()
91
-    {
88
+    public function correctlyRespondsOnBadVerb() {
92 89
         $client = new HttpClient();
93 90
         $response = $client->get($this->baseUrl, [
94 91
             'query' => [
@@ -113,8 +110,7 @@  discard block
 block discarded – undo
113 110
     /**
114 111
      * @test
115 112
      */
116
-    public function canIdentify()
117
-    {
113
+    public function canIdentify() {
118 114
         $oai = Endpoint::build($this->oaiUrl);
119 115
         $identity = $oai->identify();
120 116
 
@@ -127,8 +123,7 @@  discard block
 block discarded – undo
127 123
     /**
128 124
      * @test
129 125
      */
130
-    public function identifyGivesFallbackDatestampWhenNoDocuments()
131
-    {
126
+    public function identifyGivesFallbackDatestampWhenNoDocuments() {
132 127
         $oai = Endpoint::build($this->oaiUrlNoStoragePid);
133 128
         $identity = $oai->identify();
134 129
 
@@ -138,8 +133,7 @@  discard block
 block discarded – undo
138 133
     /**
139 134
      * @test
140 135
      */
141
-    public function canListMetadataFormats()
142
-    {
136
+    public function canListMetadataFormats() {
143 137
         $oai = Endpoint::build($this->oaiUrl);
144 138
         $formats = $oai->listMetadataFormats();
145 139
 
@@ -154,8 +148,7 @@  discard block
 block discarded – undo
154 148
     /**
155 149
      * @test
156 150
      */
157
-    public function canListRecords()
158
-    {
151
+    public function canListRecords() {
159 152
         $oai = Endpoint::build($this->oaiUrl);
160 153
         $result = $oai->listRecords('mets');
161 154
 
@@ -168,8 +161,7 @@  discard block
 block discarded – undo
168 161
     /**
169 162
      * @test
170 163
      */
171
-    public function noRecordsUntil1900()
172
-    {
164
+    public function noRecordsUntil1900() {
173 165
         $this->expectException(OaipmhException::class);
174 166
         $this->expectExceptionMessage('empty list');
175 167
 
@@ -182,8 +174,7 @@  discard block
 block discarded – undo
182 174
     /**
183 175
      * @test
184 176
      */
185
-    public function canUseResumptionToken()
186
-    {
177
+    public function canUseResumptionToken() {
187 178
         // NOTE: cursor and expirationDate are optional by the specification,
188 179
         //       but we include them in our implementation
189 180
 
@@ -241,8 +232,7 @@  discard block
 block discarded – undo
241 232
     /**
242 233
      * @test
243 234
      */
244
-    public function noResumptionTokenForCompleteList()
245
-    {
235
+    public function noResumptionTokenForCompleteList() {
246 236
         $client = new HttpClient();
247 237
 
248 238
         foreach (['ListIdentifiers', 'ListRecords'] as $verb) {
@@ -264,8 +254,7 @@  discard block
 block discarded – undo
264 254
     /**
265 255
      * @test
266 256
      */
267
-    public function canListAndResumeIdentifiers()
268
-    {
257
+    public function canListAndResumeIdentifiers() {
269 258
         $oai = Endpoint::build($this->oaiUrl);
270 259
         $result = $oai->listIdentifiers('mets');
271 260
 
@@ -278,18 +267,15 @@  discard block
 block discarded – undo
278 267
         self::assertEquals('oai:de:slub-dresden:db:id-476248086', $record->identifier);
279 268
     }
280 269
 
281
-    protected function parseUtc(string $dateTime)
282
-    {
270
+    protected function parseUtc(string $dateTime) {
283 271
         return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $dateTime);
284 272
     }
285 273
 
286
-    protected function assertUtcDateString(string $dateTime)
287
-    {
274
+    protected function assertUtcDateString(string $dateTime) {
288 275
         self::assertInstanceOf(DateTime::class, $this->parseUtc($dateTime));
289 276
     }
290 277
 
291
-    protected function assertInFuture(string $dateTime)
292
-    {
278
+    protected function assertInFuture(string $dateTime) {
293 279
         self::assertGreaterThan(new DateTime(), $this->parseUtc($dateTime));
294 280
     }
295 281
 }
Please login to merge, or discard this patch.
Tests/Functional/FunctionalTestCase.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected $httpClient;
91 91
 
92
-    public function __construct()
93
-    {
92
+    public function __construct() {
94 93
         parent::__construct();
95 94
 
96 95
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
@@ -117,8 +116,7 @@  discard block
 block discarded – undo
117 116
         $this->addSiteConfig('dlf-testing');
118 117
     }
119 118
 
120
-    protected function getDlfConfiguration()
121
-    {
119
+    protected function getDlfConfiguration() {
122 120
         $dotenv = Dotenv::createImmutable('/home/runner/work/kitodo-presentation/kitodo-presentation/Build/Test/', 'test.env');
123 121
         $dotenv->load();
124 122
 
@@ -167,8 +165,7 @@  discard block
 block discarded – undo
167 165
         ];
168 166
     }
169 167
 
170
-    protected function addSiteConfig($identifier)
171
-    {
168
+    protected function addSiteConfig($identifier) {
172 169
         $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
173 170
         $siteConfig['base'] = $this->baseUrl;
174 171
         $siteConfig['languages'][0]['base'] = $this->baseUrl;
@@ -182,8 +179,7 @@  discard block
 block discarded – undo
182 179
         $finder->getAllSites(false); // useCache = false
183 180
     }
184 181
 
185
-    protected function initializeRepository(string $className, int $storagePid)
186
-    {
182
+    protected function initializeRepository(string $className, int $storagePid) {
187 183
         $repository = GeneralUtility::makeInstance($className);
188 184
         $querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
189 185
         $querySettings->setStoragePageIds([$storagePid]);
@@ -192,8 +188,7 @@  discard block
 block discarded – undo
192 188
         return $repository;
193 189
     }
194 190
 
195
-    protected function importSolrDocuments(Solr $solr, string $path)
196
-    {
191
+    protected function importSolrDocuments(Solr $solr, string $path) {
197 192
         $jsonDocuments = json_decode(file_get_contents($path), true);
198 193
 
199 194
         $updateQuery = $solr->service->createUpdate();
@@ -212,8 +207,7 @@  discard block
 block discarded – undo
212 207
         $solr->service->update($updateQuery);
213 208
     }
214 209
 
215
-    protected function initLanguageService(string $locale)
216
-    {
210
+    protected function initLanguageService(string $locale) {
217 211
         // create mock backend user and set language
218 212
         // which is loaded by LanguageServiceFactory as default value in backend mode
219 213
         $backendUser = GeneralUtility::makeInstance(BackendUserAuthentication::class);
@@ -224,8 +218,7 @@  discard block
 block discarded – undo
224 218
     /**
225 219
      * Assert that $sub is recursively contained within $super.
226 220
      */
227
-    protected function assertArrayMatches(array $sub, array $super, string $message = '')
228
-    {
221
+    protected function assertArrayMatches(array $sub, array $super, string $message = '') {
229 222
         self::assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message);
230 223
     }
231 224
 }
Please login to merge, or discard this patch.
Classes/Updates/UpdateSolrSchema.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
27 27
  *
28 28
  * @internal
29 29
  */
30
-class UpdateSolrSchema implements UpgradeWizardInterface
31
-{
30
+class UpdateSolrSchema implements UpgradeWizardInterface {
32 31
 
33 32
     /**
34 33
      * Return the identifier for this wizard
Please login to merge, or discard this patch.