Passed
Pull Request — master (#123)
by
unknown
04:32
created
Tests/Unit/Validation/DOMDocumentValidationStackTest.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
  *
30 30
  * @access public
31 31
  */
32
-class DOMDocumentValidationStackTest extends UnitTestCase
33
-{
32
+class DOMDocumentValidationStackTest extends UnitTestCase {
34 33
     public function setUp(): void
35 34
     {
36 35
         parent::setUp();
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     public function setUp(): void
35 35
     {
36 36
         parent::setUp();
37
-        $this->resetSingletonInstances = true;
37
+        $this->resetSingletonInstances = TRUE;
38 38
     }
39 39
 
40 40
     public function testValueTypeException(): void
Please login to merge, or discard this patch.
Tests/Unit/Validation/XmlSchemesValidatorTest.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@
 block discarded – undo
26 26
  *
27 27
  * @access public
28 28
  */
29
-class XmlSchemesValidatorTest extends UnitTestCase
30
-{
29
+class XmlSchemesValidatorTest extends UnitTestCase {
31 30
     const METS = <<<METS
32 31
         <mets:mets
33 32
             xmlns:mets="http://www.loc.gov/METS/"
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
     public function setUp(): void
71 71
     {
72 72
         parent::setUp();
73
-        $this->resetSingletonInstances = true;
73
+        $this->resetSingletonInstances = TRUE;
74 74
     }
75 75
 
76 76
     public function testValidation(): void
Please login to merge, or discard this patch.
Classes/Controller/AbstractController.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
                 if ($doc !== null) {
165 165
                     $this->document->setCurrentDocument($doc);
166 166
                 } else {
167
-                    $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"');
167
+                    $this->logger->error('Failed to load document with record ID "'.$this->requestData['recordId'].'"');
168 168
                 }
169 169
             }
170 170
         } else {
171
-            $this->logger->error('Invalid ID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading');
171
+            $this->logger->error('Invalid ID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading');
172 172
         }
173 173
     }
174 174
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
             && !MathUtility::canBeInterpretedAsInteger($this->requestData['id'])
266 266
             && !GeneralUtility::isValidUrl($this->requestData['id'])
267 267
         ) {
268
-            $this->logger->warning('Invalid ID or URI "' . $this->requestData['id'] . '" for document loading');
268
+            $this->logger->warning('Invalid ID or URI "'.$this->requestData['id'].'" for document loading');
269 269
             unset($this->requestData['id']);
270 270
         }
271 271
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     {
326 326
         if (!array_key_exists($setting, $this->settings) || empty($this->settings[$setting])) {
327 327
             $this->settings[$setting] = $value;
328
-            $this->logger->warning('Setting "' . $setting . '" not set, using default value "' . $value . '". Probably FlexForm for controller "' . get_class($this) . '" is not read.');
328
+            $this->logger->warning('Setting "'.$setting.'" not set, using default value "'.$value.'". Probably FlexForm for controller "'.get_class($this).'" is not read.');
329 329
         } else {
330 330
             $this->settings[$setting] = (int) $this->settings[$setting];
331 331
         }
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         $pages = [];
411 411
         $pagesSect = [];
412 412
         $aRange = [];
413
-        $nRange = 5;    // ToDo: should be made configurable
413
+        $nRange = 5; // ToDo: should be made configurable
414 414
 
415 415
         // lower limit of the range
416 416
         $nBottom = $currentPageNumber - $nRange;
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 
426 426
         // check whether the first screen page is > 1, if yes then points must be added
427 427
         if ($aRange[0] > 1) {
428
-            array_push($pagesSect, ['label' => '...','startRecordNumber' => '...']);
428
+            array_push($pagesSect, ['label' => '...', 'startRecordNumber' => '...']);
429 429
         };
430 430
         $lastStartRecordNumberGrid = 0; // due to validity outside the loop
431 431
         foreach (range($firstPage, $lastPage) as $i) {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
                 // Check if screen page is in range
470 470
                 if (in_array($i, $aRange)) {
471
-                    array_push($pagesSect, ['label' => $i,'startRecordNumber' => $startRecordNumber]);
471
+                    array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $startRecordNumber]);
472 472
                 };
473 473
             };
474 474
         };
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
             // fix for count(): Argument #1 ($value) must be of type Countable|array, null given
535 535
             $this->documentArray[] = $doc;
536 536
         } else {
537
-            $this->logger->error('Invalid UID "' . $documentId . '" or PID "' . $this->settings['storagePid'] . '" for document loading');
537
+            $this->logger->error('Invalid UID "'.$documentId.'" or PID "'.$this->settings['storagePid'].'" for document loading');
538 538
         }
539 539
 
540 540
         return $doc;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             foreach ($this->requestData['multipleSource'] as $location) {
573 573
                 $document = AbstractDocument::getInstance($location, $this->settings, true);
574 574
                 if ($document !== null) {
575
-                    $this->documentArray['extra_' . $i] = $document;
575
+                    $this->documentArray['extra_'.$i] = $document;
576 576
                 }
577 577
                 $i++;
578 578
             }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
             $this->document->setLocation($documentId);
