Passed
Branch reduce-soap-envelope-builder-c... (c98539)
by Rait
02:14
created

UserId   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
c 2
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
namespace Raigu\XRoad\SoapEnvelope;
4
5
/**
6
 * I am an user id of the person who initiates the X-Road request.
7
 *
8
 * I can inject myself into SOAP envelope header
9
 */
10
final class UserId extends DOMElementAsSoapHeaderElement
11
{
12
13
    /**
14
     * @param string $userId the user who is making the request
15
     *                   Format: {iso2LetterCountryCode}{personCode}
16
     *                   Example: EE0000000000
17
     */
18 1
    public function __construct(string $userId)
19
    {
20 1
        parent::__construct(
21 1
            new \DOMElement(
22 1
                'userId',
23 1
                (new ValidatedUserId($userId))->asStr(),
24 1
                'http://x-road.eu/xsd/xroad.xsd'
25
            )
26
        );
27 1
    }
28
}
29