Passed
Pull Request — master (#123)
by Sebastian
03:12
created
Classes/Common/SolrSearch.php 3 patches
Braces   +22 added lines, -44 removed lines patch added patch discarded remove patch
@@ -33,8 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param array $searchParams
34 34
      * @param QueryResult $listedMetadata
35 35
      */
36
-    public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null)
37
-    {
36
+    public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null) {
38 37
         $this->documentRepository = $documentRepository;
39 38
         $this->collection = $collection;
40 39
         $this->settings = $settings;
@@ -42,13 +41,11 @@  discard block
 block discarded – undo
42 41
         $this->listedMetadata = $listedMetadata;
43 42
     }
44 43
 
45
-    public function getNumLoadedDocuments()
46
-    {
44
+    public function getNumLoadedDocuments() {
47 45
         return count($this->result['documents']);
48 46
     }
49 47
 
50
-    public function count()
51
-    {
48
+    public function count() {
52 49
         if ($this->result === null) {
53 50
             return 0;
54 51
         }
@@ -56,39 +53,32 @@  discard block
 block discarded – undo
56 53
         return $this->result['numberOfToplevels'];
57 54
     }
58 55
 
59
-    public function current()
60
-    {
56
+    public function current() {
61 57
         return $this[$this->position];
62 58
     }
63 59
 
64
-    public function key()
65
-    {
60
+    public function key() {
66 61
         return $this->position;
67 62
     }
68 63
 
69
-    public function next()
70
-    {
64
+    public function next() {
71 65
         $this->position++;
72 66
     }
73 67
 
74
-    public function rewind()
75
-    {
68
+    public function rewind() {
76 69
         $this->position = 0;
77 70
     }
78 71
 
79
-    public function valid()
80
-    {
72
+    public function valid() {
81 73
         return isset($this[$this->position]);
82 74
     }
83 75
 
84
-    public function offsetExists($offset)
85
-    {
76
+    public function offsetExists($offset) {
86 77
         $idx = $this->result['document_keys'][$offset];
87 78
         return isset($this->result['documents'][$idx]);
88 79
     }
89 80
 
90
-    public function offsetGet($offset)
91
-    {
81
+    public function offsetGet($offset) {
92 82
         $idx = $this->result['document_keys'][$offset];
93 83
         $document = $this->result['documents'][$idx] ?? null;
94 84
 
@@ -116,38 +106,31 @@  discard block
 block discarded – undo
116 106
         return $document;
117 107
     }
118 108
 
119
-    public function offsetSet($offset, $value)
120
-    {
109
+    public function offsetSet($offset, $value) {
121 110
         throw new \Exception("SolrSearch: Modifying result list is not supported");
122 111
     }
123 112
 
124
-    public function offsetUnset($offset)
125
-    {
113
+    public function offsetUnset($offset) {
126 114
         throw new \Exception("SolrSearch: Modifying result list is not supported");
127 115
     }
128 116
 
129
-    public function getSolrResults()
130
-    {
117
+    public function getSolrResults() {
131 118
         return $this->result['solrResults'];
132 119
     }
133 120
 
134
-    public function getByUid($uid)
135
-    {
121
+    public function getByUid($uid) {
136 122
         return $this->result['documents'][$uid];
137 123
     }
138 124
 
139
-    public function getQuery()
140
-    {
125
+    public function getQuery() {
141 126
         return new SolrSearchQuery($this);
142 127
     }
143 128
 
144
-    public function getFirst()
145
-    {
129
+    public function getFirst() {
146 130
         return $this[0];
147 131
     }
148 132
 
149
-    public function toArray()
150
-    {
133
+    public function toArray() {
151 134
         return array_values($this->result['documents']);
152 135
     }
153 136
 
@@ -156,13 +139,11 @@  discard block
 block discarded – undo
156 139
      *
157 140
      * This can be accessed in Fluid template using `.numFound`.
158 141
      */
159
-    public function getNumFound()
160
-    {
142
+    public function getNumFound() {
161 143
         return $this->result['numFound'];
162 144
     }
163 145
 
164
-    public function prepare()
165
-    {
146
+    public function prepare() {
166 147
         // Prepare query parameters.
167 148
         $params = [];
168 149
         $matches = [];
@@ -285,8 +266,7 @@  discard block
 block discarded – undo
285 266
         $this->submit(0, 1, false);
286 267
     }
287 268
 
288
-    public function submit($start, $rows, $processResults = true)
289
-    {
269
+    public function submit($start, $rows, $processResults = true) {
290 270
         $params = $this->params;
291 271
         $params['start'] = $start;
292 272
         $params['rows'] = $rows;
@@ -383,8 +363,7 @@  discard block
 block discarded – undo
383 363
      * @param int $queryParams
384 364
      * @return array
385 365
      */
386
-    protected function fetchToplevelMetadataFromSolr($queryParams)
387
-    {
366
+    protected function fetchToplevelMetadataFromSolr($queryParams) {
388 367
         // Prepare query parameters.
389 368
         $params = $queryParams;
390 369
         $metadataArray = [];
@@ -427,8 +406,7 @@  discard block
 block discarded – undo
427 406
      *
428 407
      * @return array The Apache Solr Documents that were fetched
429 408
      */
430
-    protected function searchSolr($parameters = [], $enableCache = true)
431
-    {
409
+    protected function searchSolr($parameters = [], $enableCache = true) {
432 410
         // Set query.
433 411
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
434 412
         $parameters['filterquery'] = isset($parameters['filterquery']) ? $parameters['filterquery'] : [];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param array $searchParams
34 34
      * @param QueryResult $listedMetadata
35 35
      */
36
-    public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = null)
36
+    public function __construct($documentRepository, $collection, $settings, $searchParams, $listedMetadata = NULL)
37 37
     {
38 38
         $this->documentRepository = $documentRepository;
39 39
         $this->collection = $collection;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function count()
51 51
     {
52
-        if ($this->result === null) {
52
+        if ($this->result === NULL) {
53 53
             return 0;
54 54
         }
55 55
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
     public function offsetGet($offset)
91 91
     {
92 92
         $idx = $this->result['document_keys'][$offset];
93
-        $document = $this->result['documents'][$idx] ?? null;
93
+        $document = $this->result['documents'][$idx] ?? NULL;
94 94
 
95
-        if ($document !== null) {
95
+        if ($document !== NULL) {
96 96
             // It may happen that a Solr group only includes non-toplevel results,
97 97
             // in which case metadata of toplevel entry isn't yet filled.
98 98
             if (empty($document['metadata'])) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
             // get title of parent/grandparent/... if empty
108 108
             if (empty($document['title']) && $document['partOf'] > 0) {
109
-                $superiorTitle = Doc::getTitle($document['partOf'], true);
109
+                $superiorTitle = Doc::getTitle($document['partOf'], TRUE);
110 110
                 if (!empty($superiorTitle)) {
111 111
                     $document['title'] = '[' . $superiorTitle . ']';
112 112
                 }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             if (!empty($this->searchParams['query'])) {
180 180
                 $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
181 181
             }
182
-            $params['fulltext'] = true;
182
+            $params['fulltext'] = TRUE;
183 183
         } else {
184 184
             // Retain given search field if valid.
185 185
             if (!empty($this->searchParams['query'])) {
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
         $this->params = $params;
283 283
 
284 284
         // Send off query to get total number of search results in advance
285
-        $this->submit(0, 1, false);
285
+        $this->submit(0, 1, FALSE);
286 286
     }
287 287
 
288
-    public function submit($start, $rows, $processResults = true)
288
+    public function submit($start, $rows, $processResults = TRUE)
289 289
     {
290 290
         $params = $this->params;
291 291
         $params['start'] = $start;
292 292
         $params['rows'] = $rows;
293 293
 
294 294
         // Perform search.
295
-        $result = $this->searchSolr($params, true);
295
+        $result = $this->searchSolr($params, TRUE);
296 296
 
297 297
         // Initialize values
298 298
         $documents = [];
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                     $documents[$doc['uid']] = $allDocuments[$doc['uid']];
317 317
                 }
318 318
                 if ($documents[$doc['uid']]) {
319
-                    if ($doc['toplevel'] === false) {
319
+                    if ($doc['toplevel'] === FALSE) {
320 320
                         // this maybe a chapter, article, ..., year
321 321
                         if ($doc['type'] === 'year') {
322 322
                             continue;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                             }
341 341
                             $documents[$doc['uid']]['searchResults'][] = $searchResult;
342 342
                         }
343
-                    } else if ($doc['toplevel'] === true) {
343
+                    } else if ($doc['toplevel'] === TRUE) {
344 344
                         foreach ($params['listMetadataRecords'] as $indexName => $solrField) {
345 345
                             if (isset($doc['metadata'][$indexName])) {
346 346
                                 $documents[$doc['uid']]['metadata'][$indexName] = $doc['metadata'][$indexName];
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
         $params['filterquery'][] = ['query' => 'toplevel:true'];
409 409
 
410 410
         // Perform search.
411
-        $result = $this->searchSolr($params, true);
411
+        $result = $this->searchSolr($params, TRUE);
412 412
 
413 413
         foreach ($result['documents'] as $doc) {
414 414
             $metadataArray[$doc['uid']] = $doc['metadata'];
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      *
428 428
      * @return array The Apache Solr Documents that were fetched
429 429
      */
430
-    protected function searchSolr($parameters = [], $enableCache = true)
430
+    protected function searchSolr($parameters = [], $enableCache = TRUE)
431 431
     {
432 432
         // Set query.
433 433
         $parameters['query'] = isset($parameters['query']) ? $parameters['query'] : '*';
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
         }
447 447
 
448 448
         $cacheIdentifier = '';
449
-        $cache = null;
449
+        $cache = NULL;
450 450
         // Calculate cache identifier.
451
-        if ($enableCache === true) {
452
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
451
+        if ($enableCache === TRUE) {
452
+            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, TRUE));
453 453
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
454 454
         }
455 455
         $resultSet = [
@@ -457,22 +457,22 @@  discard block
 block discarded – undo
457 457
             'numberOfToplevels' => 0,
458 458
             'numFound' => 0,
459 459
         ];
460
-        if ($enableCache === false || ($entry = $cache->get($cacheIdentifier)) === false) {
460
+        if ($enableCache === FALSE || ($entry = $cache->get($cacheIdentifier)) === FALSE) {
461 461
             $selectQuery = $solr->service->createSelect($parameters);
462 462
 
463 463
             $grouping = $selectQuery->getGrouping();
464 464
             $grouping->addField('uid');
465 465
             $grouping->setLimit(100); // Results in group (TODO: check)
466
-            $grouping->setNumberOfGroups(true);
466
+            $grouping->setNumberOfGroups(TRUE);
467 467
 
468
-            if ($parameters['fulltext'] === true) {
468
+            if ($parameters['fulltext'] === TRUE) {
469 469
                 // get highlighting component and apply settings
470 470
                 $selectQuery->getHighlighting();
471 471
             }
472 472
 
473 473
             $solrRequest = $solr->service->createRequest($selectQuery);
474 474
 
475
-            if ($parameters['fulltext'] === true) {
475
+            if ($parameters['fulltext'] === TRUE) {
476 476
                 // If it is a fulltext search, enable highlighting.
477 477
                 // field for which highlighting is going to be performed,
478 478
                 // is required if you want to have OCR highlighting
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
             $resultSet['numberOfToplevels'] = $uidGroup->getNumberOfGroups();
494 494
             $resultSet['numFound'] = $uidGroup->getMatches();
495 495
             $highlighting = [];
496
-            if ($parameters['fulltext'] === true) {
496
+            if ($parameters['fulltext'] === TRUE) {
497 497
                 $data = $result->getData();
498 498
                 $highlighting = $data['ocrHighlighting'];
499 499
             }
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             }
525 525
 
526 526
             // Save value in cache.
527
-            if (!empty($resultSet) && $enableCache === true) {
527
+            if (!empty($resultSet) && $enableCache === TRUE) {
528 528
                 $cache->set($cacheIdentifier, $resultSet);
529 529
             }
530 530
         } else {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             // in which case metadata of toplevel entry isn't yet filled.
98 98
             if (empty($document['metadata'])) {
99 99
                 $document['metadata'] = $this->fetchToplevelMetadataFromSolr([
100
-                    'query' => 'uid:' . $document['uid'],
100
+                    'query' => 'uid:'.$document['uid'],
101 101
                     'start' => 0,
102 102
                     'rows' => 1,
103 103
                     'sort' => ['score' => 'desc'],
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             if (empty($document['title']) && $document['partOf'] > 0) {
109 109
                 $superiorTitle = Doc::getTitle($document['partOf'], true);
110 110
                 if (!empty($superiorTitle)) {
111
-                    $document['title'] = '[' . $superiorTitle . ']';
111
+                    $document['title'] = '['.$superiorTitle.']';
112 112
                 }
113 113
             }
114 114
         }
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
         // Set search query.
172 172
         if (
173 173
             (!empty($this->searchParams['fulltext']))
174
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($this->searchParams['query']), $matches)
174
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($this->searchParams['query']), $matches)
175 175
         ) {
176 176
             // If the query already is a fulltext query e.g using the facets
177 177
             $this->searchParams['query'] = empty($matches[1]) ? $this->searchParams['query'] : $matches[1];
178 178
             // Search in fulltext field if applicable. Query must not be empty!
179 179
             if (!empty($this->searchParams['query'])) {
180
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($this->searchParams['query'])) . ')';
180
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($this->searchParams['query'])).')';
181 181
             }
182 182
             $params['fulltext'] = true;
183 183
         } else {
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
                         in_array($this->searchParams['extOperator'][$i], $allowedOperators)
201 201
                     ) {
202 202
                         if (!empty($query)) {
203
-                            $query .= ' ' . $this->searchParams['extOperator'][$i] . ' ';
203
+                            $query .= ' '.$this->searchParams['extOperator'][$i].' ';
204 204
                         }
205
-                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($this->searchParams['extQuery'][$i]) . ')';
205
+                        $query .= Indexer::getIndexFieldName($this->searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($this->searchParams['extQuery'][$i]).')';
206 206
                     }
207 207
                 }
208 208
             }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         // Add filter query for date search
212 212
         if (!empty($this->searchParams['dateFrom']) && !empty($this->searchParams['dateTo'])) {
213 213
             // combine dateFrom and dateTo into range search
214
-            $params['filterquery'][]['query'] = '{!join from=' . $fields['uid'] . ' to=' . $fields['uid'] . '}'. $fields['date'] . ':[' . $this->searchParams['dateFrom'] . ' TO ' . $this->searchParams['dateTo'] . ']';
214
+            $params['filterquery'][]['query'] = '{!join from='.$fields['uid'].' to='.$fields['uid'].'}'.$fields['date'].':['.$this->searchParams['dateFrom'].' TO '.$this->searchParams['dateTo'].']';
215 215
         }
216 216
 
217 217
         // Add filter query for faceting.
@@ -228,22 +228,22 @@  discard block
 block discarded – undo
228 228
         ) {
229 229
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
230 230
             $params['filterquery'][]['query'] = '_query_:"{!join from='
231
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
232
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
233
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . '"' . ' OR {!join from='
234
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
235
-                . $fields['uid'] . ':' . $this->searchParams['documentId'] . ' OR '
236
-                . $fields['uid'] . ':' . $this->searchParams['documentId'];
231
+                . $fields['uid'].' to='.$fields['partof'].'}'
232
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
233
+                . $fields['uid'].':'.$this->searchParams['documentId'].'"'.' OR {!join from='
234
+                . $fields['uid'].' to='.$fields['partof'].'}'
235
+                . $fields['uid'].':'.$this->searchParams['documentId'].' OR '
236
+                . $fields['uid'].':'.$this->searchParams['documentId'];
237 237
         }
238 238
 
239 239
         // if a collection is given, we prepare the collection query string
240 240
         if ($this->collection) {
241 241
             if ($this->collection instanceof Collection) {
242
-                $collectionsQueryString = '"' . $this->collection->getIndexName() . '"';
242
+                $collectionsQueryString = '"'.$this->collection->getIndexName().'"';
243 243
             } else {
244 244
                 $collectionsQueryString = '';
245 245
                 foreach ($this->collection as $index => $collectionEntry) {
246
-                    $collectionsQueryString .= ($index > 0 ? ' OR ' : '') . '"' . $collectionEntry->getIndexName() . '"';
246
+                    $collectionsQueryString .= ($index > 0 ? ' OR ' : '').'"'.$collectionEntry->getIndexName().'"';
247 247
                 }
248 248
             }
249 249
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $params['filterquery'][]['query'] = 'toplevel:true';
252 252
                 $params['filterquery'][]['query'] = 'partof:0';
253 253
             }
254
-            $params['filterquery'][]['query'] = 'collection_faceting:(' . $collectionsQueryString . ')';
254
+            $params['filterquery'][]['query'] = 'collection_faceting:('.$collectionsQueryString.')';
255 255
         }
256 256
 
257 257
         // Set some query parameters.
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
         if ($this->listedMetadata) {
279 279
             foreach ($this->listedMetadata as $metadata) {
280 280
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
281
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
282
-                    $params['fields'] .= ',' . $listMetadataRecord;
281
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
282
+                    $params['fields'] .= ','.$listMetadataRecord;
283 283
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
284 284
                 }
285 285
             }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
                             $children = $childrenOf[$doc['uid']] ?? [];
358 358
                             if (!empty($children)) {
359 359
                                 $metadataOf = $this->fetchToplevelMetadataFromSolr([
360
-                                    'query' => 'partof:' . $doc['uid'],
360
+                                    'query' => 'partof:'.$doc['uid'],
361 361
                                     'start' => 0,
362 362
                                     'rows' => 100,
363 363
                                 ]);
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
         if ($this->listedMetadata) {
405 405
             foreach ($this->listedMetadata as $metadata) {
406 406
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
407
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
408
-                    $params['fields'] .= ',' . $listMetadataRecord;
407
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
408
+                    $params['fields'] .= ','.$listMetadataRecord;
409 409
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
410 410
                 }
411 411
             }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         $cache = null;
456 456
         // Calculate cache identifier.
457 457
         if ($enableCache === true) {
458
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
458
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
459 459
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
460 460
         }
461 461
         $resultSet = [
Please login to merge, or discard this patch.
Classes/Common/Helper.php 3 patches
Braces   +24 added lines, -48 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  * @subpackage dlf
33 33
  * @access public
34 34
  */
35
-class Helper
36
-{
35
+class Helper {
37 36
     /**
38 37
      * The extension key
39 38
      *
@@ -81,8 +80,7 @@  discard block
 block discarded – undo
81 80
      *
82 81
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
83 82
      */
84
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
85
-    {
83
+    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') {
86 84
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
87 85
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
88 86
         $flashMessage = GeneralUtility::makeInstance(
@@ -107,8 +105,7 @@  discard block
 block discarded – undo
107 105
      *
108 106
      * @return bool Is $id a valid GNL identifier of the given $type?
109 107
      */
110
-    public static function checkIdentifier($id, $type)
111
-    {
108
+    public static function checkIdentifier($id, $type) {
112 109
         $digits = substr($id, 0, 8);
113 110
         $checksum = 0;
114 111
         for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
@@ -172,8 +169,7 @@  discard block
 block discarded – undo
172 169
      *
173 170
      * @return mixed The decrypted value or false on error
174 171
      */
175
-    public static function decrypt($encrypted)
176
-    {
172
+    public static function decrypt($encrypted) {
177 173
         if (
178 174
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
179 175
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -212,8 +208,7 @@  discard block
 block discarded – undo
212 208
      *
213 209
      * @return \SimpleXMLElement|false
214 210
      */
215
-    public static function getXmlFileAsString($content)
216
-    {
211
+    public static function getXmlFileAsString($content) {
217 212
         // Don't make simplexml_load_string throw (when $content is an array
218 213
         // or object)
219 214
         if (!is_string($content)) {
@@ -244,8 +239,7 @@  discard block
 block discarded – undo
244 239
      *
245 240
      * @return void
246 241
      */
247
-    public static function log($message, $severity = 0)
248
-    {
242
+    public static function log($message, $severity = 0) {
249 243
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class());
250 244
 
251 245
         switch ($severity) {
@@ -275,8 +269,7 @@  discard block
 block discarded – undo
275 269
      *
276 270
      * @return mixed Hashed string or false on error
277 271
      */
278
-    public static function digest($string)
279
-    {
272
+    public static function digest($string) {
280 273
         if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
281 274
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
282 275
             return false;
@@ -295,8 +288,7 @@  discard block
 block discarded – undo
295 288
      *
296 289
      * @return mixed Encrypted string or false on error
297 290
      */
298
-    public static function encrypt($string)
299
-    {
291
+    public static function encrypt($string) {
300 292
         if (
301 293
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
302 294
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -329,8 +321,7 @@  discard block
 block discarded – undo
329 321
      *
330 322
      * @return string The unqualified class name
331 323
      */
332
-    public static function getUnqualifiedClassName($qualifiedClassname)
333
-    {
324
+    public static function getUnqualifiedClassName($qualifiedClassname) {
334 325
         $nameParts = explode('\\', $qualifiedClassname);
335 326
         return end($nameParts);
336 327
     }
@@ -344,8 +335,7 @@  discard block
 block discarded – undo
344 335
      *
345 336
      * @return string The cleaned up string
346 337
      */
347
-    public static function getCleanString($string)
348
-    {
338
+    public static function getCleanString($string) {
349 339
         // Convert to lowercase.
350 340
         $string = strtolower($string);
351 341
         // Remove non-alphanumeric characters.
@@ -366,8 +356,7 @@  discard block
 block discarded – undo
366 356
      *
367 357
      * @return array Array of hook objects for the class
368 358
      */
369
-    public static function getHookObjects($scriptRelPath)
370
-    {
359
+    public static function getHookObjects($scriptRelPath) {
371 360
         $hookObjects = [];
372 361
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
373 362
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
@@ -388,8 +377,7 @@  discard block
 block discarded – undo
388 377
      *
389 378
      * @return string "index_name" for the given UID
390 379
      */
391
-    public static function getIndexNameFromUid($uid, $table, $pid = -1)
392
-    {
380
+    public static function getIndexNameFromUid($uid, $table, $pid = -1) {
393 381
         // Sanitize input.
394 382
         $uid = max(intval($uid), 0);
395 383
         if (
@@ -447,8 +435,7 @@  discard block
 block discarded – undo
447 435
      *
448 436
      * @return string Localized full name of language or unchanged input
449 437
      */
450
-    public static function getLanguageName($code)
451
-    {
438
+    public static function getLanguageName($code) {
452 439
         // Analyze code and set appropriate ISO table.
453 440
         $isoCode = strtolower(trim($code));
454 441
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
@@ -475,8 +462,7 @@  discard block
 block discarded – undo
475 462
      *
476 463
      * @return array
477 464
      */
478
-    public static function getDocumentStructures($pid = -1)
479
-    {
465
+    public static function getDocumentStructures($pid = -1) {
480 466
         // TODO: Against redundancy with getIndexNameFromUid
481 467
 
482 468
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
@@ -518,8 +504,7 @@  discard block
 block discarded – undo
518 504
      *
519 505
      * @return string Uniform Resource Name as string
520 506
      */
521
-    public static function getURN($base, $id)
522
-    {
507
+    public static function getURN($base, $id) {
523 508
         $concordance = [
524 509
             '0' => 1,
525 510
             '1' => 2,
@@ -586,8 +571,7 @@  discard block
 block discarded – undo
586 571
      *
587 572
      * @return bool Is $id a valid PPN?
588 573
      */
589
-    public static function isPPN($id)
590
-    {
574
+    public static function isPPN($id) {
591 575
         return self::checkIdentifier($id, 'PPN');
592 576
     }
593 577
 
@@ -598,8 +582,7 @@  discard block
 block discarded – undo
598 582
      *
599 583
      * @return bool
600 584
      */
601
-    public static function isValidHttpUrl($url)
602
-    {
585
+    public static function isValidHttpUrl($url) {
603 586
         if (!GeneralUtility::isValidUrl($url)) {
604 587
             return false;
605 588
         }
@@ -625,8 +608,7 @@  discard block
 block discarded – undo
625 608
      *
626 609
      * @return array Merged array
627 610
      */
628
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
629
-    {
611
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
630 612
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
631 613
         return $original;
632 614
     }
@@ -640,8 +622,7 @@  discard block
 block discarded – undo
640 622
      *
641 623
      * @return string All flash messages in the queue rendered as HTML.
642 624
      */
643
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
644
-    {
625
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
645 626
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
646 627
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
647 628
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -661,8 +642,7 @@  discard block
 block discarded – undo
661 642
      *
662 643
      * @return string Localized label for $index_name
663 644
      */
664
-    public static function translate($index_name, $table, $pid)
665
-    {
645
+    public static function translate($index_name, $table, $pid) {
666 646
         // Load labels into static variable for future use.
667 647
         static $labels = [];
668 648
         // Sanitize input.
@@ -790,8 +770,7 @@  discard block
 block discarded – undo
790 770
      *
791 771
      * @return string Additional WHERE expression
792 772
      */
793
-    public static function whereExpression($table, $showHidden = false)
794
-    {
773
+    public static function whereExpression($table, $showHidden = false) {
795 774
         if (\TYPO3_MODE === 'FE') {
796 775
             // Should we ignore the record's hidden flag?
797 776
             $ignoreHide = 0;
@@ -823,8 +802,7 @@  discard block
 block discarded – undo
823 802
      *
824 803
      * @access private
825 804
      */
826
-    private function __construct()
827
-    {
805
+    private function __construct() {
828 806
         // This is a static class, thus no instances should be created.
829 807
     }
830 808
 
@@ -850,8 +828,7 @@  discard block
 block discarded – undo
850 828
      *
851 829
      * @access public
852 830
      */
853
-    public static function polyfillExtbaseClassesForTYPO3v9()
854
-    {
831
+    public static function polyfillExtbaseClassesForTYPO3v9() {
855 832
         $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
856 833
 
857 834
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
@@ -888,8 +865,7 @@  discard block
 block discarded – undo
888 865
      *
889 866
      * @return string|bool
890 867
      */
891
-    public static function getUrl(string $url)
892
-    {
868
+    public static function getUrl(string $url) {
893 869
         if (!Helper::isValidHttpUrl($url)) {
894 870
             return false;
895 871
         }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 if (!preg_match('/\d{8}-\d{1}/i', $id)) {
144 144
                     return false;
145 145
                 } elseif ($checksum == 10) {
146
-                    return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
146
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
147 147
                 } elseif (substr($id, -1, 1) != $checksum) {
148 148
                     return false;
149 149
                 }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
316 316
         // Merge initialisation vector and encrypted data.
317 317
         if ($encrypted !== false) {
318
-            $encrypted = base64_encode($iv . $encrypted);
318
+            $encrypted = base64_encode($iv.$encrypted);
319 319
         }
320 320
         return $encrypted;
321 321
     }
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
     public static function getHookObjects($scriptRelPath)
370 370
     {
371 371
         $hookObjects = [];
372
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
373
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
372
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
373
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
374 374
                 $hookObjects[] = GeneralUtility::makeInstance($classRef);
375 375
             }
376 376
         }
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
             // NOTE: Only use tables that don't have too many entries!
398 398
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
399 399
         ) {
400
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
400
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
401 401
             return '';
402 402
         }
403 403
 
404
-        $makeCacheKey = function ($pid, $uid) {
405
-            return $pid . '.' . $uid;
404
+        $makeCacheKey = function($pid, $uid) {
405
+            return $pid.'.'.$uid;
406 406
         };
407 407
 
408 408
         static $cache = [];
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 
413 413
             $result = $queryBuilder
414 414
                 ->select(
415
-                    $table . '.index_name AS index_name',
416
-                    $table . '.uid AS uid',
417
-                    $table . '.pid AS pid',
415
+                    $table.'.index_name AS index_name',
416
+                    $table.'.uid AS uid',
417
+                    $table.'.pid AS pid',
418 418
                 )
419 419
                 ->from($table)
420 420
                 ->execute();
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
         $result = $cache[$table][$cacheKey] ?? '';
433 433
 
434 434
         if ($result === '') {
435
-            self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
435
+            self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
436 436
         }
437 437
 
438 438
         return $result;
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
             // No ISO code, return unchanged.
460 460
             return $code;
461 461
         }
462
-        $lang = LocalizationUtility::translate('LLL:' . $file . ':' . $code);
462
+        $lang = LocalizationUtility::translate('LLL:'.$file.':'.$code);
463 463
         if (!empty($lang)) {
464 464
             return $lang;
465 465
         } else {
466
-            self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
466
+            self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
467 467
             return $code;
468 468
         }
469 469
     }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
             '-' => 39,
561 561
             ':' => 17,
562 562
         ];
563
-        $urn = strtolower($base . $id);
563
+        $urn = strtolower($base.$id);
564 564
         if (preg_match('/[^a-z\d:-]/', $urn)) {
565 565
             self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING);
566 566
             return '';
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             $checksum += ($i + 1) * intval(substr($digits, $i, 1));
575 575
         }
576 576
         $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
577
-        return $base . $id . $checksum;
577
+        return $base.$id.$checksum;
578 578
     }
579 579
 
580 580
     /**
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
         // Sanitize input.
669 669
         $pid = max(intval($pid), 0);
670 670
         if (!$pid) {
671
-            self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING);
671
+            self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING);
672 672
             return $index_name;
673 673
         }
674 674
         /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */
@@ -690,13 +690,13 @@  discard block
 block discarded – undo
690 690
         // First fetch the uid of the received index_name
691 691
         $result = $queryBuilder
692 692
             ->select(
693
-                $table . '.uid AS uid',
694
-                $table . '.l18n_parent AS l18n_parent'
693
+                $table.'.uid AS uid',
694
+                $table.'.l18n_parent AS l18n_parent'
695 695
             )
696 696
             ->from($table)
697 697
             ->where(
698
-                $queryBuilder->expr()->eq($table . '.pid', $pid),
699
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
698
+                $queryBuilder->expr()->eq($table.'.pid', $pid),
699
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
700 700
                 self::whereExpression($table, true)
701 701
             )
702 702
             ->setMaxResults(1)
@@ -709,12 +709,12 @@  discard block
 block discarded – undo
709 709
             $resArray = $allResults[0];
710 710
 
711 711
             $result = $queryBuilder
712
-                ->select($table . '.index_name AS index_name')
712
+                ->select($table.'.index_name AS index_name')
713 713
                 ->from($table)
714 714
                 ->where(
715
-                    $queryBuilder->expr()->eq($table . '.pid', $pid),
716
-                    $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
717
-                    $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
715
+                    $queryBuilder->expr()->eq($table.'.pid', $pid),
716
+                    $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']),
717
+                    $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())),
718 718
                     self::whereExpression($table, true)
719 719
                 )
720 720
                 ->setMaxResults(1)
@@ -732,14 +732,14 @@  discard block
 block discarded – undo
732 732
         if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) {
733 733
             // Check if this table is allowed for translation.
734 734
             if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) {
735
-                $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]);
735
+                $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]);
736 736
                 if ($languageAspect->getContentId() > 0) {
737 737
                     $additionalWhere = $queryBuilder->expr()->andX(
738 738
                         $queryBuilder->expr()->orX(
739
-                            $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
740
-                            $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId()))
739
+                            $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
740
+                            $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId()))
741 741
                         ),
742
-                        $queryBuilder->expr()->eq($table . '.l18n_parent', 0)
742
+                        $queryBuilder->expr()->eq($table.'.l18n_parent', 0)
743 743
                     );
744 744
                 }
745 745
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
                     ->select('*')
749 749
                     ->from($table)
750 750
                     ->where(
751
-                        $queryBuilder->expr()->eq($table . '.pid', $pid),
751
+                        $queryBuilder->expr()->eq($table.'.pid', $pid),
752 752
                         $additionalWhere,
753 753
                         self::whereExpression($table, true)
754 754
                     )
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
                         }
767 767
                     }
768 768
                 } else {
769
-                    self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE);
769
+                    self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE);
770 770
                 }
771 771
             } else {
772
-                self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING);
772
+                self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING);
773 773
             }
774 774
         }
775 775
 
@@ -811,9 +811,9 @@  discard block
 block discarded – undo
811 811
             return GeneralUtility::makeInstance(ConnectionPool::class)
812 812
                 ->getQueryBuilderForTable($table)
813 813
                 ->expr()
814
-                ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
814
+                ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
815 815
         } else {
816
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
816
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
817 817
             return '1=-1';
818 818
         }
819 819
     }
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
      */
853 853
     public static function polyfillExtbaseClassesForTYPO3v9()
854 854
     {
855
-        $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
855
+        $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php';
856 856
 
857 857
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
858 858
         $configurationManager = $objectManager->get(ConfigurationManager::class);
@@ -908,10 +908,10 @@  discard block
 block discarded – undo
908 908
         try {
909 909
             $response = $requestFactory->request($url, 'GET', $configuration);
910 910
         } catch (\Exception $e) {
911
-            self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
911
+            self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING);
912 912
             return false;
913 913
         }
914
-        $content  = $response->getBody()->getContents();
914
+        $content = $response->getBody()->getContents();
915 915
 
916 916
         return $content;
917 917
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
83 83
      */
84
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
84
+    public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages')
85 85
     {
86 86
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
87 87
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
                     $checksum = 'X';
124 124
                 }
125 125
                 if (!preg_match('/\d{8}[\dX]{1}/i', $id)) {
126
-                    return false;
126
+                    return FALSE;
127 127
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
128
-                    return false;
128
+                    return FALSE;
129 129
                 }
130 130
                 break;
131 131
             case 'ZDB':
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
                     $checksum = 'X';
134 134
                 }
135 135
                 if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) {
136
-                    return false;
136
+                    return FALSE;
137 137
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
138
-                    return false;
138
+                    return FALSE;
139 139
                 }
140 140
                 break;
141 141
             case 'SWD':
142 142
                 $checksum = 11 - $checksum;
143 143
                 if (!preg_match('/\d{8}-\d{1}/i', $id)) {
144
-                    return false;
144
+                    return FALSE;
145 145
                 } elseif ($checksum == 10) {
146 146
                     return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
147 147
                 } elseif (substr($id, -1, 1) != $checksum) {
148
-                    return false;
148
+                    return FALSE;
149 149
                 }
150 150
                 break;
151 151
             case 'GKD':
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
                     $checksum = 'X';
155 155
                 }
156 156
                 if (!preg_match('/\d{8}-[\dX]{1}/i', $id)) {
157
-                    return false;
157
+                    return FALSE;
158 158
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
159
-                    return false;
159
+                    return FALSE;
160 160
                 }
161 161
                 break;
162 162
         }
163
-        return true;
163
+        return TRUE;
164 164
     }
165 165
 
166 166
     /**
@@ -175,28 +175,28 @@  discard block
 block discarded – undo
175 175
     public static function decrypt($encrypted)
176 176
     {
177 177
         if (
178
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
179
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
178
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
179
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
180 180
         ) {
181 181
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
182
-            return false;
182
+            return FALSE;
183 183
         }
184 184
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
185 185
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
186
-            return false;
186
+            return FALSE;
187 187
         }
188 188
         if (
189 189
             empty($encrypted)
190 190
             || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm)
191 191
         ) {
192 192
             self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR);
193
-            return false;
193
+            return FALSE;
194 194
         }
195 195
         // Split initialisation vector and encrypted data.
196 196
         $binary = base64_decode($encrypted);
197 197
         $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm));
198 198
         $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm));
199
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
199
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
200 200
         // Decrypt data.
201 201
         $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
202 202
         return $decrypted;
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
         // Don't make simplexml_load_string throw (when $content is an array
218 218
         // or object)
219 219
         if (!is_string($content)) {
220
-            return false;
220
+            return FALSE;
221 221
         }
222 222
 
223 223
         // Turn off libxml's error logging.
224
-        $libxmlErrors = libxml_use_internal_errors(true);
224
+        $libxmlErrors = libxml_use_internal_errors(TRUE);
225 225
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
226
-        $previousValueOfEntityLoader = libxml_disable_entity_loader(true);
226
+        $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
227 227
         // Try to load XML from file.
228 228
         $xml = simplexml_load_string($content);
229 229
         // reset entity loader setting
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public static function digest($string)
279 279
     {
280
-        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
280
+        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) {
281 281
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
282
-            return false;
282
+            return FALSE;
283 283
         }
284 284
         // Hash string.
285 285
         $hashed = openssl_digest($string, self::$hashAlgorithm);
@@ -298,23 +298,23 @@  discard block
 block discarded – undo
298 298
     public static function encrypt($string)
299 299
     {
300 300
         if (
301
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
302
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
301
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
302
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
303 303
         ) {
304 304
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
305
-            return false;
305
+            return FALSE;
306 306
         }
307 307
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
308 308
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
309
-            return false;
309
+            return FALSE;
310 310
         }
311 311
         // Generate random initialisation vector.
312 312
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm));
313
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
313
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
314 314
         // Encrypt data.
315 315
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
316 316
         // Merge initialisation vector and encrypted data.
317
-        if ($encrypted !== false) {
317
+        if ($encrypted !== FALSE) {
318 318
             $encrypted = base64_encode($iv . $encrypted);
319 319
         }
320 320
         return $encrypted;
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
     public static function isValidHttpUrl($url)
602 602
     {
603 603
         if (!GeneralUtility::isValidUrl($url)) {
604
-            return false;
604
+            return FALSE;
605 605
         }
606 606
 
607 607
         $parsed = parse_url($url);
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      *
626 626
      * @return array Merged array
627 627
      */
628
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
628
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
629 629
     {
630 630
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
631 631
         return $original;
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
             ->where(
698 698
                 $queryBuilder->expr()->eq($table . '.pid', $pid),
699 699
                 $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
700
-                self::whereExpression($table, true)
700
+                self::whereExpression($table, TRUE)
701 701
             )
702 702
             ->setMaxResults(1)
703 703
             ->execute();
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
                     $queryBuilder->expr()->eq($table . '.pid', $pid),
716 716
                     $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
717 717
                     $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
718
-                    self::whereExpression($table, true)
718
+                    self::whereExpression($table, TRUE)
719 719
                 )
720 720
                 ->setMaxResults(1)
721 721
                 ->execute();
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
                     ->where(
751 751
                         $queryBuilder->expr()->eq($table . '.pid', $pid),
752 752
                         $additionalWhere,
753
-                        self::whereExpression($table, true)
753
+                        self::whereExpression($table, TRUE)
754 754
                     )
755 755
                     ->setMaxResults(10000)
756 756
                     ->execute();
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
      *
791 791
      * @return string Additional WHERE expression
792 792
      */
793
-    public static function whereExpression($table, $showHidden = false)
793
+    public static function whereExpression($table, $showHidden = FALSE)
794 794
     {
795 795
         if (\TYPO3_MODE === 'FE') {
796 796
             // Should we ignore the record's hidden flag?
@@ -859,13 +859,13 @@  discard block
 block discarded – undo
859 859
         $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
860 860
 
861 861
         $extbaseClassmap = &$frameworkConfiguration['persistence']['classes'];
862
-        if ($extbaseClassmap === null) {
862
+        if ($extbaseClassmap === NULL) {
863 863
             $extbaseClassmap = [];
864 864
         }
865 865
 
866 866
         foreach ($classes as $className => $classConfig) {
867 867
             $extbaseClass = &$extbaseClassmap[$className];
868
-            if ($extbaseClass === null) {
868
+            if ($extbaseClass === NULL) {
869 869
                 $extbaseClass = [];
870 870
             }
871 871
             if (!isset($extbaseClass['mapping'])) {
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     public static function getUrl(string $url)
892 892
     {
893 893
         if (!Helper::isValidHttpUrl($url)) {
894
-            return false;
894
+            return FALSE;
895 895
         }
896 896
 
897 897
         // Get extension configuration.
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
             $response = $requestFactory->request($url, 'GET', $configuration);
910 910
         } catch (\Exception $e) {
911 911
             self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
912
-            return false;
912
+            return FALSE;
913 913
         }
914 914
         $content  = $response->getBody()->getContents();
915 915
 
Please login to merge, or discard this patch.
Classes/Common/SolrSearchQuery.php 2 patches
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,10 +10,8 @@  discard block
 block discarded – undo
10 10
 /**
11 11
  * Targeted towards being used in ``PaginateController`` (``<f:widget.paginate>``).
12 12
  */
13
-class SolrSearchQuery implements QueryInterface
14
-{
15
-    public function __construct($solrSearch)
16
-    {
13
+class SolrSearchQuery implements QueryInterface {
14
+    public function __construct($solrSearch) {
17 15
         $this->solrSearch = $solrSearch;
18 16
 
19 17
         $this->offset = 0;
@@ -22,8 +20,7 @@  discard block
 block discarded – undo
22 20
 
23 21
     public function getSource() {}
24 22
 
25
-    public function execute($returnRawQueryResult = false)
26
-    {
23
+    public function execute($returnRawQueryResult = false) {
27 24
         $this->solrSearch->submit($this->offset, $this->limit);
28 25
 
29 26
         // solrSearch now only contains the results in range, indexed in [0, n)
@@ -37,14 +34,12 @@  discard block
 block discarded – undo
37 34
 
38 35
     public function setOrderings(array $orderings) {}
39 36
 
40
-    public function setLimit($limit)
41
-    {
37
+    public function setLimit($limit) {
42 38
         $this->limit = $limit;
43 39
         return $this;
44 40
     }
45 41
 
46
-    public function setOffset($offset)
47
-    {
42
+    public function setOffset($offset) {
48 43
         $this->offset = $offset;
49 44
         return $this;
50 45
     }
@@ -65,20 +60,17 @@  discard block
 block discarded – undo
65 60
     public function setQuerySettings(QuerySettingsInterface $querySettings) {}
66 61
     public function getQuerySettings() {}
67 62
 
68
-    public function count()
69
-    {
63
+    public function count() {
70 64
         // TODO?
71 65
     }
72 66
 
73 67
     public function getOrderings() {}
74 68
 
75
-    public function getLimit()
76
-    {
69
+    public function getLimit() {
77 70
         return $this->limit;
78 71
     }
79 72
 
80
-    public function getOffset()
81
-    {
73
+    public function getOffset() {
82 74
         return $this->offset;
83 75
     }
84 76
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function getSource() {}
24 24
 
25
-    public function execute($returnRawQueryResult = false)
25
+    public function execute($returnRawQueryResult = FALSE)
26 26
     {
27 27
         $this->solrSearch->submit($this->offset, $this->limit);
28 28
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function logicalAnd($constraint1) {}
54 54
     public function logicalOr($constraint1) {}
55 55
     public function logicalNot(ConstraintInterface $constraint) {}
56
-    public function equals($propertyName, $operand, $caseSensitive = true) {}
56
+    public function equals($propertyName, $operand, $caseSensitive = TRUE) {}
57 57
     public function like($propertyName, $operand) {}
58 58
     public function contains($propertyName, $operand) {}
59 59
     public function in($propertyName, $operand) {}
Please login to merge, or discard this patch.
Tests/Functional/Common/HelperTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
     {
13 13
         parent::setUp();
14 14
 
15
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
16
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
15
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
16
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
17 17
     }
18 18
 
19 19
     /**
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
7 7
 use TYPO3\CMS\Core\Localization\LanguageService;
8 8
 
9
-class HelperTest extends FunctionalTestCase
10
-{
9
+class HelperTest extends FunctionalTestCase {
11 10
     public function setUp(): void
12 11
     {
13 12
         parent::setUp();
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
     /**
20 19
      * @test
21 20
      */
22
-    public function canGetIndexNameFromUid()
23
-    {
21
+    public function canGetIndexNameFromUid() {
24 22
         // Repeat to make sure caching isn't broken
25 23
         for ($n = 0; $n < 2; $n++) {
26 24
             // Good UID, no PID
@@ -69,8 +67,7 @@  discard block
 block discarded – undo
69 67
      * @test
70 68
      * @group getLanguageName
71 69
      */
72
-    public function canTranslateLanguageNameToEnglish()
73
-    {
70
+    public function canTranslateLanguageNameToEnglish() {
74 71
         // NOTE: This only tests in BE mode
75 72
 
76 73
         $this->initLanguageService('default');
@@ -84,8 +81,7 @@  discard block
 block discarded – undo
84 81
      * @test
85 82
      * @group getLanguageName
86 83
      */
87
-    public function canTranslateLanguageNameToGerman()
88
-    {
84
+    public function canTranslateLanguageNameToGerman() {
89 85
         // NOTE: This only tests in BE mode
90 86
 
91 87
         $this->initLanguageService('de');
Please login to merge, or discard this patch.
Tests/Functional/Common/MetsDocumentTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
     {
12 12
         parent::setUp();
13 13
 
14
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
15
-        $this->importDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.xml');
14
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
15
+        $this->importDataSet(__DIR__.'/../../Fixtures/MetsDocument/metadata_mets.xml');
16 16
     }
17 17
 
18 18
     protected function doc(string $file)
19 19
     {
20
-        $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file;
20
+        $url = 'http://web:8001/Tests/Fixtures/MetsDocument/'.$file;
21 21
         $doc = Doc::getInstance($url);
22 22
         $this->assertNotNull($doc);
23 23
         return $doc;
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use Kitodo\Dlf\Common\Doc;
6 6
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
7 7
 
8
-class MetsDocumentTest extends FunctionalTestCase
9
-{
8
+class MetsDocumentTest extends FunctionalTestCase {
10 9
     public function setUp(): void
11 10
     {
12 11
         parent::setUp();
@@ -15,8 +14,7 @@  discard block
 block discarded – undo
15 14
         $this->importDataSet(__DIR__ . '/../../Fixtures/MetsDocument/metadata_mets.xml');
16 15
     }
17 16
 
18
-    protected function doc(string $file)
19
-    {
17
+    protected function doc(string $file) {
20 18
         $url = 'http://web:8001/Tests/Fixtures/MetsDocument/' . $file;
21 19
         $doc = Doc::getInstance($url);
22 20
         $this->assertNotNull($doc);
@@ -26,8 +24,7 @@  discard block
 block discarded – undo
26 24
     /**
27 25
      * @test
28 26
      */
29
-    public function canParseDmdAndAmdSec()
30
-    {
27
+    public function canParseDmdAndAmdSec() {
31 28
         $doc = $this->doc('av_beispiel.xml');
32 29
 
33 30
         $titledata = $doc->getTitledata(20000);
@@ -45,8 +42,7 @@  discard block
 block discarded – undo
45 42
     /**
46 43
      * @test
47 44
      */
48
-    public function canReadFileMetadata()
49
-    {
45
+    public function canReadFileMetadata() {
50 46
         $doc = $this->doc('av_beispiel.xml');
51 47
 
52 48
         $thumbsMeta = $doc->getMetadata('FILE_0000_THUMBS', 20000);
@@ -61,8 +57,7 @@  discard block
 block discarded – undo
61 57
     /**
62 58
      * @test
63 59
      */
64
-    public function canGetLogicalStructure()
65
-    {
60
+    public function canGetLogicalStructure() {
66 61
         $doc = $this->doc('av_beispiel.xml');
67 62
 
68 63
         $toc = $doc->tableOfContents[0] ?? [];
@@ -98,8 +93,7 @@  discard block
 block discarded – undo
98 93
     /**
99 94
      * @test
100 95
      */
101
-    public function doesNotOverwriteFirstDmdSec()
102
-    {
96
+    public function doesNotOverwriteFirstDmdSec() {
103 97
         $doc = $this->doc('two_dmdsec.xml');
104 98
 
105 99
         $titledata = $doc->getTitledata(20000);
@@ -112,8 +106,7 @@  discard block
 block discarded – undo
112 106
     /**
113 107
      * @test
114 108
      */
115
-    public function returnsEmptyMetadataWhenNoDmdSec()
116
-    {
109
+    public function returnsEmptyMetadataWhenNoDmdSec() {
117 110
         $doc = $this->doc('two_dmdsec.xml');
118 111
 
119 112
         // DMD and AMD works
Please login to merge, or discard this patch.
Configuration/TCA/Overrides/tt_content.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,67 +16,67 @@
 block discarded – undo
16 16
 // Plugin "audioplayer".
17 17
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_audioplayer'] = 'layout,select_key,pages,recursive';
18 18
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_audioplayer'] = 'pi_flexform';
19
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_audioplayer', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/AudioPlayer.xml');
19
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_audioplayer', 'FILE:EXT:'.'dlf/Configuration/FlexForms/AudioPlayer.xml');
20 20
 // Plugin "basket".
21 21
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_basket'] = 'layout,select_key,pages,recursive';
22 22
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_basket'] = 'pi_flexform';
23
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_basket', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Basket.xml');
23
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_basket', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Basket.xml');
24 24
 // Plugin "calendar".
25 25
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_calendar'] = 'layout,select_key,pages,recursive';
26 26
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_calendar'] = 'pi_flexform';
27
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_calendar', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Calendar.xml');
27
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_calendar', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Calendar.xml');
28 28
 // Plugin "collection".
29 29
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_collection'] = 'layout,select_key,pages,recursive';
30 30
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_collection'] = 'pi_flexform';
31
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_collection', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Collection.xml');
31
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_collection', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Collection.xml');
32 32
 // Plugin "feeds".
33 33
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_feeds'] = 'layout,select_key,pages,recursive';
34 34
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_feeds'] = 'pi_flexform';
35
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_feeds', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Feeds.xml');
35
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_feeds', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Feeds.xml');
36 36
 // Plugin "listview".
37 37
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_listview'] = 'layout,select_key,pages,recursive';
38 38
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_listview'] = 'pi_flexform';
39
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_listview', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/ListView.xml');
39
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_listview', 'FILE:EXT:'.'dlf/Configuration/FlexForms/ListView.xml');
40 40
 // Plugin "metadata".
41 41
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_metadata'] = 'layout,select_key,pages,recursive';
42 42
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_metadata'] = 'pi_flexform';
43
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_metadata', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Metadata.xml');
43
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_metadata', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Metadata.xml');
44 44
 // Plugin "navigation".
45 45
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_navigation'] = 'layout,select_key,pages,recursive';
46 46
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_navigation'] = 'pi_flexform';
47
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_navigation', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Navigation.xml');
47
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_navigation', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Navigation.xml');
48 48
 // Plugin "oaipmh".
49 49
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_oaipmh'] = 'layout,select_key,pages,recursive';
50 50
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_oaipmh'] = 'pi_flexform';
51
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_oaipmh', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/OaiPmh.xml');
51
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_oaipmh', 'FILE:EXT:'.'dlf/Configuration/FlexForms/OaiPmh.xml');
52 52
 // Plugin "pagegrid".
53 53
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_pagegrid'] = 'layout,select_key,pages,recursive';
54 54
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_pagegrid'] = 'pi_flexform';
55
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pagegrid', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/PageGrid.xml');
55
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pagegrid', 'FILE:EXT:'.'dlf/Configuration/FlexForms/PageGrid.xml');
56 56
 // Plugin "pageview".
57 57
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_pageview'] = 'layout,select_key,pages,recursive';
58 58
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_pageview'] = 'pi_flexform';
59
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pageview', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/PageView.xml');
59
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_pageview', 'FILE:EXT:'.'dlf/Configuration/FlexForms/PageView.xml');
60 60
 // Plugin "search".
61 61
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_search'] = 'layout,select_key,pages,recursive';
62 62
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_search'] = 'pi_flexform';
63
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_search', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Search.xml');
63
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_search', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Search.xml');
64 64
 // Plugin "statistics".
65 65
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_statistics'] = 'layout,select_key,pages,recursive';
66 66
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_statistics'] = 'pi_flexform';
67
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_statistics', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Statistics.xml');
67
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_statistics', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Statistics.xml');
68 68
 // Plugin "tableofcontents".
69 69
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_tableofcontents'] = 'layout,select_key,pages,recursive';
70 70
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_tableofcontents'] = 'pi_flexform';
71
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_tableofcontents', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/TableOfContents.xml');
71
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_tableofcontents', 'FILE:EXT:'.'dlf/Configuration/FlexForms/TableOfContents.xml');
72 72
 // Plugin "toolbox".
73 73
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_toolbox'] = 'layout,select_key,pages,recursive';
74 74
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_toolbox'] = 'pi_flexform';
75
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_toolbox', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/Toolbox.xml');
75
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_toolbox', 'FILE:EXT:'.'dlf/Configuration/FlexForms/Toolbox.xml');
76 76
 // Plugin "view3d".
77 77
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['dlf_view3d'] = 'layout,select_key,pages,recursive';
78 78
 $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['dlf_view3d'] = 'pi_flexform';
79
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_view3d', 'FILE:EXT:' . 'dlf/Configuration/FlexForms/View3D.xml');
79
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('dlf_view3d', 'FILE:EXT:'.'dlf/Configuration/FlexForms/View3D.xml');
80 80
 
81 81
 \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
82 82
     'Kitodo.Dlf',
Please login to merge, or discard this patch.
Classes/Format/Mods.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
      *
47 47
      * @return void
48 48
      */
49
-    public function extractMetadata(\SimpleXMLElement $xml, array &$metadata)
50
-    {
49
+    public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) {
51 50
         $this->xml = $xml;
52 51
         $this->metadata = $metadata;
53 52
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
                     }
125 125
                     // Append "valueURI" to name using Unicode unit separator.
126 126
                     if (isset($authors[$i]['valueURI'])) {
127
-                        $this->metadata['author'][$i] .= chr(31) . (string) $authors[$i]['valueURI'];
127
+                        $this->metadata['author'][$i] .= chr(31).(string) $authors[$i]['valueURI'];
128 128
                     }
129 129
                 }
130 130
             }
Please login to merge, or discard this patch.
Classes/Api/Orcid/Profile.php 4 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
      */
36 36
     protected $logger;
37 37
 
38
-     /**
39
-     * This holds the client
40
-     *
41
-     * @var Client
42
-     * @access protected
43
-     */
38
+        /**
39
+         * This holds the client
40
+         *
41
+         * @var Client
42
+         * @access protected
43
+         */
44 44
     protected $client;
45 45
 
46 46
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
             $this->raw->registerXPathNamespace('personal-details', 'http://www.orcid.org/ns/personal-details');
130 130
             $givenNames = $this->raw->xpath('./personal-details:name/personal-details:given-names');
131 131
             $familyName = $this->raw->xpath('./personal-details:name/personal-details:family-name');
132
-            return (string) $givenNames[0] . ' ' . (string) $familyName[0];
132
+            return (string) $givenNames[0].' '.(string) $familyName[0];
133 133
         } else {
134 134
             $this->logger->warning('No name found for given ORCID');
135 135
             return false;
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Profile
29
-{
28
+class Profile {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return void
59 58
      **/
60
-    public function __construct($orcid)
61
-    {
59
+    public function __construct($orcid) {
62 60
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
63 61
         $this->client = new Client($orcid, GeneralUtility::makeInstance(RequestFactory::class));
64 62
     }
@@ -68,8 +66,7 @@  discard block
 block discarded – undo
68 66
      *
69 67
      * @return array|bool
70 68
      **/
71
-    public function getData()
72
-    {
69
+    public function getData() {
73 70
         $this->getRaw('person');
74 71
         if (!empty($this->raw)) {
75 72
             $data = [];
@@ -88,8 +85,7 @@  discard block
 block discarded – undo
88 85
      *
89 86
      * @return string|bool
90 87
      **/
91
-    public function getAddress()
92
-    {
88
+    public function getAddress() {
93 89
         $this->getRaw('address');
94 90
         if (!empty($this->raw)) {
95 91
             $this->raw->registerXPathNamespace('address', 'http://www.orcid.org/ns/address');
@@ -105,8 +101,7 @@  discard block
 block discarded – undo
105 101
      *
106 102
      * @return string|bool
107 103
      **/
108
-    public function getEmail()
109
-    {
104
+    public function getEmail() {
110 105
         $this->getRaw('email');
111 106
         if (!empty($this->raw)) {
112 107
             $this->raw->registerXPathNamespace('email', 'http://www.orcid.org/ns/email');
@@ -122,8 +117,7 @@  discard block
 block discarded – undo
122 117
      *
123 118
      * @return string|bool
124 119
      **/
125
-    public function getFullName()
126
-    {
120
+    public function getFullName() {
127 121
         $this->getRaw('personal-details');
128 122
         if (!empty($this->raw)) {
129 123
             $this->raw->registerXPathNamespace('personal-details', 'http://www.orcid.org/ns/personal-details');
@@ -143,8 +137,7 @@  discard block
 block discarded – undo
143 137
      *
144 138
      * @return void
145 139
      **/
146
-    protected function getRaw($endpoint)
147
-    {
140
+    protected function getRaw($endpoint) {
148 141
         $this->client->setEndpoint($endpoint);
149 142
         $data = $this->client->getData();
150 143
         if (!isset($this->raw) && $data != false) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var SimpleXmlElement
50 50
      **/
51
-    private $raw = null;
51
+    private $raw = NULL;
52 52
 
53 53
     /**
54 54
      * Constructs client instance
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             return $data;
80 80
         } else {
81 81
             $this->logger->warning('No data found for given ORCID');
82
-            return false;
82
+            return FALSE;
83 83
         }
84 84
     }
85 85
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             return (string) $this->raw->xpath('./address:address/address:country')[0];
97 97
         } else {
98 98
             $this->logger->warning('No address found for given ORCID');
99
-            return false;
99
+            return FALSE;
100 100
         }
101 101
     }
102 102
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             return (string) $this->raw->xpath('./email:email/email:email')[0];
114 114
         } else {
115 115
             $this->logger->warning('No email found for given ORCID');
116
-            return false;
116
+            return FALSE;
117 117
         }
118 118
     }
119 119
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             return (string) $givenNames[0] . ' ' . (string) $familyName[0];
133 133
         } else {
134 134
             $this->logger->warning('No name found for given ORCID');
135
-            return false;
135
+            return FALSE;
136 136
         }
137 137
     }
138 138
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $this->client->setEndpoint($endpoint);
149 149
         $data = $this->client->getData();
150
-        if (!isset($this->raw) && $data != false) {
150
+        if (!isset($this->raw) && $data != FALSE) {
151 151
             $this->raw = Helper::getXmlFileAsString($data);
152 152
         }
153 153
     }
Please login to merge, or discard this patch.
Classes/Api/Orcid/Client.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         try {
102 102
             $response = $this->requestFactory->request($url);
103 103
         } catch (\Exception $e) {
104
-            $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
104
+            $this->logger->warning('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.');
105 105
             return false;
106 106
         }
107 107
         return $response->getBody()->getContents();
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
      **/
115 115
     private function getApiEndpoint()
116 116
     {
117
-        $url  = 'https://' . $this->level . '.' . self::HOSTNAME;
118
-        $url .= '/v' . self::VERSION . '/';
117
+        $url  = 'https://'.$this->level.'.'.self::HOSTNAME;
118
+        $url .= '/v'.self::VERSION.'/';
119 119
         $url .= '0000-0001-9483-5161';
120 120
         //$url .= $this->orcid;
121
-        $url .= '/' . $this->endpoint;
121
+        $url .= '/'.$this->endpoint;
122 122
         return $url;
123 123
     }
124 124
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Client
29
-{
28
+class Client {
30 29
     /**
31 30
      * constants for API endpoint
32 31
      **/
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
      * @param RequestFactory $requestFactory a request object to inject
77 76
      * @return void
78 77
      **/
79
-    public function __construct($orcid, RequestFactory $requestFactory)
80
-    {
78
+    public function __construct($orcid, RequestFactory $requestFactory) {
81 79
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
82 80
         $this->orcid = $orcid;
83 81
         $this->requestFactory = $requestFactory;
@@ -95,8 +93,7 @@  discard block
 block discarded – undo
95 93
      *
96 94
      * @return object|bool
97 95
      **/
98
-    public function getData()
99
-    {
96
+    public function getData() {
100 97
         $url = $this->getApiEndpoint();
101 98
         try {
102 99
             $response = $this->requestFactory->request($url);
@@ -112,8 +109,7 @@  discard block
 block discarded – undo
112 109
      *
113 110
      * @return string
114 111
      **/
115
-    private function getApiEndpoint()
116
-    {
112
+    private function getApiEndpoint() {
117 113
         $url  = 'https://' . $this->level . '.' . self::HOSTNAME;
118 114
         $url .= '/v' . self::VERSION . '/';
119 115
         $url .= '0000-0001-9483-5161';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @var string
62 62
      **/
63
-    private $orcid = null;
63
+    private $orcid = NULL;
64 64
 
65 65
     /**
66 66
      * The request object
67 67
      *
68 68
      * @var RequestFactoryInterface
69 69
      **/
70
-    private $requestFactory = null;
70
+    private $requestFactory = NULL;
71 71
 
72 72
     /**
73 73
      * Constructs a new instance
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             $response = $this->requestFactory->request($url);
103 103
         } catch (\Exception $e) {
104 104
             $this->logger->warning('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.');
105
-            return false;
105
+            return FALSE;
106 106
         }
107 107
         return $response->getBody()->getContents();
108 108
     }
Please login to merge, or discard this patch.