598 598
         } else {
599
-            $this->logger->error('Invalid location given "' . $documentId . '" for document loading');
599
+            $this->logger->error('Invalid location given "'.$documentId.'" for document loading');
600 600
         }
601 601
 
602 602
         return $doc;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @access protected
63 63
      * @var Document|null This holds the current document
64 64
      */
65
-    protected ?Document $document = null;
65
+    protected ?Document $document = NULL;
66 66
 
67 67
     /**
68 68
      * @access protected
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         // Try to get document format from database
144 144
         if (!empty($documentId)) {
145 145
 
146
-            $doc = null;
146
+            $doc = NULL;
147 147
 
148 148
             if (MathUtility::canBeInterpretedAsInteger($documentId)) {
149 149
                 $doc = $this->getDocumentByUid($documentId);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                 $doc = $this->getDocumentByUrl($documentId);
152 152
             }
153 153
 
154
-            if ($this->document !== null && $doc !== null) {
154
+            if ($this->document !== NULL && $doc !== NULL) {
155 155
                 $this->document->setCurrentDocument($doc);
156 156
             }
157 157
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 
160 160
             $this->document = $this->documentRepository->findOneByRecordId($this->requestData['recordId']);
161 161
 
162
-            if ($this->document !== null) {
163
-                $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true);
164
-                if ($doc !== null) {
162
+            if ($this->document !== NULL) {
163
+                $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE);
164
+                if ($doc !== NULL) {
165 165
                     $this->document->setCurrentDocument($doc);
166 166
                 } else {
167 167
                     $this->logger->error('Failed to load document with record ID "' . $this->requestData['recordId'] . '"');
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      */
219 219
     protected function isDocMissing(): bool
220 220
     {
221
-        return $this->document === null || $this->document->getCurrentDocument() === null;
221
+        return $this->document === NULL || $this->document->getCurrentDocument() === NULL;
222 222
     }
223 223
 
224 224
     /**
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         if ($this->request->hasArgument($parameterName)) {
248 248
             return $this->request->getArgument($parameterName);
249 249
         }
250
-        return null;
250
+        return NULL;
251 251
     }
252 252
 
253 253
     /**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             if (isset($this->settings['multiViewType']) && $this->document->getCurrentDocument()->tableOfContents[0]['type'] === $this->settings['multiViewType']) {
369 369
                 $i = 0;
370 370
                 foreach ($this->documentArray as $document) {
371
-                    if ($document !== null) {
371
+                    if ($document !== NULL) {
372 372
                         $this->requestData['docPage'][$i] = MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i], 1, $document->numPages, 1);
373 373
                         $i++;
374 374
                     }
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
         };
480 480
 
481 481
         // Safely get the next and previous page numbers
482
-        $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : null;
483
-        $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : null;
482
+        $nextPageNumber = isset($pages[$currentPageNumber + 1]) ? $pages[$currentPageNumber + 1]['startRecordNumber'] : NULL;
483
+        $previousPageNumber = isset($pages[$currentPageNumber - 1]) ? $pages[$currentPageNumber - 1]['startRecordNumber'] : NULL;
484 484
 
485 485
         // 'startRecordNumber' is not required in GridView, only the variant for each loop is required
486 486
         // 'endRecordNumber' is not required in both views
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
     private function getDocumentByUid(int $documentId)
527 527
     {
528 528
         // TODO: implement multiView as it is in getDocumentByUrl
529
-        $doc = null;
529
+        $doc = NULL;
530 530
         $this->document = $this->documentRepository->findOneByIdAndSettings($documentId);
531 531
 
532 532
         if ($this->document) {
533
-            $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, true);
533
+            $doc = AbstractDocument::getInstance($this->document->getLocation(), $this->settings, TRUE);
534 534
             // fix for count(): Argument #1 ($value) must be of type Countable|array, null given
535 535
             $this->documentArray[] = $doc;
536 536
         } else {
@@ -551,13 +551,13 @@  discard block
 block discarded – undo
551 551
      */
552 552
     protected function getDocumentByUrl(string $documentId)
