Completed
Push — master ( 9a2a94...744aa1 )
by
unknown
16s queued 14s
created
Classes/Controller/StatisticsController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@
 block discarded – undo
33 33
         $foundNumbers = $this->documentRepository->getStatisticsForSelectedCollection($this->settings);
34 34
 
35 35
         // Set replacements.
36
-        $args['###TITLES###'] = $foundNumbers['titles'] . ' ' . htmlspecialchars(
36
+        $args['###TITLES###'] = $foundNumbers['titles'].' '.htmlspecialchars(
37 37
             LocalizationUtility::translate(
38 38
                 ($foundNumbers['titles'] > 1 ? 'titles' : 'title'), 'dlf'
39 39
             )
40 40
         );
41 41
 
42
-        $args['###VOLUMES###'] = $foundNumbers['volumes'] . ' ' . htmlspecialchars(
42
+        $args['###VOLUMES###'] = $foundNumbers['volumes'].' '.htmlspecialchars(
43 43
             LocalizationUtility::translate(
44 44
                 ($foundNumbers['volumes'] > 1 ? 'volumes' : 'volume'), 'dlf'
45 45
             )
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,15 +21,13 @@
 block discarded – undo
21 21
  * @subpackage dlf
22 22
  * @access public
23 23
  */
24
-class StatisticsController extends AbstractController
25
-{
24
+class StatisticsController extends AbstractController {
26 25
     /**
27 26
      * The main method of the plugin
28 27
      *
29 28
      * @return void
30 29
      */
31
-    public function mainAction()
32
-    {
30
+    public function mainAction() {
33 31
         $foundNumbers = $this->documentRepository->getStatisticsForSelectedCollection($this->settings);
34 32
 
35 33
         // Set replacements.
Please login to merge, or discard this patch.
Classes/Command/BaseCommand.php 1 patch
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
             // Get extension configuration.
108 108
             $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf');
109 109
         } else {
110
-            return false;
110
+            return FALSE;
111 111
         }
112 112
         $this->storagePid = MathUtility::forceIntegerInRange((int) $storagePid, 0);
113 113
 
114
-        return true;
114
+        return TRUE;
115 115
     }
116 116
 
117 117
     /**
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
      */
173 173
     protected function saveToDatabase(Document $document)
174 174
     {
175
-        $success = false;
175
+        $success = FALSE;
176 176
 
177 177
         $doc = $document->getDoc();
178
-        if ($doc === null) {
178
+        if ($doc === NULL) {
179 179
             return $success;
180 180
         }
181 181
         $doc->cPid = $this->storagePid;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             $document->setPartof($this->getParentDocumentUidForSaving($document));
268 268
         }
269 269
 
270
-        if ($document->getUid() === null) {
270
+        if ($document->getUid() === NULL) {
271 271
             // new document
272 272
             $this->documentRepository->add($document);
273 273
         } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
279 279
         $persistenceManager->persistAll();
280 280
 
281
-        $success = true;
281
+        $success = TRUE;
282 282
 
283 283
         return $success;
284 284
     }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     {
296 296
         $doc = $document->getDoc();
297 297
 
298
-        if ($doc !== null) {
298
+        if ($doc !== NULL) {
299 299
             // Get the closest ancestor of the current document which has a MPTR child.
300 300
             $parentMptr = $doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="' . $doc->toplevelId . '"]/ancestor::mets:div[./mets:mptr][1]/mets:mptr');
301 301
             if (!empty($parentMptr)) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                 if ($parentDoc->recordId) {
308 308
                     $parentDocument = $this->documentRepository->findOneByRecordId($parentDoc->recordId);
309 309
 
310
-                    if ($parentDocument === null) {
310
+                    if ($parentDocument === NULL) {
311 311
                         // create new Document object
312 312
                         $parentDocument = GeneralUtility::makeInstance(Document::class);
313 313
                     }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
                     $success = $this->saveToDatabase($parentDocument);
321 321
 
322
-                    if ($success === true) {
322
+                    if ($success === TRUE) {
323 323
                         // add to index
324 324
                         Indexer::add($parentDocument);
325 325
                         return $parentDocument->getUid();
Please login to merge, or discard this patch.
Classes/Domain/Repository/DocumentRepository.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,6 @@
 block discarded – undo
210 210
      * Volumes are documents that are both
211 211
      *  a) "leaf" elements i.e. partof != 0
212 212
      *  b) "root" elements that are not referenced by other documents ("root" elements that have no descendants)
213
-
214 213
      * @param array $settings
215 214
      *
216 215
      * @return array
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
         $excludeOtherWhere = '';
360 360
         if ($settings['excludeOther']) {
361
-            $excludeOtherWhere = 'tx_dlf_documents.pid=' . intval($settings['storagePid']);
361
+            $excludeOtherWhere = 'tx_dlf_documents.pid='.intval($settings['storagePid']);
362 362
         }
363 363
         // Check if there are any metadata to suggest.
364 364
         $result = $queryBuilder
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
411 411
             ->getConnectionForTable('tx_dlf_documents');
412 412
 
413
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
414
-            'FROM `tx_dlf_documents` ' .
415
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
416
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
417
-            'WHERE `tx_dlf_documents`.`record_id` = ? ' .
418
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
413
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
414
+            'FROM `tx_dlf_documents` '.
415
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
416
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
417
+            'WHERE `tx_dlf_documents`.`record_id` = ? '.
418
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
419 419
             $where;
420 420
 
421 421
         $values = [
@@ -445,13 +445,13 @@  discard block
 block discarded – undo
445 445
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
446 446
             ->getConnectionForTable('tx_dlf_documents');
447 447
 
448
-        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` ' .
449
-            'FROM `tx_dlf_documents` ' .
450
-            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` ' .
451
-            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` ' .
452
-            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) ' .
453
-            'AND `tx_dlf_relations`.`ident`="docs_colls" ' .
454
-            'AND ' . Helper::whereExpression('tx_dlf_collections') . ' ' .
448
+        $sql = 'SELECT `tx_dlf_documents`.*, GROUP_CONCAT(DISTINCT `tx_dlf_collections`.`oai_name` ORDER BY `tx_dlf_collections`.`oai_name` SEPARATOR " ") AS `collections` '.
449
+            'FROM `tx_dlf_documents` '.
450
+            'INNER JOIN `tx_dlf_relations` ON `tx_dlf_relations`.`uid_local` = `tx_dlf_documents`.`uid` '.
451
+            'INNER JOIN `tx_dlf_collections` ON `tx_dlf_collections`.`uid` = `tx_dlf_relations`.`uid_foreign` '.
452
+            'WHERE `tx_dlf_documents`.`uid` IN ( ? ) '.
453
+            'AND `tx_dlf_relations`.`ident`="docs_colls" '.
454
+            'AND '.Helper::whereExpression('tx_dlf_collections').' '.
455 455
             'GROUP BY `tx_dlf_documents`.`uid` ';
456 456
 
457 457
         $values = [
@@ -533,13 +533,13 @@  discard block
 block discarded – undo
533 533
         // Set search query.
534 534
         if (
535 535
             (!empty($searchParams['fulltext']))
536
-            || preg_match('/' . $fields['fulltext'] . ':\((.*)\)/', trim($searchParams['query']), $matches)
536
+            || preg_match('/'.$fields['fulltext'].':\((.*)\)/', trim($searchParams['query']), $matches)
537 537
         ) {
538 538
             // If the query already is a fulltext query e.g using the facets
539 539
             $searchParams['query'] = empty($matches[1]) ? $searchParams['query'] : $matches[1];
540 540
             // Search in fulltext field if applicable. Query must not be empty!
541 541
             if (!empty($searchParams['query'])) {
542
-                $query = $fields['fulltext'] . ':(' . Solr::escapeQuery(trim($searchParams['query'])) . ')';
542
+                $query = $fields['fulltext'].':('.Solr::escapeQuery(trim($searchParams['query'])).')';
543 543
             }
544 544
             $params['fulltext'] = true;
545 545
         } else {
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
                         in_array($searchParams['extOperator'][$i], $allowedOperators)
563 563
                     ) {
564 564
                         if (!empty($query)) {
565
-                            $query .= ' ' . $searchParams['extOperator'][$i] . ' ';
565
+                            $query .= ' '.$searchParams['extOperator'][$i].' ';
566 566
                         }
567
-                        $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']) . ':(' . Solr::escapeQuery($searchParams['extQuery'][$i]) . ')';
567
+                        $query .= Indexer::getIndexFieldName($searchParams['extField'][$i], $this->settings['storagePid']).':('.Solr::escapeQuery($searchParams['extQuery'][$i]).')';
568 568
                     }
569 569
                 }
570 570
             }
@@ -584,12 +584,12 @@  discard block
 block discarded – undo
584 584
         ) {
585 585
             // Search in document and all subordinates (valid for up to three levels of hierarchy).
586 586
             $params['filterquery'][]['query'] = '_query_:"{!join from='
587
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
588
-                . $fields['uid'] . ':{!join from=' . $fields['uid'] . ' to=' . $fields['partof'] . '}'
589
-                . $fields['uid'] . ':' . $searchParams['documentId'] . '"' . ' OR {!join from='
590
-                . $fields['uid'] . ' to=' . $fields['partof'] . '}'
591
-                . $fields['uid'] . ':' . $searchParams['documentId'] . ' OR '
592
-                . $fields['uid'] . ':' . $searchParams['documentId'];
587
+                . $fields['uid'].' to='.$fields['partof'].'}'
588
+                . $fields['uid'].':{!join from='.$fields['uid'].' to='.$fields['partof'].'}'
589
+                . $fields['uid'].':'.$searchParams['documentId'].'"'.' OR {!join from='
590
+                . $fields['uid'].' to='.$fields['partof'].'}'
591
+                . $fields['uid'].':'.$searchParams['documentId'].' OR '
592
+                . $fields['uid'].':'.$searchParams['documentId'];
593 593
         }
594 594
 
595 595
         // if a collection is given, we prepare the collection query string
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
             $collecionsQueryString = $collection->getIndexName();
598 598
             $params['filterquery'][]['query'] = 'toplevel:true';
599 599
             $params['filterquery'][]['query'] = 'partof:0';
600
-            $params['filterquery'][]['query'] = 'collection_faceting:("' . $collecionsQueryString . '")';
600
+            $params['filterquery'][]['query'] = 'collection_faceting:("'.$collecionsQueryString.'")';
601 601
         }
602 602
 
603 603
         // Set some query parameters.
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
         if ($listedMetadata) {
627 627
             foreach ($listedMetadata as $metadata) {
628 628
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
629
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
630
-                    $params['fields'] .= ',' . $listMetadataRecord;
629
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
630
+                    $params['fields'] .= ','.$listMetadataRecord;
631 631
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
632 632
                 }
633 633
             }
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                     if (empty($documents[$doc['uid']]['title']) && ($documents[$doc['uid']]['partOf'] > 0)) {
714 714
                         $parentDocument = $this->findByUid($documents[$doc['uid']]['partOf']);
715 715
                         if ($parentDocument) {
716
-                            $documents[$doc['uid']]['title'] = '[' . $parentDocument->getTitle() . ']';
716
+                            $documents[$doc['uid']]['title'] = '['.$parentDocument->getTitle().']';
717 717
                         }
718 718
                     }
719 719
                 }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         $metadataArray = [];
738 738
 
739 739
         // Set some query parameters.
740
-        $params['query'] = 'uid:' . $uid;
740
+        $params['query'] = 'uid:'.$uid;
741 741
         $params['start'] = 0;
742 742
         $params['rows'] = 1;
743 743
         $params['sort'] = ['score' => 'desc'];
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
         if ($listedMetadata) {
750 750
             foreach ($listedMetadata as $metadata) {
751 751
                 if ($metadata->getIndexStored() || $metadata->getIndexIndexed()) {
752
-                    $listMetadataRecord = $metadata->getIndexName() . '_' . ($metadata->getIndexTokenized() ? 't' : 'u') . ($metadata->getIndexStored() ? 's' : 'u') . ($metadata->getIndexIndexed() ? 'i' : 'u');
753
-                    $params['fields'] .= ',' . $listMetadataRecord;
752
+                    $listMetadataRecord = $metadata->getIndexName().'_'.($metadata->getIndexTokenized() ? 't' : 'u').($metadata->getIndexStored() ? 's' : 'u').($metadata->getIndexIndexed() ? 'i' : 'u');
753
+                    $params['fields'] .= ','.$listMetadataRecord;
754 754
                     $params['listMetadataRecords'][$metadata->getIndexName()] = $listMetadataRecord;
755 755
                 }
756 756
             }
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
         $cache = null;
801 801
         // Calculate cache identifier.
802 802
         if ($enableCache === true) {
803
-            $cacheIdentifier = Helper::digest($solr->core . print_r($parameters, true));
803
+            $cacheIdentifier = Helper::digest($solr->core.print_r($parameters, true));
804 804
             $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('tx_dlf_solr');
805 805
         }
806 806
         $resultSet = [
Please login to merge, or discard this patch.
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @return \Kitodo\Dlf\Domain\Model\Document|null
52 52
      */
53
-    public function findOneByParameters($parameters)
54
-    {
53
+    public function findOneByParameters($parameters) {
55 54
         $doc = null;
56 55
         $document = null;
57 56
 
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
      *
96 95
      * @return \Kitodo\Dlf\Domain\Model\Document|null
97 96
      */
98
-    public function findOldestDocument()
99
-    {
97
+    public function findOldestDocument() {
100 98
         $query = $this->createQuery();
101 99
 
102 100
         $query->setOrderings(['tstamp' => QueryInterface::ORDER_ASCENDING]);
@@ -110,8 +108,7 @@  discard block
 block discarded – undo
110 108
      * @param  \Kitodo\Dlf\Domain\Model\Structure $structure
111 109
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
112 110
      */
113
-    public function getChildrenOfYearAnchor($partOf, $structure)
114
-    {
111
+    public function getChildrenOfYearAnchor($partOf, $structure) {
115 112
         $query = $this->createQuery();
116 113
 
117 114
         $query->matching($query->equals('structure', $structure));
@@ -132,8 +129,7 @@  discard block
 block discarded – undo
132 129
      *
133 130
      * @return \Kitodo\Dlf\Domain\Model\Document|null
134 131
      */
135
-    public function findOneByIdAndSettings($uid, $settings = [])
136
-    {
132
+    public function findOneByIdAndSettings($uid, $settings = []) {
137 133
         $settings = ['documentSets' => $uid];
138 134
 
139 135
         return $this->findDocumentsBySettings($settings)->getFirst();
@@ -146,8 +142,7 @@  discard block
 block discarded – undo
146 142
      *
147 143
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
148 144
      */
149
-    public function findDocumentsBySettings($settings = [])
150
-    {
145
+    public function findDocumentsBySettings($settings = []) {
151 146
         $query = $this->createQuery();
152 147
 
153 148
         $constraints = [];
@@ -177,8 +172,7 @@  discard block
 block discarded – undo
177 172
      *
178 173
      * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
179 174
      */
180
-    public function findAllByCollectionsLimited($collections, $limit = 50)
181
-    {
175
+    public function findAllByCollectionsLimited($collections, $limit = 50) {
182 176
         $query = $this->createQuery();
183 177
 
184 178
         // order by start_date -> start_time...
@@ -215,8 +209,7 @@  discard block
 block discarded – undo
215 209
      *
216 210
      * @return array
217 211
      */
218
-    public function getStatisticsForSelectedCollection($settings)
219
-    {
212
+    public function getStatisticsForSelectedCollection($settings) {
220 213
         if ($settings['collections']) {
221 214
             // Include only selected collections.
222 215
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
@@ -350,8 +343,7 @@  discard block
 block discarded – undo
350 343
      *
351 344
      * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface
352 345
      */
353
-    public function getTableOfContentsFromDb($uid, $pid, $settings)
354
-    {
346
+    public function getTableOfContentsFromDb($uid, $pid, $settings) {
355 347
         // Build table of contents from database.
356 348
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
357 349
             ->getQueryBuilderForTable('tx_dlf_documents');
@@ -399,8 +391,7 @@  discard block
 block discarded – undo
399 391
      *
400 392
      * @return array The found document object
401 393
      */
402
-    public function getOaiRecord($settings, $parameters)
403
-    {
394
+    public function getOaiRecord($settings, $parameters) {
404 395
         $where = '';
405 396
 
406 397
         if (!$settings['show_userdefined']) {
@@ -440,8 +431,7 @@  discard block
 block discarded – undo
440 431
      *
441 432
      * @return array The found document objects
442 433
      */
443
-    public function getOaiDocumentList($settings, $documentsToProcess)
444
-    {
434
+    public function getOaiDocumentList($settings, $documentsToProcess) {
445 435
         $connection = GeneralUtility::makeInstance(ConnectionPool::class)
446 436
             ->getConnectionForTable('tx_dlf_documents');
447 437
 
@@ -475,8 +465,7 @@  discard block
 block discarded – undo
475 465
      *
476 466
      * @return array
477 467
      */
478
-    private function findAllByUids($uids)
479
-    {
468
+    private function findAllByUids($uids) {
480 469
         // get all documents from db we are talking about
481 470
         $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
482 471
         $queryBuilder = $connectionPool->getQueryBuilderForTable('tx_dlf_documents');
@@ -520,8 +509,7 @@  discard block
 block discarded – undo
520 509
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
521 510
      * @return array
522 511
      */
523
-    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null)
524
-    {
512
+    public function findSolrByCollection($collection, $settings, $searchParams, $listedMetadata = null) {
525 513
         // set settings global inside this repository
526 514
         $this->settings = $settings;
527 515
 
@@ -730,8 +718,7 @@  discard block
 block discarded – undo
730 718
      * @param \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $listedMetadata
731 719
      * @return array
732 720
      */
733
-    protected function fetchMetadataFromSolr($uid, $listedMetadata = [])
734
-    {
721
+    protected function fetchMetadataFromSolr($uid, $listedMetadata = []) {
735 722
         // Prepare query parameters.
736 723
         $params = [];
737 724
         $metadataArray = [];
@@ -780,8 +767,7 @@  discard block
 block discarded – undo
780 767
      *
781 768
      * @return array The Apache Solr Documents that were fetched
782 769
      */
783
-    protected function searchSolr($parameters = [], $enableCache = true)
784
-    {
770
+    protected function searchSolr($parameters = [], $enableCache = true) {
785 771
         // Set additional query parameters.
786 772
         $parameters['start'] = 0;
787 773
         // Set query.
Please login to merge, or discard this patch.