Completed
Push — master ( ed3593...2f770f )
by Boy
9s
created

AuditLogEntry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
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
38
     */
39
    public $actorCommonName;
40
41
    /**
42
     * @var string
43
     */
44
    public $identityId;
45
46
    /**
47
     * @var string
48
     */
49
    public $identityInstitution;
50
51
    /**
52
     * @var string|null
53
     */
54
    public $secondFactorId;
55
56
    /**
57
     * @var string|null
58
     */
59
    public $secondFactorType;
60
61
    /**
62
     * @var string
63
     */
64
    public $secondFactorIdentifier;
65
66
    /**
67
     * @var string
68
     */
69
    public $action;
70
71
    /**
72
     * @var DateTime
73
     */
74
    public $recordedOn;
75
76
    /**
77
     * @param array $data
78
     * @return static
79
     */
80
    public static function fromData(array $data)
81
    {
82
        $entry                         = new self();
83
        $entry->actorId                = $data['actor_id'];
84
        $entry->actorInstitution       = $data['actor_institution'];
85
        $entry->actorCommonName        = $data['actor_common_name'];
86
        $entry->identityId             = $data['identity_id'];
87
        $entry->identityInstitution    = $data['identity_institution'];
88
        $entry->secondFactorId         = $data['second_factor_id'];
89
        $entry->secondFactorType       = $data['second_factor_type'];
90
        $entry->secondFactorIdentifier = $data['second_factor_identifier'];
91
        $entry->action                 = $data['action'];
92
        $entry->recordedOn             = new DateTime($data['recorded_on']);
93
94
        return $entry;
95
    }
96
97
    private function __construct()
98
    {
99
    }
100
}
101