Completed
Push — master ( 48cc25...48cc25 )
by
unknown
17s queued 15s
created
Classes/Controller/PageViewController.php 3 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
  * @subpackage dlf
27 27
  * @access public
28 28
  */
29
-class PageViewController extends AbstractController
30
-{
29
+class PageViewController extends AbstractController {
31 30
     /**
32 31
      * Holds the controls to add to the map
33 32
      *
@@ -65,8 +64,7 @@  discard block
 block discarded – undo
65 64
      *
66 65
      * @return void
67 66
      */
68
-    public function mainAction()
69
-    {
67
+    public function mainAction() {
70 68
         // Load current document.
71 69
         $this->loadDocument($this->requestData);
72 70
         if (
@@ -121,8 +119,7 @@  discard block
 block discarded – undo
121 119
      *
122 120
      * @return array URL and MIME type of fulltext file
123 121
      */
124
-    protected function getFulltext($page)
125
-    {
122
+    protected function getFulltext($page) {
126 123
         $fulltext = [];
127 124
         // Get fulltext link.
128 125
         $fileGrpsFulltext = GeneralUtility::trimExplode(',', $this->extConf['fileGrpFulltext']);
@@ -162,8 +159,7 @@  discard block
 block discarded – undo
162 159
      *
163 160
      * @return void
164 161
      */
165
-    protected function addViewerJS()
166
-    {
162
+    protected function addViewerJS() {
167 163
         // Viewer configuration.
168 164
         $viewerConfiguration = '$(document).ready(function() {
169 165
                 if (dlfUtils.exists(dlfViewer)) {
@@ -189,8 +185,7 @@  discard block
 block discarded – undo
189 185
      * @return array An array containing the IRIs of the AnnotationLists / AnnotationPages as well as
190 186
      *               some information about the canvas.
191 187
      */
192
-    protected function getAnnotationContainers($page)
193
-    {
188
+    protected function getAnnotationContainers($page) {
194 189
         if ($this->document->getDoc() instanceof IiifManifest) {
195 190
             $canvasId = $this->document->getDoc()->physicalStructure[$page];
196 191
             $iiif = $this->document->getDoc()->getIiif();
@@ -246,8 +241,7 @@  discard block
 block discarded – undo
246 241
      *
247 242
      * @return array URL and MIME type of image file
248 243
      */
249
-    protected function getImage($page)
250
-    {
244
+    protected function getImage($page) {
251 245
         $image = [];
252 246
         // Get @USE value of METS fileGrp.
253 247
         $fileGrpsImages = GeneralUtility::trimExplode(',', $this->extConf['fileGrpImages']);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         // Load current document.
71 71
         $this->loadDocument($this->requestData);
72 72
         if (
73
-            $this->document === null
73
+            $this->document === NULL
74 74
             || $this->document->getDoc()->numPages < 1
75 75
         ) {
76 76
             // Quit without doing anything if required variables are not set.
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                     // Configure @action URL for form.
134 134
                     $uri = $this->uriBuilder->reset()
135 135
                         ->setTargetPageUid($GLOBALS['TSFE']->id)
136
-                        ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false)
136
+                        ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE)
137 137
                         ->setArguments([
138 138
                             'eID' => 'tx_dlf_pageview_proxy',
139 139
                             'url' => $fulltext['url'],
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             if ($iiif instanceof ManifestInterface) {
198 198
                 $canvas = $iiif->getContainedResourceById($canvasId);
199 199
                 /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */
200
-                if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) {
200
+                if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) {
201 201
                     $annotationContainers = [];
202 202
                     /*
203 203
                      *  TODO Analyzing the annotations on the server side requires loading the annotation lists / pages
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
                      *  On the other hand, server connections are potentially better than client connections. Downloading annotation lists
208 208
                      */
209 209
                     foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) {
210
-                        if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) {
210
+                        if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) {
211 211
                             foreach ($textAnnotations as $annotation) {
212 212
                                 if (
213 213
                                     $annotation->getBody()->getFormat() == 'text/plain'
214
-                                    && $annotation->getBody()->getChars() != null
214
+                                    && $annotation->getBody()->getChars() != NULL
215 215
                                 ) {
216 216
                                     $annotationListData = [];
217 217
                                     $annotationListData['uri'] = $annotationContainer->getId();
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                     // Configure @action URL for form.
260 260
                     $uri = $this->uriBuilder->reset()
261 261
                         ->setTargetPageUid($GLOBALS['TSFE']->id)
262
-                        ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false)
262
+                        ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE)
263 263
                         ->setArguments([
264 264
                             'eID' => 'tx_dlf_pageview_proxy',
265 265
                             'url' => $image['url'],
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
                 $fulltext['mimetype'] = $this->document->getDoc()->getFileMimeType($this->document->getDoc()->physicalStructureInfo[$this->document->getDoc()->physicalStructure[$page]]['files'][$fileGrpFulltext]);
147 147
                 break;
148 148
             } else {
149
-                $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"');
149
+                $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"');
150 150
             }
151 151
         }
152 152
         if (empty($fulltext)) {
153
-            $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->extConf['fileGrpFulltext'] . '"');
153
+            $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->extConf['fileGrpFulltext'].'"');
154 154
         }
155 155
         return $fulltext;
156 156
     }
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
         $viewerConfiguration = '$(document).ready(function() {
169 169
                 if (dlfUtils.exists(dlfViewer)) {
170 170
                     tx_dlf_viewer = new dlfViewer({
171
-                        controls: ["' . implode('", "', $this->controls) . '"],
172
-                        div: "' . $this->settings['elementId'] . '",
173
-                        images: ' . json_encode($this->images) . ',
174
-                        fulltexts: ' . json_encode($this->fulltexts) . ',
175
-                        annotationContainers: ' . json_encode($this->annotationContainers) . ',
176
-                        useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0) . '
171
+                        controls: ["' . implode('", "', $this->controls).'"],
172
+                        div: "' . $this->settings['elementId'].'",
173
+                        images: ' . json_encode($this->images).',
174
+                        fulltexts: ' . json_encode($this->fulltexts).',
175
+                        annotationContainers: ' . json_encode($this->annotationContainers).',
176
+                        useInternalProxy: ' . ($this->settings['useInternalProxy'] ? 1 : 0).'
177 177
                     });
178 178
                 }
179 179
             });';
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
                 }
275 275
                 break;
276 276
             } else {
277
-                $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"');
277
+                $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"');
278 278
             }
279 279
         }
280 280
         if (empty($image)) {
281
-            $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->extConf['fileGrpImages'] . '"');
281
+            $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->extConf['fileGrpImages'].'"');
282 282
         }
283 283
         return $image;
284 284
     }
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
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  * @subpackage dlf
32 32
  * @access public
33 33
  */
34
-class Helper
35
-{
34
+class Helper {
36 35
     /**
37 36
      * The extension key
38 37
      *
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
      *
81 80
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
82 81
      */
83
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
84
-    {
82
+    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages') {
85 83
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
86 84
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
87 85
         $flashMessage = GeneralUtility::makeInstance(
@@ -106,8 +104,7 @@  discard block
 block discarded – undo
106 104
      *
107 105
      * @return bool Is $id a valid GNL identifier of the given $type?
108 106
      */
109
-    public static function checkIdentifier($id, $type)
110
-    {
107
+    public static function checkIdentifier($id, $type) {
111 108
         $digits = substr($id, 0, 8);
112 109
         $checksum = 0;
113 110
         for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
@@ -171,8 +168,7 @@  discard block
 block discarded – undo
171 168
      *
172 169
      * @return mixed The decrypted value or false on error
173 170
      */
174
-    public static function decrypt($encrypted)
175
-    {
171
+    public static function decrypt($encrypted) {
176 172
         if (
177 173
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
178 174
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -211,8 +207,7 @@  discard block
 block discarded – undo
211 207
      *
212 208
      * @return \SimpleXMLElement|false
213 209
      */
214
-    public static function getXmlFileAsString($content)
215
-    {
210
+    public static function getXmlFileAsString($content) {
216 211
         // Don't make simplexml_load_string throw (when $content is an array
217 212
         // or object)
218 213
         if (!is_string($content)) {
@@ -243,8 +238,7 @@  discard block
 block discarded – undo
243 238
      *
244 239
      * @return void
245 240
      */
246
-    public static function log($message, $severity = 0)
247
-    {
241
+    public static function log($message, $severity = 0) {
248 242
         $logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(get_called_class());
249 243
 
250 244
         switch ($severity) {
@@ -274,8 +268,7 @@  discard block
 block discarded – undo
274 268
      *
275 269
      * @return mixed Hashed string or false on error
276 270
      */
277
-    public static function digest($string)
278
-    {
271
+    public static function digest($string) {
279 272
         if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
280 273
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
281 274
             return false;
@@ -294,8 +287,7 @@  discard block
 block discarded – undo
294 287
      *
295 288
      * @return mixed Encrypted string or false on error
296 289
      */
297
-    public static function encrypt($string)
298
-    {
290
+    public static function encrypt($string) {
299 291
         if (
300 292
             !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
301 293
             || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
@@ -328,8 +320,7 @@  discard block
 block discarded – undo
328 320
      *
329 321
      * @return string The unqualified class name
330 322
      */
331
-    public static function getUnqualifiedClassName($qualifiedClassname)
332
-    {
323
+    public static function getUnqualifiedClassName($qualifiedClassname) {
333 324
         $nameParts = explode('\\', $qualifiedClassname);
334 325
         return end($nameParts);
335 326
     }
@@ -343,8 +334,7 @@  discard block
 block discarded – undo
343 334
      *
344 335
      * @return string The cleaned up string
345 336
      */
346
-    public static function getCleanString($string)
347
-    {
337
+    public static function getCleanString($string) {
348 338
         // Convert to lowercase.
349 339
         $string = strtolower($string);
350 340
         // Remove non-alphanumeric characters.
@@ -365,8 +355,7 @@  discard block
 block discarded – undo
365 355
      *
366 356
      * @return array Array of hook objects for the class
367 357
      */
368
-    public static function getHookObjects($scriptRelPath)
369
-    {
358
+    public static function getHookObjects($scriptRelPath) {
370 359
         $hookObjects = [];
371 360
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
372 361
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
@@ -387,8 +376,7 @@  discard block
 block discarded – undo
387 376
      *
388 377
      * @return string "index_name" for the given UID
389 378
      */
390
-    public static function getIndexNameFromUid($uid, $table, $pid = -1)
391
-    {
379
+    public static function getIndexNameFromUid($uid, $table, $pid = -1) {
392 380
         // Sanitize input.
393 381
         $uid = max(intval($uid), 0);
394 382
         if (
@@ -438,8 +426,7 @@  discard block
 block discarded – undo
438 426
      *
439 427
      * @return string Localized full name of language or unchanged input
440 428
      */
441
-    public static function getLanguageName($code)
442
-    {
429
+    public static function getLanguageName($code) {
443 430
         // Analyze code and set appropriate ISO table.
444 431
         $isoCode = strtolower(trim($code));
445 432
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
@@ -481,8 +468,7 @@  discard block
 block discarded – undo
481 468
      *
482 469
      * @return array
483 470
      */
484
-    public static function getDocumentStructures($pid = -1)
485
-    {
471
+    public static function getDocumentStructures($pid = -1) {
486 472
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
487 473
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_structures');
488 474
 
@@ -522,8 +508,7 @@  discard block
 block discarded – undo
522 508
      *
523 509
      * @return string Uniform Resource Name as string
524 510
      */
525
-    public static function getURN($base, $id)
526
-    {
511
+    public static function getURN($base, $id) {
527 512
         $concordance = [
528 513
             '0' => 1,
529 514
             '1' => 2,
@@ -590,8 +575,7 @@  discard block
 block discarded – undo
590 575
      *
591 576
      * @return bool Is $id a valid PPN?
592 577
      */
593
-    public static function isPPN($id)
594
-    {
578
+    public static function isPPN($id) {
595 579
         return self::checkIdentifier($id, 'PPN');
596 580
     }
597 581
 
@@ -602,8 +586,7 @@  discard block
 block discarded – undo
602 586
      *
603 587
      * @return bool
604 588
      */
605
-    public static function isValidHttpUrl($url)
606
-    {
589
+    public static function isValidHttpUrl($url) {
607 590
         if (!GeneralUtility::isValidUrl($url)) {
608 591
             return false;
609 592
         }
@@ -629,8 +612,7 @@  discard block
 block discarded – undo
629 612
      *
630 613
      * @return array Merged array
631 614
      */
632
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
633
-    {
615
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true) {
634 616
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
635 617
         return $original;
636 618
     }
@@ -644,8 +626,7 @@  discard block
 block discarded – undo
644 626
      *
645 627
      * @return string All flash messages in the queue rendered as HTML.
646 628
      */
647
-    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages')
648
-    {
629
+    public static function renderFlashMessages($queue = 'kitodo.default.flashMessages') {
649 630
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
650 631
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
651 632
         $flashMessages = $flashMessageQueue->getAllMessagesAndFlush();
@@ -665,8 +646,7 @@  discard block
 block discarded – undo
665 646
      *
666 647
      * @return string Localized label for $index_name
667 648
      */
668
-    public static function translate($index_name, $table, $pid)
669
-    {
649
+    public static function translate($index_name, $table, $pid) {
670 650
         // Load labels into static variable for future use.
671 651
         static $labels = [];
672 652
         // Sanitize input.
@@ -794,8 +774,7 @@  discard block
 block discarded – undo
794 774
      *
795 775
      * @return string Additional WHERE expression
796 776
      */
797
-    public static function whereExpression($table, $showHidden = false)
798
-    {
777
+    public static function whereExpression($table, $showHidden = false) {
799 778
         if (\TYPO3_MODE === 'FE') {
800 779
             // Should we ignore the record's hidden flag?
801 780
             $ignoreHide = 0;
@@ -827,8 +806,7 @@  discard block
 block discarded – undo
827 806
      *
828 807
      * @access private
829 808
      */
830
-    private function __construct()
831
-    {
809
+    private function __construct() {
832 810
         // This is a static class, thus no instances should be created.
833 811
     }
834 812
 
@@ -854,8 +832,7 @@  discard block
 block discarded – undo
854 832
      *
855 833
      * @access public
856 834
      */
857
-    public static function polyfillExtbaseClassesForTYPO3v9()
858
-    {
835
+    public static function polyfillExtbaseClassesForTYPO3v9() {
859 836
         $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
860 837
 
861 838
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
@@ -892,8 +869,7 @@  discard block
 block discarded – undo
892 869
      *
893 870
      * @return string|bool
894 871
      */
895
-    public static function getUrl(string $url)
896
-    {
872
+    public static function getUrl(string $url) {
897 873
         if (!Helper::isValidHttpUrl($url)) {
898 874
             return false;
899 875
         }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
143 143
                     return false;
144 144
                 } elseif ($checksum == 10) {
145
-                    return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
145
+                    return self::checkIdentifier(($digits + 1).substr($id, -2, 2), 'SWD');
146 146
                 } elseif (substr($id, -1, 1) != $checksum) {
147 147
                     return false;
148 148
                 }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
315 315
         // Merge initialisation vector and encrypted data.
316 316
         if ($encrypted !== false) {
317
-            $encrypted = base64_encode($iv . $encrypted);
317
+            $encrypted = base64_encode($iv.$encrypted);
318 318
         }
319 319
         return $encrypted;
320 320
     }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
     public static function getHookObjects($scriptRelPath)
369 369
     {
370 370
         $hookObjects = [];
371
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'])) {
372
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey . '/' . $scriptRelPath]['hookClass'] as $classRef) {
371
+        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'])) {
372
+            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][self::$extKey.'/'.$scriptRelPath]['hookClass'] as $classRef) {
373 373
                 $hookObjects[] = GeneralUtility::makeInstance($classRef);
374 374
             }
375 375
         }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             !$uid
396 396
             || !in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures', 'tx_dlf_solrcores'])
397 397
         ) {
398
-            self::log('Invalid UID "' . $uid . '" or table "' . $table . '"', LOG_SEVERITY_ERROR);
398
+            self::log('Invalid UID "'.$uid.'" or table "'.$table.'"', LOG_SEVERITY_ERROR);
399 399
             return '';
400 400
         }
401 401
 
@@ -406,15 +406,15 @@  discard block
 block discarded – undo
406 406
         // Should we check for a specific PID, too?
407 407
         if ($pid !== -1) {
408 408
             $pid = max(intval($pid), 0);
409
-            $where = $queryBuilder->expr()->eq($table . '.pid', $pid);
409
+            $where = $queryBuilder->expr()->eq($table.'.pid', $pid);
410 410
         }
411 411
 
412 412
         // Get index_name from database.
413 413
         $result = $queryBuilder
414
-            ->select($table . '.index_name AS index_name')
414
+            ->select($table.'.index_name AS index_name')
415 415
             ->from($table)
416 416
             ->where(
417
-                $queryBuilder->expr()->eq($table . '.uid', $uid),
417
+                $queryBuilder->expr()->eq($table.'.uid', $uid),
418 418
                 $where,
419 419
                 self::whereExpression($table)
420 420
             )
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         if ($resArray = $result->fetch()) {
425 425
             return $resArray['index_name'];
426 426
         } else {
427
-            self::log('No "index_name" with UID ' . $uid . ' and PID ' . $pid . ' found in table "' . $table . '"', LOG_SEVERITY_WARNING);
427
+            self::log('No "index_name" with UID '.$uid.' and PID '.$pid.' found in table "'.$table.'"', LOG_SEVERITY_WARNING);
428 428
             return '';
429 429
         }
430 430
     }
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
         // Analyze code and set appropriate ISO table.
444 444
         $isoCode = strtolower(trim($code));
445 445
         if (preg_match('/^[a-z]{3}$/', $isoCode)) {
446
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-2b.xml';
446
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-2b.xml';
447 447
         } elseif (preg_match('/^[a-z]{2}$/', $isoCode)) {
448
-            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey) . 'Resources/Private/Data/iso-639-1.xml';
448
+            $file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey).'Resources/Private/Data/iso-639-1.xml';
449 449
         } else {
450 450
             // No ISO code, return unchanged.
451 451
             return $code;
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
                 $lang = $languageService->getLLL($isoCode, $iso639);
464 464
             }
465 465
         } else {
466
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
466
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
467 467
             return $code;
468 468
         }
469 469
         if (!empty($lang)) {
470 470
             return $lang;
471 471
         } else {
472
-            self::log('Language code "' . $code . '" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
472
+            self::log('Language code "'.$code.'" not found in ISO-639 table', LOG_SEVERITY_NOTICE);
473 473
             return $code;
474 474
         }
475 475
     }
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
             '-' => 39,
565 565
             ':' => 17,
566 566
         ];
567
-        $urn = strtolower($base . $id);
567
+        $urn = strtolower($base.$id);
568 568
         if (preg_match('/[^a-z0-9:-]/', $urn)) {
569 569
             self::log('Invalid chars in given parameters', LOG_SEVERITY_WARNING);
570 570
             return '';
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
             $checksum += ($i + 1) * intval(substr($digits, $i, 1));
579 579
         }
580 580
         $checksum = substr(intval($checksum / intval(substr($digits, -1, 1))), -1, 1);
581
-        return $base . $id . $checksum;
581
+        return $base.$id.$checksum;
582 582
     }
583 583
 
584 584
     /**
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
         // Sanitize input.
673 673
         $pid = max(intval($pid), 0);
674 674
         if (!$pid) {
675
-            self::log('Invalid PID ' . $pid . ' for translation', LOG_SEVERITY_WARNING);
675
+            self::log('Invalid PID '.$pid.' for translation', LOG_SEVERITY_WARNING);
676 676
             return $index_name;
677 677
         }
678 678
         /** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageRepository */
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
         // First fetch the uid of the received index_name
695 695
         $result = $queryBuilder
696 696
             ->select(
697
-                $table . '.uid AS uid',
698
-                $table . '.l18n_parent AS l18n_parent'
697
+                $table.'.uid AS uid',
698
+                $table.'.l18n_parent AS l18n_parent'
699 699
             )
700 700
             ->from($table)
701 701
             ->where(
702
-                $queryBuilder->expr()->eq($table . '.pid', $pid),
703
-                $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
702
+                $queryBuilder->expr()->eq($table.'.pid', $pid),
703
+                $queryBuilder->expr()->eq($table.'.index_name', $queryBuilder->expr()->literal($index_name)),
704 704
                 self::whereExpression($table, true)
705 705
             )
706 706
             ->setMaxResults(1)
@@ -713,12 +713,12 @@  discard block
 block discarded – undo
713 713
             $resArray = $allResults[0];
714 714
 
715 715
             $result = $queryBuilder
716
-                ->select($table . '.index_name AS index_name')
716
+                ->select($table.'.index_name AS index_name')
717 717
                 ->from($table)
718 718
                 ->where(
719
-                    $queryBuilder->expr()->eq($table . '.pid', $pid),
720
-                    $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
721
-                    $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
719
+                    $queryBuilder->expr()->eq($table.'.pid', $pid),
720
+                    $queryBuilder->expr()->eq($table.'.uid', $resArray['l18n_parent']),
721
+                    $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId())),
722 722
                     self::whereExpression($table, true)
723 723
                 )
724 724
                 ->setMaxResults(1)
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
         if (empty($labels[$table][$pid][$languageAspect->getContentId()][$index_name])) {
737 737
             // Check if this table is allowed for translation.
738 738
             if (in_array($table, ['tx_dlf_collections', 'tx_dlf_libraries', 'tx_dlf_metadata', 'tx_dlf_structures'])) {
739
-                $additionalWhere = $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]);
739
+                $additionalWhere = $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]);
740 740
                 if ($languageAspect->getContentId() > 0) {
741 741
                     $additionalWhere = $queryBuilder->expr()->andX(
742 742
                         $queryBuilder->expr()->orX(
743
-                            $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
744
-                            $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId()))
743
+                            $queryBuilder->expr()->in($table.'.sys_language_uid', [-1, 0]),
744
+                            $queryBuilder->expr()->eq($table.'.sys_language_uid', intval($languageAspect->getContentId()))
745 745
                         ),
746
-                        $queryBuilder->expr()->eq($table . '.l18n_parent', 0)
746
+                        $queryBuilder->expr()->eq($table.'.l18n_parent', 0)
747 747
                     );
748 748
                 }
749 749
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
                     ->select('*')
753 753
                     ->from($table)
754 754
                     ->where(
755
-                        $queryBuilder->expr()->eq($table . '.pid', $pid),
755
+                        $queryBuilder->expr()->eq($table.'.pid', $pid),
756 756
                         $additionalWhere,
757 757
                         self::whereExpression($table, true)
758 758
                     )
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
                         }
771 771
                     }
772 772
                 } else {
773
-                    self::log('No translation with PID ' . $pid . ' available in table "' . $table . '" or translation not accessible', LOG_SEVERITY_NOTICE);
773
+                    self::log('No translation with PID '.$pid.' available in table "'.$table.'" or translation not accessible', LOG_SEVERITY_NOTICE);
774 774
                 }
775 775
             } else {
776
-                self::log('No translations available for table "' . $table . '"', LOG_SEVERITY_WARNING);
776
+                self::log('No translations available for table "'.$table.'"', LOG_SEVERITY_WARNING);
777 777
             }
778 778
         }
779 779
 
@@ -815,9 +815,9 @@  discard block
 block discarded – undo
815 815
             return GeneralUtility::makeInstance(ConnectionPool::class)
816 816
                 ->getQueryBuilderForTable($table)
817 817
                 ->expr()
818
-                ->eq($table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
818
+                ->eq($table.'.'.$GLOBALS['TCA'][$table]['ctrl']['delete'], 0);
819 819
         } else {
820
-            self::log('Unexpected TYPO3_MODE "' . \TYPO3_MODE . '"', LOG_SEVERITY_ERROR);
820
+            self::log('Unexpected TYPO3_MODE "'.\TYPO3_MODE.'"', LOG_SEVERITY_ERROR);
821 821
             return '1=-1';
822 822
         }
823 823
     }
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
      */
857 857
     public static function polyfillExtbaseClassesForTYPO3v9()
858 858
     {
859
-        $classes = require __DIR__ . '/../../Configuration/Extbase/Persistence/Classes.php';
859
+        $classes = require __DIR__.'/../../Configuration/Extbase/Persistence/Classes.php';
860 860
 
861 861
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
862 862
         $configurationManager = $objectManager->get(ConfigurationManager::class);
@@ -912,10 +912,10 @@  discard block
 block discarded – undo
912 912
         try {
913 913
             $response = $requestFactory->request($url, 'GET', $configuration);
914 914
         } catch (\Exception $e) {
915
-            self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
915
+            self::log('Could not fetch data from URL "'.$url.'". Error: '.$e->getMessage().'.', LOG_SEVERITY_WARNING);
916 916
             return false;
917 917
         }
918
-        $content  = $response->getBody()->getContents();
918
+        $content = $response->getBody()->getContents();
919 919
 
920 920
         return $content;
921 921
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return \TYPO3\CMS\Core\Messaging\FlashMessageQueue The queue the message was added to
82 82
      */
83
-    public static function addMessage($message, $title, $severity, $session = false, $queue = 'kitodo.default.flashMessages')
83
+    public static function addMessage($message, $title, $severity, $session = FALSE, $queue = 'kitodo.default.flashMessages')
84 84
     {
85 85
         $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
86 86
         $flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier($queue);
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
                     $checksum = 'X';
123 123
                 }
124 124
                 if (!preg_match('/[0-9]{8}[0-9X]{1}/i', $id)) {
125
-                    return false;
125
+                    return FALSE;
126 126
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
127
-                    return false;
127
+                    return FALSE;
128 128
                 }
129 129
                 break;
130 130
             case 'ZDB':
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
                     $checksum = 'X';
133 133
                 }
134 134
                 if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
135
-                    return false;
135
+                    return FALSE;
136 136
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
137
-                    return false;
137
+                    return FALSE;
138 138
                 }
139 139
                 break;
140 140
             case 'SWD':
141 141
                 $checksum = 11 - $checksum;
142 142
                 if (!preg_match('/[0-9]{8}-[0-9]{1}/i', $id)) {
143
-                    return false;
143
+                    return FALSE;
144 144
                 } elseif ($checksum == 10) {
145 145
                     return self::checkIdentifier(($digits + 1) . substr($id, -2, 2), 'SWD');
146 146
                 } elseif (substr($id, -1, 1) != $checksum) {
147
-                    return false;
147
+                    return FALSE;
148 148
                 }
149 149
                 break;
150 150
             case 'GKD':
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
                     $checksum = 'X';
154 154
                 }
155 155
                 if (!preg_match('/[0-9]{8}-[0-9X]{1}/i', $id)) {
156
-                    return false;
156
+                    return FALSE;
157 157
                 } elseif (strtoupper(substr($id, -1, 1)) != $checksum) {
158
-                    return false;
158
+                    return FALSE;
159 159
                 }
160 160
                 break;
161 161
         }
162
-        return true;
162
+        return TRUE;
163 163
     }
164 164
 
165 165
     /**
@@ -174,28 +174,28 @@  discard block
 block discarded – undo
174 174
     public static function decrypt($encrypted)
175 175
     {
176 176
         if (
177
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
178
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
177
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
178
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
179 179
         ) {
180 180
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
181
-            return false;
181
+            return FALSE;
182 182
         }
183 183
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
184 184
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
185
-            return false;
185
+            return FALSE;
186 186
         }
187 187
         if (
188 188
             empty($encrypted)
189 189
             || strlen($encrypted) < openssl_cipher_iv_length(self::$cipherAlgorithm)
190 190
         ) {
191 191
             self::log('Invalid parameters given for decryption', LOG_SEVERITY_ERROR);
192
-            return false;
192
+            return FALSE;
193 193
         }
194 194
         // Split initialisation vector and encrypted data.
195 195
         $binary = base64_decode($encrypted);
196 196
         $iv = substr($binary, 0, openssl_cipher_iv_length(self::$cipherAlgorithm));
197 197
         $data = substr($binary, openssl_cipher_iv_length(self::$cipherAlgorithm));
198
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
198
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
199 199
         // Decrypt data.
200 200
         $decrypted = openssl_decrypt($data, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
201 201
         return $decrypted;
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
         // Don't make simplexml_load_string throw (when $content is an array
217 217
         // or object)
218 218
         if (!is_string($content)) {
219
-            return false;
219
+            return FALSE;
220 220
         }
221 221
 
222 222
         // Turn off libxml's error logging.
223
-        $libxmlErrors = libxml_use_internal_errors(true);
223
+        $libxmlErrors = libxml_use_internal_errors(TRUE);
224 224
         // Disables the functionality to allow external entities to be loaded when parsing the XML, must be kept
225
-        $previousValueOfEntityLoader = libxml_disable_entity_loader(true);
225
+        $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
226 226
         // Try to load XML from file.
227 227
         $xml = simplexml_load_string($content);
228 228
         // reset entity loader setting
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public static function digest($string)
278 278
     {
279
-        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(true))) {
279
+        if (!in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))) {
280 280
             self::log('OpenSSL library doesn\'t support hash algorithm', LOG_SEVERITY_ERROR);
281
-            return false;
281
+            return FALSE;
282 282
         }
283 283
         // Hash string.
284 284
         $hashed = openssl_digest($string, self::$hashAlgorithm);
@@ -297,23 +297,23 @@  discard block
 block discarded – undo
297 297
     public static function encrypt($string)
298 298
     {
299 299
         if (
300
-            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(true))
301
-            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(true))
300
+            !in_array(self::$cipherAlgorithm, openssl_get_cipher_methods(TRUE))
301
+            || !in_array(self::$hashAlgorithm, openssl_get_md_methods(TRUE))
302 302
         ) {
303 303
             self::log('OpenSSL library doesn\'t support cipher and/or hash algorithm', LOG_SEVERITY_ERROR);
304
-            return false;
304
+            return FALSE;
305 305
         }
306 306
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
307 307
             self::log('No encryption key set in TYPO3 configuration', LOG_SEVERITY_ERROR);
308
-            return false;
308
+            return FALSE;
309 309
         }
310 310
         // Generate random initialisation vector.
311 311
         $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length(self::$cipherAlgorithm));
312
-        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, true);
312
+        $key = openssl_digest($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], self::$hashAlgorithm, TRUE);
313 313
         // Encrypt data.
314 314
         $encrypted = openssl_encrypt($string, self::$cipherAlgorithm, $key, OPENSSL_RAW_DATA, $iv);
315 315
         // Merge initialisation vector and encrypted data.
316
-        if ($encrypted !== false) {
316
+        if ($encrypted !== FALSE) {
317 317
             $encrypted = base64_encode($iv . $encrypted);
318 318
         }
319 319
         return $encrypted;
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                 $lang = $languageService->getLLL($isoCode, $iso639);
459 459
             }
460 460
         } elseif (\TYPO3_MODE === 'BE') {
461
-            $iso639 = $languageService->includeLLFile($file, false, true);
461
+            $iso639 = $languageService->includeLLFile($file, FALSE, TRUE);
462 462
             if (!empty($iso639['default'][$isoCode])) {
463 463
                 $lang = $languageService->getLLL($isoCode, $iso639);
464 464
             }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
     public static function isValidHttpUrl($url)
606 606
     {
607 607
         if (!GeneralUtility::isValidUrl($url)) {
608
-            return false;
608
+            return FALSE;
609 609
         }
610 610
 
611 611
         $parsed = parse_url($url);
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
      *
630 630
      * @return array Merged array
631 631
      */
632
-    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = true, $includeEmptyValues = true, $enableUnsetFeature = true)
632
+    public static function mergeRecursiveWithOverrule(array $original, array $overrule, $addKeys = TRUE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
633 633
     {
634 634
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($original, $overrule, $addKeys, $includeEmptyValues, $enableUnsetFeature);
635 635
         return $original;
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
             ->where(
702 702
                 $queryBuilder->expr()->eq($table . '.pid', $pid),
703 703
                 $queryBuilder->expr()->eq($table . '.index_name', $queryBuilder->expr()->literal($index_name)),
704
-                self::whereExpression($table, true)
704
+                self::whereExpression($table, TRUE)
705 705
             )
706 706
             ->setMaxResults(1)
707 707
             ->execute();
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
                     $queryBuilder->expr()->eq($table . '.pid', $pid),
720 720
                     $queryBuilder->expr()->eq($table . '.uid', $resArray['l18n_parent']),
721 721
                     $queryBuilder->expr()->eq($table . '.sys_language_uid', intval($languageAspect->getContentId())),
722
-                    self::whereExpression($table, true)
722
+                    self::whereExpression($table, TRUE)
723 723
                 )
724 724
                 ->setMaxResults(1)
725 725
                 ->execute();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                     ->where(
755 755
                         $queryBuilder->expr()->eq($table . '.pid', $pid),
756 756
                         $additionalWhere,
757
-                        self::whereExpression($table, true)
757
+                        self::whereExpression($table, TRUE)
758 758
                     )
759 759
                     ->setMaxResults(10000)
760 760
                     ->execute();
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
      *
795 795
      * @return string Additional WHERE expression
796 796
      */
797
-    public static function whereExpression($table, $showHidden = false)
797
+    public static function whereExpression($table, $showHidden = FALSE)
798 798
     {
799 799
         if (\TYPO3_MODE === 'FE') {
800 800
             // Should we ignore the record's hidden flag?
@@ -863,13 +863,13 @@  discard block
 block discarded – undo
863 863
         $frameworkConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
864 864
 
865 865
         $extbaseClassmap = &$frameworkConfiguration['persistence']['classes'];
866
-        if ($extbaseClassmap === null) {
866
+        if ($extbaseClassmap === NULL) {
867 867
             $extbaseClassmap = [];
868 868
         }
869 869
 
870 870
         foreach ($classes as $className => $classConfig) {
871 871
             $extbaseClass = &$extbaseClassmap[$className];
872
-            if ($extbaseClass === null) {
872
+            if ($extbaseClass === NULL) {
873 873
                 $extbaseClass = [];
874 874
             }
875 875
             if (!isset($extbaseClass['mapping'])) {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
     public static function getUrl(string $url)
896 896
     {
897 897
         if (!Helper::isValidHttpUrl($url)) {
898
-            return false;
898
+            return FALSE;
899 899
         }
900 900
 
901 901
         // Get extension configuration.
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
             $response = $requestFactory->request($url, 'GET', $configuration);
914 914
         } catch (\Exception $e) {
915 915
             self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
916
-            return false;
916
+            return FALSE;
917 917
         }
918 918
         $content  = $response->getBody()->getContents();
919 919
 
Please login to merge, or discard this patch.
Tests/Unit/Common/HelperTest.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,8 @@
 block discarded – undo
5 5
 use Kitodo\Dlf\Common\Helper;
6 6
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
7 7
 
8
-class HelperTest extends UnitTestCase
9
-{
10
-    public function assertInvalidXml($xml)
11
-    {
8
+class HelperTest extends UnitTestCase {
9
+    public function assertInvalidXml($xml) {
12 10
         $result = Helper::getXmlFileAsString($xml);
13 11
         $this->assertEquals(false, $result);
14 12
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     public function assertInvalidXml($xml)
11 11
     {
12 12
         $result = Helper::getXmlFileAsString($xml);
13
-        $this->assertEquals(false, $result);
13
+        $this->assertEquals(FALSE, $result);
14 14
     }
15 15
 
16 16
     /**
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function invalidXmlYieldsFalse(): void
21 21
     {
22
-        $this->assertInvalidXml(false);
23
-        $this->assertInvalidXml(null);
22
+        $this->assertInvalidXml(FALSE);
23
+        $this->assertInvalidXml(NULL);
24 24
         $this->assertInvalidXml(1);
25 25
         $this->assertInvalidXml([]);
26 26
         $this->assertInvalidXml(new \stdClass());
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 <root>
41 41
     <single />
42 42
 </root>
43
-XML;
43
+xml;
44 44
         $node = Helper::getXmlFileAsString($xml);
45 45
         $this->assertIsObject($node);
46 46
         $this->assertEquals('root', $node->getName());
Please login to merge, or discard this patch.
Tests/routeFunctionalInstance.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
 preg_match("@.*/(?:acceptance|functional-[a-z0-9]+)@", $_SERVER['REQUEST_URI'], $matches);
16 16
 
17 17
 if (!empty($matches)) {
18
-    $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]);
18
+    $root = realpath($_SERVER['DOCUMENT_ROOT'].$matches[0]);
19 19
     if ($root !== false) {
20
-        putenv('TYPO3_PATH_ROOT=' . $root);
21
-        putenv('TYPO3_PATH_APP=' . $root);
20
+        putenv('TYPO3_PATH_ROOT='.$root);
21
+        putenv('TYPO3_PATH_APP='.$root);
22 22
     }
23 23
 }
24 24
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
 
17 17
 if (!empty($matches)) {
18 18
     $root = realpath($_SERVER['DOCUMENT_ROOT'] . $matches[0]);
19
-    if ($root !== false) {
19
+    if ($root !== FALSE) {
20 20
         putenv('TYPO3_PATH_ROOT=' . $root);
21 21
         putenv('TYPO3_PATH_APP=' . $root);
22 22
     }
23 23
 }
24 24
 
25
-return false;
25
+return FALSE;
Please login to merge, or discard this patch.
Tests/Functional/FunctionalTestCase.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
71 71
 
72 72
         if ($this->disableJsonWrappedResponse) {
73
-            $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) {
73
+            $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) {
74 74
                 return $ext !== 'Resources/Core/Functional/Extensions/json_response';
75 75
             });
76 76
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
         $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
84 84
 
85
-        $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/';
85
+        $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/';
86 86
         $this->httpClient = new HttpClient([
87 87
             'base_uri' => $this->baseUrl,
88 88
             'http_errors' => false,
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 
127 127
     protected function addSiteConfig($identifier, $baseUrl)
128 128
     {
129
-        $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
129
+        $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml');
130 130
         $siteConfig['base'] = $baseUrl;
131 131
         $siteConfig['languages'][0]['base'] = $baseUrl;
132 132
 
133
-        $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier;
133
+        $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier;
134 134
         @mkdir($siteConfigPath, 0775, true);
135
-        file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
135
+        file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig));
136 136
     }
137 137
 
138 138
     protected function initializeRepository(string $className, int $storagePid)
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @var bool
50 50
      */
51
-    protected $disableJsonWrappedResponse = false;
51
+    protected $disableJsonWrappedResponse = FALSE;
52 52
 
53 53
     /** @var ObjectManager */
54 54
     protected $objectManager;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/';
86 86
         $this->httpClient = new HttpClient([
87 87
             'base_uri' => $this->baseUrl,
88
-            'http_errors' => false,
88
+            'http_errors' => FALSE,
89 89
         ]);
90 90
 
91 91
         $this->addSiteConfig('dlf-testing', $this->baseUrl);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $siteConfig['languages'][0]['base'] = $baseUrl;
132 132
 
133 133
         $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier;
134
-        @mkdir($siteConfigPath, 0775, true);
134
+        @mkdir($siteConfigPath, 0775, TRUE);
135 135
         file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
136 136
     }
137 137
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected $httpClient;
65 65
 
66
-    public function __construct()
67
-    {
66
+    public function __construct() {
68 67
         parent::__construct();
69 68
 
70 69
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
         $this->addSiteConfig('dlf-testing', $this->baseUrl);
92 91
     }
93 92
 
94
-    protected function getDlfConfiguration()
95
-    {
93
+    protected function getDlfConfiguration() {
96 94
         return [
97 95
             'solrFieldAutocomplete' => 'autocomplete',
98 96
             'solrFieldCollection' => 'collection',
@@ -124,8 +122,7 @@  discard block
 block discarded – undo
124 122
         ];
125 123
     }
126 124
 
127
-    protected function addSiteConfig($identifier, $baseUrl)
128
-    {
125
+    protected function addSiteConfig($identifier, $baseUrl) {
129 126
         $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
130 127
         $siteConfig['base'] = $baseUrl;
131 128
         $siteConfig['languages'][0]['base'] = $baseUrl;
@@ -135,8 +132,7 @@  discard block
 block discarded – undo
135 132
         file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
136 133
     }
137 134
 
138
-    protected function initializeRepository(string $className, int $storagePid)
139
-    {
135
+    protected function initializeRepository(string $className, int $storagePid) {
140 136
         $repository = $this->objectManager->get($className);
141 137
 
142 138
         $querySettings = $this->objectManager->get(Typo3QuerySettings::class);
Please login to merge, or discard this patch.
Tests/Functional/Api/PageViewProxyTest.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
         ]);
78 78
 
79 79
         $this->assertEquals(200, $response->getStatusCode());
80
-        $this->assertEquals('This is some plain text test file.' . "\n", (string) $response->getBody());
80
+        $this->assertEquals('This is some plain text test file.'."\n", (string) $response->getBody());
81 81
     }
82 82
 
83 83
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,19 +6,16 @@
 block discarded – undo
6 6
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
7 7
 use TYPO3\CMS\Core\Utility\GeneralUtility;
8 8
 
9
-class PageViewProxyTest extends FunctionalTestCase
10
-{
9
+class PageViewProxyTest extends FunctionalTestCase {
11 10
     protected $disableJsonWrappedResponse = true;
12 11
 
13
-    protected function getDlfConfiguration()
14
-    {
12
+    protected function getDlfConfiguration() {
15 13
         return array_merge(parent::getDlfConfiguration(), [
16 14
             'enableInternalProxy' => true,
17 15
         ]);
18 16
     }
19 17
 
20
-    protected function queryProxy(array $query, string $method = 'GET')
21
-    {
18
+    protected function queryProxy(array $query, string $method = 'GET') {
22 19
         $query['eID'] = 'tx_dlf_pageview_proxy';
23 20
 
24 21
         return $this->httpClient->request($method, '', [
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 
9 9
 class PageViewProxyTest extends FunctionalTestCase
10 10
 {
11
-    protected $disableJsonWrappedResponse = true;
11
+    protected $disableJsonWrappedResponse = TRUE;
12 12
 
13 13
     protected function getDlfConfiguration()
14 14
     {
15 15
         return array_merge(parent::getDlfConfiguration(), [
16
-            'enableInternalProxy' => true,
16
+            'enableInternalProxy' => TRUE,
17 17
         ]);
18 18
     }
19 19
 
Please login to merge, or discard this patch.
Tests/Functional/Api/PageViewProxyDisabledTest.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,12 +5,10 @@
 block discarded – undo
5 5
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
6 6
 use TYPO3\CMS\Core\Utility\GeneralUtility;
7 7
 
8
-class PageViewProxyDisabledTest extends FunctionalTestCase
9
-{
8
+class PageViewProxyDisabledTest extends FunctionalTestCase {
10 9
     protected $disableJsonWrappedResponse = true;
11 10
 
12
-    protected function queryProxy(array $query, string $method = 'GET')
13
-    {
11
+    protected function queryProxy(array $query, string $method = 'GET') {
14 12
         $query['eID'] = 'tx_dlf_pageview_proxy';
15 13
 
16 14
         return $this->httpClient->request($method, '', [
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 class PageViewProxyDisabledTest extends FunctionalTestCase
9 9
 {
10
-    protected $disableJsonWrappedResponse = true;
10
+    protected $disableJsonWrappedResponse = TRUE;
11 11
 
12 12
     protected function queryProxy(array $query, string $method = 'GET')
13 13
     {
Please login to merge, or discard this patch.
Tests/Functional/Api/OaiPmhTest.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
     {
38 38
         parent::setUp();
39 39
 
40
-        $this->oaiUrl = $this->baseUrl . '/index.php?id=' . $this->oaiPage;
41
-        $this->oaiUrlNoStoragePid = $this->baseUrl . '/index.php?id=' . $this->oaiPageNoStoragePid;
40
+        $this->oaiUrl = $this->baseUrl.'/index.php?id='.$this->oaiPage;
41
+        $this->oaiUrlNoStoragePid = $this->baseUrl.'/index.php?id='.$this->oaiPageNoStoragePid;
42 42
 
43
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
44
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/metadata.xml');
45
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
46
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml');
47
-        $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/pages.xml');
48
-        $this->importDataSet(__DIR__ . '/../../Fixtures/OaiPmh/solrcores.xml');
43
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
44
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/metadata.xml');
45
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
46
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/pages.xml');
47
+        $this->importDataSet(__DIR__.'/../../Fixtures/OaiPmh/pages.xml');
48
+        $this->importDataSet(__DIR__.'/../../Fixtures/OaiPmh/solrcores.xml');
49 49
 
50 50
         $this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
51 51
         $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, 20000);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             $coreName = Solr::createCore();
63 63
             $solr = Solr::getInstance($coreName);
64 64
 
65
-            $this->importSolrDocuments($solr, __DIR__ . '/../../Fixtures/Common/documents_1.solr.json');
65
+            $this->importSolrDocuments($solr, __DIR__.'/../../Fixtures/Common/documents_1.solr.json');
66 66
         }
67 67
 
68 68
         $oaiCoreModel = $this->solrCoreRepository->findByUid(11001);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $jsonDocuments = json_decode(file_get_contents($path), true);
77 77
 
78 78
         $updateQuery = $solr->service->createUpdate();
79
-        $documents = array_map(function ($jsonDoc) use ($updateQuery) {
79
+        $documents = array_map(function($jsonDoc) use ($updateQuery) {
80 80
             $document = $updateQuery->createDocument();
81 81
             foreach ($jsonDoc as $key => $value) {
82 82
                 $document->setField($key, $value);
Please login to merge, or discard this patch.
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 use SimpleXMLElement;
13 13
 use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
14 14
 
15
-class OaiPmhTest extends FunctionalTestCase
16
-{
15
+class OaiPmhTest extends FunctionalTestCase {
17 16
     protected $disableJsonWrappedResponse = true;
18 17
 
19 18
     protected $coreExtensionsToLoad = [
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
         $this->setUpOaiSolr();
54 53
     }
55 54
 
56
-    protected function setUpOaiSolr()
57
-    {
55
+    protected function setUpOaiSolr() {
58 56
         // Setup Solr only once for all tests in this suite
59 57
         static $solr = null;
60 58
 
@@ -71,8 +69,7 @@  discard block
 block discarded – undo
71 69
         $this->persistenceManager->persistAll();
72 70
     }
73 71
 
74
-    protected function importSolrDocuments(Solr $solr, string $path)
75
-    {
72
+    protected function importSolrDocuments(Solr $solr, string $path) {
76 73
         $jsonDocuments = json_decode(file_get_contents($path), true);
77 74
 
78 75
         $updateQuery = $solr->service->createUpdate();
@@ -91,8 +88,7 @@  discard block
 block discarded – undo
91 88
     /**
92 89
      * @test
93 90
      */
94
-    public function correctlyRespondsOnBadVerb()
95
-    {
91
+    public function correctlyRespondsOnBadVerb() {
96 92
         $client = new HttpClient();
97 93
         $response = $client->get($this->baseUrl, [
98 94
             'query' => [
@@ -117,8 +113,7 @@  discard block
 block discarded – undo
117 113
     /**
118 114
      * @test
119 115
      */
120
-    public function canIdentify()
121
-    {
116
+    public function canIdentify() {
122 117
         $oai = Endpoint::build($this->oaiUrl);
123 118
         $identity = $oai->identify();
124 119
 
@@ -131,8 +126,7 @@  discard block
 block discarded – undo
131 126
     /**
132 127
      * @test
133 128
      */
134
-    public function identifyGivesFallbackDatestampWhenNoDocuments()
135
-    {
129
+    public function identifyGivesFallbackDatestampWhenNoDocuments() {
136 130
         $oai = Endpoint::build($this->oaiUrlNoStoragePid);
137 131
         $identity = $oai->identify();
138 132
 
@@ -142,8 +136,7 @@  discard block
 block discarded – undo
142 136
     /**
143 137
      * @test
144 138
      */
145
-    public function canListMetadataFormats()
146
-    {
139
+    public function canListMetadataFormats() {
147 140
         $oai = Endpoint::build($this->oaiUrl);
148 141
         $formats = $oai->listMetadataFormats();
149 142
 
@@ -158,8 +151,7 @@  discard block
 block discarded – undo
158 151
     /**
159 152
      * @test
160 153
      */
161
-    public function canListRecords()
162
-    {
154
+    public function canListRecords() {
163 155
         $oai = Endpoint::build($this->oaiUrl);
164 156
         $result = $oai->listRecords('mets');
165 157
 
@@ -172,8 +164,7 @@  discard block
 block discarded – undo
172 164
     /**
173 165
      * @test
174 166
      */
175
-    public function noRecordsUntil1900()
176
-    {
167
+    public function noRecordsUntil1900() {
177 168
         $this->expectException(OaipmhException::class);
178 169
         $this->expectExceptionMessage('empty list');
179 170
 
@@ -186,8 +177,7 @@  discard block
 block discarded – undo
186 177
     /**
187 178
      * @test
188 179
      */
189
-    public function canUseResumptionToken()
190
-    {
180
+    public function canUseResumptionToken() {
191 181
         // NOTE: cursor and expirationDate are optional by the specification,
192 182
         //       but we include them in our implementation
193 183
 
@@ -245,8 +235,7 @@  discard block
 block discarded – undo
245 235
     /**
246 236
      * @test
247 237
      */
248
-    public function noResumptionTokenForCompleteList()
249
-    {
238
+    public function noResumptionTokenForCompleteList() {
250 239
         $client = new HttpClient();
251 240
 
252 241
         foreach (['ListIdentifiers', 'ListRecords'] as $verb) {
@@ -268,8 +257,7 @@  discard block
 block discarded – undo
268 257
     /**
269 258
      * @test
270 259
      */
271
-    public function canListAndResumeIdentifiers()
272
-    {
260
+    public function canListAndResumeIdentifiers() {
273 261
         $oai = Endpoint::build($this->oaiUrl);
274 262
         $result = $oai->listIdentifiers('mets');
275 263
 
@@ -282,18 +270,15 @@  discard block
 block discarded – undo
282 270
         $this->assertEquals('oai:de:slub-dresden:db:id-476248086', $record->identifier);
283 271
     }
284 272
 
285
-    protected function parseUtc(string $dateTime)
286
-    {
273
+    protected function parseUtc(string $dateTime) {
287 274
         return DateTime::createFromFormat('Y-m-d\TH:i:s\Z', $dateTime);
288 275
     }
289 276
 
290
-    protected function assertUtcDateString(string $dateTime)
291
-    {
277
+    protected function assertUtcDateString(string $dateTime) {
292 278
         $this->assertInstanceOf(DateTime::class, $this->parseUtc($dateTime));
293 279
     }
294 280
 
295
-    protected function assertInFuture(string $dateTime)
296
-    {
281
+    protected function assertInFuture(string $dateTime) {
297 282
         $this->assertGreaterThan(new DateTime(), $this->parseUtc($dateTime));
298 283
     }
299 284
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 class OaiPmhTest extends FunctionalTestCase
16 16
 {
17
-    protected $disableJsonWrappedResponse = true;
17
+    protected $disableJsonWrappedResponse = TRUE;
18 18
 
19 19
     protected $coreExtensionsToLoad = [
20 20
         'fluid',
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     protected function setUpOaiSolr()
57 57
     {
58 58
         // Setup Solr only once for all tests in this suite
59
-        static $solr = null;
59
+        static $solr = NULL;
60 60
 
61
-        if ($solr === null) {
61
+        if ($solr === NULL) {
62 62
             $coreName = Solr::createCore();
63 63
             $solr = Solr::getInstance($coreName);
64 64
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     protected function importSolrDocuments(Solr $solr, string $path)
75 75
     {
76
-        $jsonDocuments = json_decode(file_get_contents($path), true);
76
+        $jsonDocuments = json_decode(file_get_contents($path), TRUE);
77 77
 
78 78
         $updateQuery = $solr->service->createUpdate();
79 79
         $documents = array_map(function ($jsonDoc) use ($updateQuery) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $this->expectExceptionMessage('empty list');
179 179
 
180 180
         $oai = Endpoint::build($this->oaiUrl);
181
-        $result = $oai->listRecords('mets', null, (new DateTime())->setDate(1900, 1, 1));
181
+        $result = $oai->listRecords('mets', NULL, (new DateTime())->setDate(1900, 1, 1));
182 182
 
183 183
         $result->current();
184 184
     }
Please login to merge, or discard this patch.
Tests/Functional/Repository/DocumentRepositoryTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
 
22 22
         $this->documentRepository = $this->initializeRepository(DocumentRepository::class, 20000);
23 23
 
24
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/documents_1.xml');
25
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/pages.xml');
26
-        $this->importDataSet(__DIR__ . '/../../Fixtures/Common/libraries.xml');
24
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/documents_1.xml');
25
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/pages.xml');
26
+        $this->importDataSet(__DIR__.'/../../Fixtures/Common/libraries.xml');
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
9 9
 use TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage;
10 10
 
11
-class DocumentRepositoryTest extends FunctionalTestCase
12
-{
11
+class DocumentRepositoryTest extends FunctionalTestCase {
13 12
     /**
14 13
      * @var DocumentRepository
15 14
      */
Please login to merge, or discard this patch.