@@ -411,11 +411,8 @@ protected function verbIdentify()
411411 // Provide a fallback timestamp if no document is found
412412 $ oaiIdentifyInfo ['earliestDatestamp ' ] = '0000-00-00T00:00:00Z ' ;
413413
414- // access storagePid from TypoScript
415- $ pageSettings = $ this ->configurationManager ->getConfiguration ($ this ->configurationManager ::CONFIGURATION_TYPE_FULL_TYPOSCRIPT );
416- $ storagePid = $ pageSettings ["plugin. " ]["tx_dlf. " ]["persistence. " ]["storagePid " ];
417- if ($ storagePid > 0 ) {
418- $ this ->logger ->notice ('No records found with PID ' . $ storagePid );
414+ if ($ this ->settings ['storagePid ' ] > 0 ) {
415+ $ this ->logger ->notice ('No records found with PID ' . $ this ->settings ['storagePid ' ]);
419416 } else {
420417 $ this ->logger ->notice ('No records found ' );
421418 }
@@ -460,22 +457,16 @@ protected function verbListIdentifiers()
460457 try {
461458 $ documentSet = $ this ->fetchDocumentSet ();
462459 } catch (\Exception $ exception ) {
460+ $ this ->logger ->error ('Error fetching document set: ' . $ exception ->getErrorMessage ());
463461 $ this ->error = 'idDoesNotExist ' ;
464462 return ;
465463 }
466- // create new and empty document list
467- $ resultSet = [];
468- if (is_array ($ documentSet )) {
469- $ resultSet ['elements ' ] = $ documentSet ;
470- $ resultSet ['metadata ' ] = [
471- 'cursor ' => 0 ,
472- 'completeListSize ' => count ($ documentSet ),
473- 'metadataPrefix ' => $ this ->parameters ['metadataPrefix ' ],
474- ];
464+
465+ if (count ($ documentSet ) == 0 ) {
466+ return ;
475467 }
476468
477- $ listIdentifiers = $ this ->generateOutputForDocumentList ($ resultSet );
478- $ this ->view ->assign ('listIdentifiers ' , $ listIdentifiers );
469+ $ this ->view ->assign ('listIdentifiers ' , $ this ->generateResultSet ($ documentSet ));
479470 }
480471
481472 /**
@@ -550,21 +541,15 @@ protected function verbListRecords()
550541 try {
551542 $ documentSet = $ this ->fetchDocumentSet ();
552543 } catch (\Exception $ exception ) {
544+ $ this ->logger ->error ('Error fetching document set: ' . $ exception ->getErrorMessage ());
553545 $ this ->error = 'idDoesNotExist ' ;
554546 return ;
555547 }
556- $ resultSet = [];
557- if (count ($ documentSet ) > 0 ) {
558- $ resultSet ['elements ' ] = $ documentSet ;
559- $ resultSet ['metadata ' ] = [
560- 'cursor ' => 0 ,
561- 'completeListSize ' => count ($ documentSet ),
562- 'metadataPrefix ' => $ this ->parameters ['metadataPrefix ' ],
563- ];
548+ if (count ($ documentSet ) == 0 ) {
549+ return ;
564550 }
565551
566- $ resultSet = $ this ->generateOutputForDocumentList ($ resultSet );
567- $ this ->view ->assign ('listRecords ' , $ resultSet );
552+ $ this ->view ->assign ('listRecords ' , $ this ->generateResultSet ($ documentSet ));
568553 }
569554
570555 /**
@@ -773,6 +758,28 @@ private function checkGranularity(): void
773758 }
774759 }
775760
761+ /**
762+ * Generate result set
763+ *
764+ * @access private
765+ *
766+ * @param mixed[] $documentSet
767+ *
768+ * @return array
769+ */
770+ private function generateResultSet (array $ documentSet ): array
771+ {
772+ // create new and empty document list
773+ $ resultSet = [];
774+ $ resultSet ['elements ' ] = $ documentSet ;
775+ $ resultSet ['metadata ' ] = [
776+ 'cursor ' => 0 ,
777+ 'completeListSize ' => count ($ documentSet ),
778+ 'metadataPrefix ' => $ this ->parameters ['metadataPrefix ' ],
779+ ];
780+ return $ this ->generateOutputForDocumentList ($ resultSet );
781+ }
782+
776783 /**
777784 * Fetch more information for document list
778785 *
0 commit comments