SensitiveDataMessage   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getIdentityId() 0 3 1
A getPlayhead() 0 3 1
A forget() 0 3 1
A getSensitiveData() 0 3 1
1
<?php
2
3
/**
4
 * Copyright 2014 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupMiddleware\CommandHandlingBundle\SensitiveData\EventSourcing;
20
21
use Surfnet\Stepup\Identity\Value\IdentityId;
22
use Surfnet\StepupMiddleware\CommandHandlingBundle\SensitiveData\SensitiveData;
23
24
class SensitiveDataMessage
25
{
26
    private readonly IdentityId $identityId;
27
28
    public function __construct(string $identityId, private readonly int $playhead, private SensitiveData $sensitiveData)
29
    {
30
        $this->identityId = new IdentityId($identityId);
0 ignored issues
show
Bug introduced by
The property identityId is declared read-only in Surfnet\StepupMiddleware...ng\SensitiveDataMessage.
Loading history...
31
    }
32
33
    /**
34
     * Forgets all contained sensitive data.
35
     */
36
    public function forget(): void
37
    {
38
        $this->sensitiveData = $this->sensitiveData->forget();
39
    }
40
41
    /**
42
     * @return IdentityId
43
     */
44
    public function getIdentityId(): IdentityId
45
    {
46
        return $this->identityId;
47
    }
48
49
    /**
50
     * @return int
51
     */
52
    public function getPlayhead(): int
53
    {
54
        return $this->playhead;
55
    }
56
57
    /**
58
     * @return SensitiveData
59
     */
60
    public function getSensitiveData(): SensitiveData
61
    {
62
        return $this->sensitiveData;
63
    }
64
}
65