Passed
Branch reduce-soap-envelope-builder-c... (f028c1)
by Rait
07:42
created

StrAsServiceReference::memberCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Raigu\XRoad\SoapEnvelope;
4
5
final class StrAsServiceReference implements XRoadMember, XRoadService
6
{
7
    /**
8
     * @var array
9
     */
10
    private $parts;
11
12 1
    public function xRoadInstance(): string
13
    {
14 1
        return $this->parts[0];
15
    }
16
17 1
    public function memberClass(): string
18
    {
19 1
        return $this->parts[1];
20
    }
21
22 1
    public function memberCode(): string
23
    {
24 1
        return $this->parts[2];
25
    }
26
27 1
    public function subSystemCode(): string
28
    {
29 1
        return $this->parts[3];
30
    }
31
32 1
    public function serviceCode(): string
33
    {
34 1
        return $this->parts[4];
35
    }
36
37 1
    public function serviceVersion(): string
38
    {
39 1
        return $this->parts[5];
40
    }
41
42 2
    public function __construct(string $reference)
43
    {
44 2
        $parts = explode('/', $reference);
45 2
        if (count($parts) !== 6) {
46 1
            throw new \Exception('Could not extract service parameters. Invalid format.');
47
        }
48
49 1
        return $this->parts = $parts;
50
    }
51
52
}
53