UserId::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Raigu\XRoad\SoapEnvelope;
4
5
use Raigu\XRoad\SoapEnvelope\Element\AbstractElement;
6
7
/**
8
 * I am an user id of the person who initiates the X-Road request.
9
 *
10
 * I can inject myself into SOAP envelope header
11
 */
12
final class UserId extends AbstractElement
13
{
14
    /**
15
     * @param string $userId the user who is making the request
16
     *                   Format: {iso2LetterCountryCode}{personCode}
17
     *                   Example: EE0000000000
18
     */
19
    public function __construct(string $userId)
20
    {
21
        parent::__construct(
22
            new SoapHeaderElement(
23
                'userId',
24
                (new ValidatedUserId($userId))->asStr()
25
            )
26
        );
27
    }
28
}
29