Resource::getApiUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace PubPeerFoundation\PublicationDataExtractor\Resources;
4
5
use PubPeerFoundation\PublicationDataExtractor\Identifiers\Identifier;
6
use PubPeerFoundation\PublicationDataExtractor\Output;
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