Completed
Push — master ( 50a0bb...b5b161 )
by Tomas
17:49 queued 08:57
created

EndpointIdentifier   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 7
c 3
b 0
f 1
lcom 1
cbo 0
dl 0
loc 46
ccs 18
cts 18
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getMethod() 0 4 1
A getVersion() 0 4 1
A getPackage() 0 4 1
A getUrl() 0 4 1
A getApiAction() 0 7 2
1
<?php
2
3
namespace Tomaj\NetteApi;
4
5
class EndpointIdentifier implements EndpointInterface
6
{
7
    private $method;
8
9
    private $version;
10
11
    private $package;
12
13
    private $apiAction;
14
15 6
    public function __construct($method, $version, $package, $apiAction = '')
16
    {
17 6
        $this->method = strtoupper($method);
18 6
        $this->version = $version;
19 6
        $this->package = $package;
20 6
        $this->apiAction = $apiAction;
21 6
    }
22
23 6
    public function getMethod()
24
    {
25 6
        return $this->method;
26
    }
27
28 3
    public function getVersion()
29
    {
30 3
        return $this->version;
31
    }
32
33 3
    public function getPackage()
34
    {
35 3
        return $this->package;
36
    }
37
38 6
    public function getApiAction()
39
    {
40 6
        if ($this->apiAction == '') {
41 3
            return null;
42
        }
43 3
        return $this->apiAction;
44
    }
45
46 3
    public function getUrl()
47
    {
48 3
        return "v{$this->version}/{$this->package}/{$this->apiAction}";
49
    }
50
}
51