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

EndpointIdentifier::getApiAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4286
cc 2
eloc 4
nc 2
nop 0
crap 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