@@ -16,14 +16,14 @@ class DatasetActions extends DataverseActions implements DatasetActionsInterface
1616 public function get (string $ persistentId ): Dataset
1717 {
1818 $ args = '?persistentId= ' . $ persistentId ;
19- $ uri = $ this ->createNativeAPIURI ('datasets ' , ':persistentId ' . $ args );
19+ $ uri = $ this ->createNativeAPIURI ('datasets ' , ':persistentId ' , ' versions ' . $ args );
2020 $ response = $ this ->nativeAPIRequest ('GET ' , $ uri );
2121
2222 $ datasetFactory = new JsonDatasetFactory ($ response ->getBody ());
2323 return $ datasetFactory ->getDataset ();
2424 }
2525
26- public function getCitation (string $ persistentId , ?bool $ datasetIsPublished ): string
26+ public function getCitation (string $ persistentId , ?bool $ datasetIsPublished ): array
2727 {
2828 if (is_null ($ datasetIsPublished )) {
2929 $ dataset = $ this ->get ($ persistentId );
@@ -43,21 +43,12 @@ public function getCitation(string $persistentId, ?bool $datasetIsPublished): st
4343 '<a href=" ' . $ persistentUrl . '"> ' . $ persistentUrl . '</a> ' ,
4444 $ citation
4545 );
46- return preg_replace ('/,+.UNF[^]]+]/ ' , '' , $ citation );
46+ $ citation = preg_replace ('/,+.UNF[^]]+]/ ' , '' , $ citation );
4747 } else {
48- return $ this ->getSWORDCitation ($ persistentId );
48+ $ citation = $ this ->getSWORDCitation ($ persistentId );
4949 }
50- }
5150
52- public function getNativeCitation (string $ persistentId ): string
53- {
54- $ args = '?persistentId= ' . $ persistentId ;
55- $ uri = $ this ->createNativeAPIURI ('datasets ' , ':persistentId ' , 'versions ' , ':latest ' , 'citation ' . $ args );
56- $ response = $ this ->nativeAPIRequest ('GET ' , $ uri );
57-
58- $ jsonContent = json_decode ($ response ->getBody (), true );
59- $ citation = $ jsonContent ['data ' ]['message ' ];
60- return preg_replace ('/,+.UNF[^]]+]/ ' , '' , $ citation );
51+ return ['datasetIsPublished ' => $ datasetIsPublished , 'citation ' => $ citation ];
6152 }
6253
6354 private function getSWORDCitation (string $ persistentId ): string
0 commit comments