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

StrAsClientReference::xRoadInstance()   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 StrAsClientReference implements XRoadMember
6
{
7
    /**
8
     * @var string
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 2
    public function __construct(string $reference)
33
    {
34 2
        $parts = explode('/', $reference);
35 2
        if (count($parts) !== 4) {
36 1
            throw new \Exception('Could not extract client parameters. Invalid format.');
37
        }
38
39 1
        $this->parts = $parts;
0 ignored issues
show
Documentation Bug introduced by
It seems like $parts of type string[] is incompatible with the declared type string of property $parts.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
40 1
    }
41
}
42