AuditLogEntry   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 83
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromData() 0 17 1
A __construct() 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\StepupMiddlewareClientBundle\Identity\Dto;
20
21
use DateTime;
22
use Surfnet\StepupMiddlewareClientBundle\Dto\Dto;
23
24
final class AuditLogEntry implements Dto
25
{
26
    /**
27
     * @var string|null
28
     */
29
    public $actorId;
30
31
    /**
32
     * @var string|null
33
     */
34
    public $actorInstitution;
35
36
    /**
37
     * @var string|null
38
     */
39
    public $raInstitution;
40
41
    /**
42
     * @var string
43
     */
44
    public $actorCommonName;
45
46
    /**
47
     * @var string
48
     */
49
    public $identityId;
50
51
    /**
52
     * @var string
53
     */
54
    public $identityInstitution;
55
56
    /**
57
     * @var string|null
58
     */
59
    public $secondFactorId;
60
61
    /**
62
     * @var string|null
63
     */
64
    public $secondFactorType;
65
66
    /**
67
     * @var string
68
     */
69
    public $secondFactorIdentifier;
70
71
    /**
72
     * @var string
73
     */
74
    public $action;
75
76
    /**
77
     * @var DateTime
78
     */
79
    public $recordedOn;
80
81
    /**
82
     * @param array $data
83
     * @return static
84
     */
85
    public static function fromData(array $data)
86
    {
87
        $entry                         = new self();
88
        $entry->actorId                = $data['actor_id'];
89
        $entry->actorInstitution       = $data['actor_institution'];
90
        $entry->actorCommonName        = $data['actor_common_name'];
91
        $entry->raInstitution          = $data['ra_institution'];
92
        $entry->identityId             = $data['identity_id'];
93
        $entry->identityInstitution    = $data['identity_institution'];
94
        $entry->secondFactorId         = $data['second_factor_id'];
95
        $entry->secondFactorType       = $data['second_factor_type'];
96
        $entry->secondFactorIdentifier = $data['second_factor_identifier'];
97
        $entry->action                 = $data['action'];
98
        $entry->recordedOn             = new DateTime($data['recorded_on']);
99
100
        return $entry;
101
    }
102
103
    private function __construct()
104
    {
105
    }
106
}
107