Figshare::extractPublicationData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace PubPeerFoundation\PublicationDataExtractor\Resources\Extractors;
4
5
use PubPeerFoundation\PublicationDataExtractor\Exceptions\JournalTitleNotFoundException;
6
7
class Figshare extends Doi
8
{
9
    /**
10
     * Extract and format data needed for the Journals Relationship
11
     * on the Publication Model.
12
     */
13
    public function extractJournalData(): void
14
    {
15
        try {
16
            parent::extractJournalData();
17
        } catch (JournalTitleNotFoundException $e) {
18
            $this->resourceOutput['journal'] = [
19
                'title' => 'Figshare',
20
            ];
21
        }
22
    }
23
24
    /**
25
     * Extract and format data needed for the Publication Model.
26
     */
27
    public function extractPublicationData(): void
28
    {
29
        parent::extractPublicationData();
30
31
        if (empty($this->resourceOutput['publication']['url'])) {
32
            $this->resourceOutput['publication']['url'] = get_string($this->searchTree, 'id');
33
        }
34
    }
35
}
36