ParsedURL   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 94
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getEndpoint() 0 4 1
A getElement() 0 4 1
A getVersion() 0 4 1
A getApiKey() 0 4 1
A getAcceptableMIMETypes() 0 4 1
A getQueryString() 0 4 1
1
<?php
2
namespace LunixREST\RequestFactory\URLParser;
3
4
/**
5
 * An immutable data class representing all of the information pulled from a URL when building an APIRequest.
6
 * Class ParsedURL
7
 * @package LunixREST\RequestFactory\URLParser
8
 */
9
class ParsedURL
10
{
11
    /**
12
     * @var string
13
     */
14
    private $endpoint;
15
    /**
16
     * @var null|string
17
     */
18
    private $element;
19
    /**
20
     * @var null|string
21
     */
22
    private $version;
23
    /**
24
     * @var null|string
25
     */
26
    private $apiKey;
27
    /**
28
     * @var array
29
     */
30
    private $acceptableMIMETypes;
31
    /**
32
     * @var null|string
33
     */
34
    private $queryString;
35
36
    /**
37
     * ParsedURL constructor.
38
     * @param string $endpoint
39
     * @param null|string $element
40
     * @param null|string $version
41
     * @param null|string $apiKey
42
     * @param array $acceptableMIMETypes
43
     * @param null|string $queryString
44
     */
45 5
    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString)
46
    {
47 5
        $this->endpoint = $endpoint;
48 5
        $this->element = $element;
49 5
        $this->version = $version;
50 5
        $this->apiKey = $apiKey;
51 5
        $this->acceptableMIMETypes = $acceptableMIMETypes;
52 5
        $this->queryString = $queryString;
53 5
    }
54
55
    /**
56
     * @return string
57
     */
58 4
    public function getEndpoint(): string
59
    {
60 4
        return $this->endpoint;
61
    }
62
63
    /**
64
     * @return null|string
65
     */
66 1
    public function getElement(): ?string
67
    {
68 1
        return $this->element;
69
    }
70
71
    /**
72
     * @return null|string
73
     */
74 3
    public function getVersion(): ?string
75
    {
76 3
        return $this->version;
77
    }
78
79
    /**
80
     * @return null|string
81
     */
82 2
    public function getApiKey(): ?string
83
    {
84 2
        return $this->apiKey;
85
    }
86
87
    /**
88
     * @return array
89
     */
90 2
    public function getAcceptableMIMETypes(): array
91
    {
92 2
        return $this->acceptableMIMETypes;
93
    }
94
95
    /**
96
     * @return null|string
97
     */
98 1
    public function getQueryString()
99
    {
100 1
        return $this->queryString;
101
    }
102
}
103