Passed
Push — master ( 2dbb0d...2ad290 )
by Xavier
01:17
created

Resource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 53
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getApiUrl() 0 3 1
1
<?php
2
3
namespace PubPeerFoundation\PublicationDataExtractor\Resources;
4
5
use PubPeerFoundation\PublicationDataExtractor\Output;
6
use PubPeerFoundation\PublicationDataExtractor\Identifiers\Identifier;
7
8
abstract class Resource
9
{
10
    /**
11
     * @var Output
12
     */
13
    protected $output;
14
15
    /**
16
     * @var Identifier
17
     */
18
    protected $identifier;
19
20
    /**
21
     * @var string
22
     */
23
    protected $url;
24
25
    /**
26
     * Resource constructor.
27
     *
28
     * @param Identifier $identifier
29
     * @param Output     $output
30
     */
31
    public function __construct(Identifier $identifier, Output $output)
32
    {
33
        $this->identifier = $identifier;
34
        $this->output = $output;
35
    }
36
37
    /**
38
     * Full URL to the fetched resource.
39
     *
40
     * @return string
41
     */
42
    public function getApiUrl(): string
43
    {
44
        return $this->url;
45
    }
46
47
    /**
48
     * Request Options Array used to fetch the resource.
49
     *
50
     * @return array
51
     */
52
    abstract public function getRequestOptions(): array;
53
54
    /**
55
     * Transform raw data to a usable format.
56
     *
57
     * @param  string $document
58
     * @return array
59
     */
60
    abstract public function getDataFrom(string $document): array;
61
}
62