553 553
     {
554
-        $doc = AbstractDocument::getInstance($documentId, $this->settings, true);
554
+        $doc = AbstractDocument::getInstance($documentId, $this->settings, TRUE);
555 555
 
556 556
         if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) {
557 557
             $childDocuments = $doc->tableOfContents[0]['children'];
558 558
             $i = 0;
559 559
             foreach ($childDocuments as $document) {
560
-                $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, true);
560
+                $this->documentArray[] = AbstractDocument::getInstance($document['points'], $this->settings, TRUE);
561 561
                 if (!isset($this->requestData['docPage'][$i]) && isset(explode('#', $document['points'])[1])) {
562 562
                     $initPage = explode('#', $document['points'])[1];
563 563
                     $this->requestData['docPage'][$i] = $initPage;
@@ -570,21 +570,21 @@  discard block
 block discarded – undo
570 570
         if ($this->requestData['multipleSource'] && is_array($this->requestData['multipleSource'])) {
571 571
             $i = 0;
572 572
             foreach ($this->requestData['multipleSource'] as $location) {
573
-                $document = AbstractDocument::getInstance($location, $this->settings, true);
574
-                if ($document !== null) {
573
+                $document = AbstractDocument::getInstance($location, $this->settings, TRUE);
574
+                if ($document !== NULL) {
575 575
                     $this->documentArray['extra_' . $i] = $document;
576 576
                 }
577 577
                 $i++;
578 578
             }
579 579
         }
580 580
 
581
-        if ($doc !== null) {
581
+        if ($doc !== NULL) {
582 582
             $this->document = GeneralUtility::makeInstance(Document::class);
583 583
 
584 584
             if ($doc->recordId) {
585 585
                 // find document from repository by recordId
586 586
                 $docFromRepository = $this->documentRepository->findOneByRecordId($doc->recordId);
587
-                if ($docFromRepository !== null) {
587
+                if ($docFromRepository !== NULL) {
588 588
                     $this->document = $docFromRepository;
589 589
                 }
590 590
             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
  *
40 40
  * @abstract
41 41
  */
42
-abstract class AbstractController extends ActionController implements LoggerAwareInterface
43
-{
42
+abstract class AbstractController extends ActionController implements LoggerAwareInterface {
44 43
     use LoggerAwareTrait;
45 44
 
46 45
     /**
@@ -248,8 +247,7 @@  discard block
 block discarded – undo
248 247
      *
249 248
      * @return null|string|array
250 249
      */
251
-    protected function getParametersSafely(string $parameterName)
252
-    {
250
+    protected function getParametersSafely(string $parameterName) {
253 251
         if ($this->request->hasArgument($parameterName)) {
254 252
             return $this->request->getArgument($parameterName);
255 253
         }
@@ -444,7 +442,8 @@  discard block
 block discarded – undo
444 442
         $lastStartRecordNumberGrid = 0; // due to validity outside the loop
445 443
         foreach (range($firstPage, $lastPage) as $i) {
446 444
             // detect which pagination is active: ListView or GridView
447
-            if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') {  // ListView
445
+            if (get_class($pagination) == 'TYPO3\CMS\Core\Pagination\SimplePagination') {
446
+// ListView
448 447
                 $lastStartRecordNumberGrid = $i; // save last $startRecordNumber for LastPage button
449 448
 
450 449
                 $pages[$i] = [
@@ -457,7 +456,8 @@  discard block
 block discarded – undo
457 456
                 if (in_array($i, $aRange)) {
458 457
                     array_push($pagesSect, ['label' => $i, 'startRecordNumber' => $i]);
459 458
                 };
460
-            } else { // GridView
459
+            } else {
460
+// GridView
461 461
                 // to calculate the values for generation the links for the pagination pages
462 462
                 /** @var \Kitodo\Dlf\Pagination\PageGridPaginator $paginator */
463 463
                 $itemsPerPage = $paginator->getPublicItemsPerPage();
@@ -537,8 +537,7 @@  discard block
 block discarded – undo
537 537
      *
538 538
      * @return AbstractDocument
539 539
      */
540
-    private function getDocumentByUid(int $documentId)
541
-    {
540
+    private function getDocumentByUid(int $documentId) {
542 541
         // TODO: implement multiView as it is in getDocumentByUrl
543 542
         $doc = null;
544 543
         $this->document = $this->documentRepository->findOneByIdAndSettings($documentId);
@@ -563,8 +562,7 @@  discard block
 block discarded – undo
563 562
      *
564 563
      * @return AbstractDocument
565 564
      */
566
-    protected function getDocumentByUrl(string $documentId)
567
-    {
565
+    protected function getDocumentByUrl(string $documentId) {
568 566
         $doc = AbstractDocument::getInstance($documentId, $this->settings, true);
569 567
 
570 568
         if (isset($this->settings['multiViewType']) && $doc->tableOfContents[0]['type'] === $this->settings['multiViewType']) {
Please login to merge, or discard this patch.
Classes/Validation/AbstractDlfValidator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public function validate($value): Result
48 48
     {
49 49
         if (!$value instanceof $this->valueClassName) {
50
-            $this->logger->debug('Value must be an instance of ' . $this->valueClassName . '.');
50
+            $this->logger->debug('Value must be an instance of '.$this->valueClassName.'.');
51 51
             throw new InvalidArgumentException('Type of value is not valid.', 1723126505626);
52 52
         }
53 53
         return parent::validate($value);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @access public
31 31
  */
32
-abstract class AbstractDlfValidator extends AbstractValidator
33
-{
32
+abstract class AbstractDlfValidator extends AbstractValidator {
34 33
     use LoggerAwareTrait;
35 34
 
36 35
     protected string $valueClassName;
@@ -38,8 +37,7 @@  discard block
 block discarded – undo
38 37
     /**
39 38
      * @param $valueClassName string The class name of the value
40 39
      */
41
-    public function __construct(string $valueClassName)
42
-    {
40
+    public function __construct(string $valueClassName) {
43 41
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
44 42
         $this->valueClassName = $valueClassName;
45 43
     }
Please login to merge, or discard this patch.
Classes/Controller/AnnotationController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@
 block discarded – undo
22 22
  * @subpackage dlf
23 23
  * @access public
24 24
  */
25
-class AnnotationController extends AbstractController
26
-{
25
+class AnnotationController extends AbstractController {
27 26
     /**
28 27
      * The main method of the plugin
29 28
      *
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
         $this->loadDocument();
35 35
 
36 36
         if (
37
-            $this->document === null
38
-            || $this->document->getCurrentDocument() === null
37
+            $this->document === NULL
38
+            || $this->document->getCurrentDocument() === NULL
39 39
         ) {
40 40
             // Quit without doing anything if required variables are not set.
41 41
         } else {
Please login to merge, or discard this patch.
Classes/Controller/PageViewController.php 3 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
             }
184 184
 
185 185
             $navigationArray[$i]['next'] = [
186
-                'tx_dlf[docPage][' . $i . ']' =>
186
+                'tx_dlf[docPage]['.$i.']' =>
187 187
                     MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1)
188 188
             ];
189 189
             $navigationArray[$i]['prev'] = [
190
-                'tx_dlf[docPage][' . $i . ']' =>
190
+                'tx_dlf[docPage]['.$i.']' =>
191 191
                     MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1)
192 192
             ];
193 193
 
194 194
             $navigateAllPageNext = array_merge(
195 195
                 $navigateAllPageNext,
196 196
                 [
197
-                    'tx_dlf[docPage][' . $i . ']' =>
197
+                    'tx_dlf[docPage]['.$i.']' =>
198 198
                         MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] + 1, 1, $document->numPages, 1)
199 199
                 ]
200 200
             );
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
             $navigateAllPagePrev = array_merge(
203 203
                 $navigateAllPagePrev,
204 204
                 [
205
-                    'tx_dlf[docPage][' . $i . ']' =>
205
+                    'tx_dlf[docPage]['.$i.']' =>
206 206
                         MathUtility::forceIntegerInRange((int) $this->requestData['docPage'][$i] - 1, 1, $document->numPages, 1)
207 207
                 ]
208 208
             );
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             $navigateAllMeasureNext = array_merge(
211 211
                 $navigateAllMeasureNext,
212 212
                 [
213
-                    'tx_dlf[docMeasure][' . $i . ']' =>
213
+                    'tx_dlf[docMeasure]['.$i.']' =>
214 214
                         MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1)
215 215
                 ]
216 216
             );
@@ -218,19 +218,19 @@  discard block
 block discarded – undo
218 218
             $navigateAllMeasurePrev = array_merge(
219 219
                 $navigateAllMeasurePrev,
220 220
                 [
221
-                    'tx_dlf[docMeasure][' . $i . ']' =>
221
+                    'tx_dlf[docMeasure]['.$i.']' =>
222 222
                         MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1)
223 223
                 ]
224 224
             );
225 225
 
226 226
             if ($document->numMeasures > 0) {
227 227
                 $navigationMeasureArray[$i]['next'] = [
228
-                    'tx_dlf[docMeasure][' . $i . ']' =>
228
+                    'tx_dlf[docMeasure]['.$i.']' =>
229 229
                         MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] + 1, 1, $document->numMeasures, 1)
230 230
                 ];
231 231
 
232 232
                 $navigationMeasureArray[$i]['prev'] = [
233
-                    'tx_dlf[docMeasure][' . $i . ']' =>
233
+                    'tx_dlf[docMeasure]['.$i.']' =>
234 234
                         MathUtility::forceIntegerInRange((int) $this->requestData['docMeasure'][$i] - 1, 1, $document->numMeasures, 1)
235 235
                 ];
236 236
             }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             }
285 285
             $params = array_merge(
286 286
                 ['tx_dlf' => $this->requestData],
287
-                ['tx_dlf[multipleSource][' . $nextMultipleSourceKey . ']' => $formAddDocument->getLocation()],
287
+                ['tx_dlf[multipleSource]['.$nextMultipleSourceKey.']' => $formAddDocument->getLocation()],
288 288
                 ['tx_dlf[multiview]' => 1]
289 289
             );
290 290
             $uriBuilder = $this->uriBuilder;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                             // build link for each measure
333 333
                             $params = [
334 334
                                 'tx_dlf' => $this->requestData,
335
-                                'tx_dlf[docMeasure][' . $docNumber . ']' => $i
335
+                                'tx_dlf[docMeasure]['.$docNumber.']' => $i
336 336
                             ];
337 337
                         } else {
338 338
                             // build link for each measure
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         }
417 417
 
418 418
         if (empty($score)) {
419
-            $this->logger->notice('No score file found for page "' . $page . '" in fileGrps "' . ($this->settings['fileGrpScore'] ?? '') . '"');
419
+            $this->logger->notice('No score file found for page "'.$page.'" in fileGrps "'.($this->settings['fileGrpScore'] ?? '').'"');
420 420
         }
421 421
         return $score;
422 422
     }
@@ -447,11 +447,11 @@  discard block
 block discarded – undo
447 447
                 $fulltext['mimetype'] = $file['mimeType'];
448 448
                 break;
449 449
             } else {
450
-                $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrp "' . $fileGrpFulltext . '"');
450
+                $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrp "'.$fileGrpFulltext.'"');
451 451
             }
452 452
         }
453 453
         if (empty($fulltext)) {
454
-            $this->logger->notice('No full-text file found for page "' . $page . '" in fileGrps "' . $this->extConf['files']['fileGrpFulltext'] . '"');
454
+            $this->logger->notice('No full-text file found for page "'.$page.'" in fileGrps "'.$this->extConf['files']['fileGrpFulltext'].'"');
455 455
         }
456 456
         return $fulltext;
457 457
     }
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                         'measureIdLinks' => $docMeasures['measureLinks']
512 512
                     ];
513 513
 
514
-                    $jsViewer .= 'tx_dlf_viewer[' . $i . '] = new dlfViewer(' . json_encode($viewer) . ');
514
+                    $jsViewer .= 'tx_dlf_viewer['.$i.'] = new dlfViewer('.json_encode($viewer).');
515 515
                             ';
516 516
                     $i++;
517 517
                 }
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
             // Viewer configuration.
521 521
             $viewerConfiguration = '$(document).ready(function() {
522 522
                     if (dlfUtils.exists(dlfViewer)) {
523
-                        ' . $jsViewer . '
524
-                        viewerCount = ' . ($i - 1) . ';
523
+                        ' . $jsViewer.'
524
+                        viewerCount = ' . ($i - 1).';
525 525
                     }
526 526
                 });';
527 527
         } else {
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             // Viewer configuration.
552 552
             $viewerConfiguration = '$(document).ready(function() {
553 553
                     if (dlfUtils.exists(dlfViewer)) {
554
-                        tx_dlf_viewer = new dlfViewer(' . json_encode($viewer) . ');
554
+                        tx_dlf_viewer = new dlfViewer(' . json_encode($viewer).');
555 555
                     }
556 556
                 });';
557 557
         }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
                     }
648 648
                     break;
649 649
                 } else {
650
-                    $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"');
650
+                    $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"');
651 651
                 }
652 652
 
653 653
             } else {
@@ -667,12 +667,12 @@  discard block
 block discarded – undo
667 667
                     }
668 668
                     break;
669 669
                 } else {
670
-                    $this->logger->notice('No image file found for page "' . $page . '" in fileGrp "' . $fileGrpImages . '"');
670
+                    $this->logger->notice('No image file found for page "'.$page.'" in fileGrp "'.$fileGrpImages.'"');
671 671
                 }
672 672
             }
673 673
         }
674 674
         if (empty($image)) {
675
-            $this->logger->warning('No image file found for page "' . $page . '" in fileGrps "' . $this->extConf['files']['fileGrpImages'] . '"');
675
+            $this->logger->warning('No image file found for page "'.$page.'" in fileGrps "'.$this->extConf['files']['fileGrpImages'].'"');
676 676
         }
677 677
         return $image;
678 678
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * @access public
33 33
  */
34
-class PageViewController extends AbstractController
35
-{
34
+class PageViewController extends AbstractController {
36 35
     /**
37 36
      * @access protected
38 37
      * @var array Holds the controls to add to the map
@@ -258,8 +257,7 @@  discard block
 block discarded – undo
258 257
      * @param $page
259 258
      * @return false|int|mixed|string|null
260 259
      */
261
-    public function convertMeasureOrPage($document, $measure = null, $page = null)
262
-    {
260
+    public function convertMeasureOrPage($document, $measure = null, $page = null) {
263 261
         $return = null;
264 262
         $measure2Page = array_column($document->musicalStructure, 'page');
265 263
         if ($measure) {
@@ -370,8 +368,7 @@  discard block
 block discarded – undo
370 368
      *
371 369
      * @return array URL and MIME type of fulltext file
372 370
      */
373
-    protected function getScore(int $page, MetsDocument $specificDoc = null)
374
-    {
371
+    protected function getScore(int $page, MetsDocument $specificDoc = null) {
375 372
         $score = [];
376 373
         $loc = '';
377 374
         if ($specificDoc) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 
144 144
         $this->view->assign('docCount', is_array($this->documentArray) ? count($this->documentArray) : 0);
145 145
         $this->view->assign('docArray', $this->documentArray);
146
-        $this->view->assign('docPage', $this->requestData['docPage'] ?? null);
146
+        $this->view->assign('docPage', $this->requestData['docPage'] ?? NULL);
147 147
         $this->view->assign('docType', $this->document->getCurrentDocument()->tableOfContents[0]['type']);
148 148
 
149
-        $this->view->assign('multiview', $this->requestData['multiview'] ?? null);
150
-        if ($this->requestData['multiview'] ?? false) {
149
+        $this->view->assign('multiview', $this->requestData['multiview'] ?? NULL);
150
+        if ($this->requestData['multiview'] ?? FALSE) {
151 151
             $this->multipageNavigation();
152 152
         }
153 153
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             // convert either page or measure if requestData exists
177 177
             if ($this->requestData['docPage'][$i] && empty($this->requestData['docMeasure'][$i])) {
178 178
                 // convert document page information to measure count information
179
-                $this->requestData['docMeasure'][$i] = $this->convertMeasureOrPage($document, null, $this->requestData['docPage'][$i]);
179
+                $this->requestData['docMeasure'][$i] = $this->convertMeasureOrPage($document, NULL, $this->requestData['docPage'][$i]);
180 180
 
181 181
             } elseif ((empty($this->requestData['docPage'][$i]) || $this->requestData['docPage'][$i] === 1) && $this->requestData['docMeasure'][$i]) {
182 182
                 $this->requestData['docPage'][$i] = $this->convertMeasureOrPage($document, $this->requestData['docMeasure'][$i]);
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
      * @param $page
259 259
      * @return false|int|mixed|string|null
260 260
      */
261
-    public function convertMeasureOrPage($document, $measure = null, $page = null)
261
+    public function convertMeasureOrPage($document, $measure = NULL, $page = NULL)
262 262
     {
263
-        $return = null;
263
+        $return = NULL;
264 264
         $measure2Page = array_column($document->musicalStructure, 'page');
265 265
         if ($measure) {
266 266
             $return = $measure2Page[$measure];
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      * @param int|null $docNumber
307 307
      * @return array
308 308
      */
309
-    protected function getMeasures(int $page, MetsDocument $specificDoc = null, $docNumber = null): array
309
+    protected function getMeasures(int $page, MetsDocument $specificDoc = NULL, $docNumber = NULL): array
310 310
     {
311 311
         if ($specificDoc) {
312 312
             $doc = $specificDoc;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
      *
371 371
      * @return array URL and MIME type of fulltext file
372 372
      */
373
-    protected function getScore(int $page, MetsDocument $specificDoc = null)
373
+    protected function getScore(int $page, MetsDocument $specificDoc = NULL)
374 374
     {
375 375
         $score = [];
376 376
         $loc = '';
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                     // Configure @action URL for form.
401 401
                     $uri = $this->uriBuilder->reset()
402 402
                         ->setTargetPageUid($this->pageUid)
403
-                        ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? true : false)
403
+                        ->setCreateAbsoluteUri(!empty($this->settings['forceAbsoluteUrl']) ? TRUE : FALSE)
404 404
                         ->setArguments(
405 405
                             [
406 406
                                 'eID' => 'tx_dlf_pageview_proxy',
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             $jsViewer = 'tx_dlf_viewer = [];';
470 470
             $i = 0;
471 471
             foreach ($this->documentArray as $document) {
472
-                if ($document !== null) {
472
+                if ($document !== NULL) {
473 473
                     $docPage = $this->requestData['docPage'][$i];
474 474
                     $docImage = [];
475 475
                     $docFulltext = [];
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                             $docPage = $measure2Page[$this->requestData['docMeasure'][$i]];
484 484
                         }
485 485
                     }
486
-                    if ($docPage == null) {
486
+                    if ($docPage == NULL) {
487 487
                         $docPage = 1;
488 488
                     }
489 489
                     $docImage[0] = $this->getImage($docPage, $document);
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
             $docPage = $this->requestData['page'];
530 530
 
531 531
             $docMeasures = $this->getMeasures($docPage);
532
-            if ($this->requestData['measure'] ?? false) {
532
+            if ($this->requestData['measure'] ?? FALSE) {
533 533
                 $currentMeasureId = $docMeasures['measureCounterToMeasureId'][$this->requestData['measure']];
534 534
             }
535 535
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             if ($iiif instanceof ManifestInterface) {
575 575
                 $canvas = $iiif->getContainedResourceById($canvasId);
576 576
                 /* @var $canvas \Ubl\Iiif\Presentation\Common\Model\Resources\CanvasInterface */
577
-                if ($canvas != null && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) {
577
+                if ($canvas != NULL && !empty($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING))) {
578 578
                     $annotationContainers = [];
579 579
                     /*
580 580
                      *  TODO Analyzing the annotations on the server side requires loading the annotation lists / pages
@@ -584,11 +584,11 @@  discard block
 block discarded – undo
584 584
                      *  On the other hand, server connections are potentially better than client connections. Downloading annotation lists
585 585
                      */
586 586
                     foreach ($canvas->getPossibleTextAnnotationContainers(Motivation::PAINTING) as $annotationContainer) {
587
-                        if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != null) {
587
+                        if (($textAnnotations = $annotationContainer->getTextAnnotations(Motivation::PAINTING)) != NULL) {
588 588
                             foreach ($textAnnotations as $annotation) {
589 589
                                 if (
590 590
                                     $annotation->getBody()->getFormat() == 'text/plain'
591
-                                    && $annotation->getBody()->getChars() != null
591
+                                    && $annotation->getBody()->getChars() != NULL
592 592
                                 ) {
593 593
                                     $annotationListData = [];
594 594
                                     $annotationListData['uri'] = $annotationContainer->getId();
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      *
626 626
      * @return array URL and MIME type of image file
627 627
      */
628
-    protected function getImage(int $page, MetsDocument $specificDoc = null): array
628
+    protected function getImage(int $page, MetsDocument $specificDoc = NULL): array
629 629
     {
630 630
         $image = [];
631 631
         // Get @USE value of METS fileGrp.
Please login to merge, or discard this patch.
Classes/Common/Solr/SolrSearchQuery.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
  * @property int $limit
17 17
  * @property int $offset
18 18
  */
19
-class SolrSearchQuery extends Query
20
-{
19
+class SolrSearchQuery extends Query {
21 20
     /**
22 21
      * @access private
23 22
      * @var SolrSearch
@@ -33,8 +32,7 @@  discard block
 block discarded – undo
33 32
      *
34 33
      * @return void
35 34
      */
36
-    public function __construct($solrSearch)
37
-    {
35
+    public function __construct($solrSearch) {
38 36
         $this->solrSearch = $solrSearch;
39 37
 
40 38
         $this->offset = 0;
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      */
53 51
     // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable<object>&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute()
54 52
     // @phpstan-ignore-next-line
55
-    public function execute($returnRawQueryResult = false)
56
-    {
53
+    public function execute($returnRawQueryResult = false) {
57 54
         $this->solrSearch->submit($this->offset, $this->limit);
58 55
 
59 56
         // solrSearch now only contains the results in range, indexed in [0, n)
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      */
53 53
     // TODO: Return type (array) of method SolrSearchQuery::execute() should be compatible with return type (iterable<object>&TYPO3\CMS\Extbase\Persistence\QueryResultInterface) of method TYPO3\CMS\Extbase\Persistence\QueryInterface::execute()
54 54
     // @phpstan-ignore-next-line
55
-    public function execute($returnRawQueryResult = false)
55
+    public function execute($returnRawQueryResult = FALSE)
56 56
     {
57 57
         $this->solrSearch->submit($this->offset, $this->limit);
58 58
 
Please login to merge, or discard this patch.
Configuration/Backend/Modules.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         'navigationComponentId' => '@typo3/backend/page-tree/page-tree-element',
27 27
         'controllerActions'     => [
28 28
             \Kitodo\Dlf\Controller\Backend\NewTenantController::class => [
29
-                'index','error','addFormat','addMetadata','addSolrCore','addStructure'
29
+                'index', 'error', 'addFormat', 'addMetadata', 'addSolrCore', 'addStructure'
30 30
             ],
31 31
         ],
32 32
     ],
Please login to merge, or discard this patch.
Tests/Functional/FunctionalTestCase.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
97 97
 
98 98
         if ($this->disableJsonWrappedResponse) {
99
-            $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function ($ext) {
99
+            $this->frameworkExtensionsToLoad = array_filter($this->frameworkExtensionsToLoad, function($ext) {
100 100
                 return $ext !== 'Resources/Core/Functional/Extensions/json_response';
101 101
             });
102 102
         }
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 
109 109
         $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
110 110
 
111
-        $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/';
111
+        $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-'.$this->identifier.'/';
112 112
         $this->httpClient = new HttpClient([
113
-            'base_uri' => $this->baseUrl . 'index.php',
113
+            'base_uri' => $this->baseUrl.'index.php',
114 114
             'http_errors' => false,
115 115
         ]);
116 116
 
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 
170 170
     protected function addSiteConfig($identifier)
171 171
     {
172
-        $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
172
+        $siteConfig = Yaml::parseFile(__DIR__.'/../Fixtures/siteconfig.yaml');
173 173
         $siteConfig['base'] = $this->baseUrl;
174 174
         $siteConfig['languages'][0]['base'] = $this->baseUrl;
175 175
 
176
-        $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier;
176
+        $siteConfigPath = $this->instancePath.'/typo3conf/sites/'.$identifier;
177 177
         @mkdir($siteConfigPath, 0775, true);
178
-        file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
178
+        file_put_contents($siteConfigPath.'/config.yaml', Yaml::dump($siteConfig));
179 179
 
180 180
         // refresh site cache (otherwise site config is not found)
181 181
         $finder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Site\SiteFinder::class);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $jsonDocuments = json_decode(file_get_contents($path), true);
198 198
 
199 199
         $updateQuery = $solr->service->createUpdate();
200
-        $documents = array_map(function ($jsonDoc) use ($updateQuery) {
200
+        $documents = array_map(function($jsonDoc) use ($updateQuery) {
201 201
             $document = $updateQuery->createDocument();
202 202
             foreach ($jsonDoc as $key => $value) {
203 203
                 $document->setField($key, $value);
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected $httpClient;
91 91
 
92
-    public function __construct()
93
-    {
92
+    public function __construct() {
94 93
         parent::__construct();
95 94
 
96 95
         $this->configurationToUseInTestInstance['EXTENSIONS']['dlf'] = $this->getDlfConfiguration();
@@ -117,8 +116,7 @@  discard block
 block discarded – undo
117 116
         $this->addSiteConfig('dlf-testing');
118 117
     }
119 118
 
120
-    protected function getDlfConfiguration()
121
-    {
119
+    protected function getDlfConfiguration() {
122 120
         $dotenv = Dotenv::createImmutable('/home/runner/work/kitodo-presentation/kitodo-presentation/Build/Test/', 'test.env');
123 121
         $dotenv->load();
124 122
 
@@ -167,8 +165,7 @@  discard block
 block discarded – undo
167 165
         ];
168 166
     }
169 167
 
170
-    protected function addSiteConfig($identifier)
171
-    {
168
+    protected function addSiteConfig($identifier) {
172 169
         $siteConfig = Yaml::parseFile(__DIR__ . '/../Fixtures/siteconfig.yaml');
173 170
         $siteConfig['base'] = $this->baseUrl;
174 171
         $siteConfig['languages'][0]['base'] = $this->baseUrl;
@@ -182,8 +179,7 @@  discard block
 block discarded – undo
182 179
         $finder->getAllSites(false); // useCache = false
183 180
     }
184 181
 
185
-    protected function initializeRepository(string $className, int $storagePid)
186
-    {
182
+    protected function initializeRepository(string $className, int $storagePid) {
187 183
         $repository = GeneralUtility::makeInstance($className);
188 184
         $querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
189 185
         $querySettings->setStoragePageIds([$storagePid]);
@@ -192,8 +188,7 @@  discard block
 block discarded – undo
192 188
         return $repository;
193 189
     }
194 190
 
195
-    protected function importSolrDocuments(Solr $solr, string $path)
196
-    {
191
+    protected function importSolrDocuments(Solr $solr, string $path) {
197 192
         $jsonDocuments = json_decode(file_get_contents($path), true);
198 193
 
199 194
         $updateQuery = $solr->service->createUpdate();
@@ -212,8 +207,7 @@  discard block
 block discarded – undo
212 207
         $solr->service->update($updateQuery);
213 208
     }
214 209
 
215
-    protected function initLanguageService(string $locale)
216
-    {
210
+    protected function initLanguageService(string $locale) {
217 211
         // create mock backend user and set language
218 212
         // which is loaded by LanguageServiceFactory as default value in backend mode
219 213
         $backendUser = GeneralUtility::makeInstance(BackendUserAuthentication::class);
@@ -224,8 +218,7 @@  discard block
 block discarded – undo
224 218
     /**
225 219
      * Assert that $sub is recursively contained within $super.
226 220
      */
227
-    protected function assertArrayMatches(array $sub, array $super, string $message = '')
228
-    {
221
+    protected function assertArrayMatches(array $sub, array $super, string $message = '') {
229 222
         self::assertEquals($sub, ArrayUtility::intersectRecursive($super, $sub), $message);
230 223
     }
231 224
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         ],
53 53
         'FE' => [
54 54
             'cacheHash' => [
55
-                'enforceValidation' => false,
55
+                'enforceValidation' => FALSE,
56 56
             ],
57 57
         ],
58 58
         'DB' => [
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * @var bool
74 74
      */
75
-    protected $disableJsonWrappedResponse = false;
75
+    protected $disableJsonWrappedResponse = FALSE;
76 76
 
77 77
     /**
78 78
      * @var PersistenceManager
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $this->baseUrl = 'http://web:8000/public/typo3temp/var/tests/functional-' . $this->identifier . '/';
112 112
         $this->httpClient = new HttpClient([
113 113
             'base_uri' => $this->baseUrl . 'index.php',
114
-            'http_errors' => false,
114
+            'http_errors' => FALSE,
115 115
         ]);
116 116
 
117 117
         $this->addSiteConfig('dlf-testing');
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
         $siteConfig['languages'][0]['base'] = $this->baseUrl;
175 175
 
176 176
         $siteConfigPath = $this->instancePath . '/typo3conf/sites/' . $identifier;
177
-        @mkdir($siteConfigPath, 0775, true);
177
+        @mkdir($siteConfigPath, 0775, TRUE);
178 178
         file_put_contents($siteConfigPath . '/config.yaml', Yaml::dump($siteConfig));
179 179
 
180 180
         // refresh site cache (otherwise site config is not found)
181 181
         $finder = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Site\SiteFinder::class);
182
-        $finder->getAllSites(false); // useCache = false
182
+        $finder->getAllSites(FALSE); // useCache = false
183 183
     }
184 184
 
185 185
     protected function initializeRepository(string $className, int $storagePid)
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
     protected function importSolrDocuments(Solr $solr, string $path)
196 196
     {
197
-        $jsonDocuments = json_decode(file_get_contents($path), true);
197
+        $jsonDocuments = json_decode(file_get_contents($path), TRUE);
198 198
 
199 199
         $updateQuery = $solr->service->createUpdate();
200 200
         $documents = array_map(function ($jsonDoc) use ($updateQuery) {
Please login to merge, or discard this patch.