Code Duplication    Length = 79-79 lines in 3 locations

src/Surfnet/Stepup/Identity/Event/IdentityAccreditedAsRaaEvent.php 1 location

@@ 32-110 (lines=79) @@
29
/**
30
 * @deprecated This event is superseded by the IdentityAccreditedAsRaaForInstitutionEvent because an RA institution was needed
31
 */
32
class IdentityAccreditedAsRaaEvent extends IdentityEvent
33
{
34
    /**
35
     * @var NameId
36
     */
37
    public $nameId;
38
39
    /**
40
     * @var RegistrationAuthorityRole
41
     */
42
    public $registrationAuthorityRole;
43
44
    /**
45
     * @var Location
46
     */
47
    public $location;
48
49
    /**
50
     * @var ContactInformation
51
     */
52
    public $contactInformation;
53
54
    /**
55
     * @param IdentityId $identityId
56
     * @param NameId $nameId
57
     * @param Institution $institution
58
     * @param RegistrationAuthorityRole $role
59
     * @param Location $location
60
     * @param ContactInformation $contactInformation
61
     */
62
    public function __construct(
63
        IdentityId $identityId,
64
        NameId $nameId,
65
        Institution $institution,
66
        RegistrationAuthorityRole $role,
67
        Location $location,
68
        ContactInformation $contactInformation
69
    ) {
70
        parent::__construct($identityId, $institution);
71
72
        $this->nameId                    = $nameId;
73
        $this->registrationAuthorityRole = $role;
74
        $this->location                  = $location;
75
        $this->contactInformation        = $contactInformation;
76
    }
77
78
    public function getAuditLogMetadata()
79
    {
80
        $metadata                      = new Metadata();
81
        $metadata->identityId          = $this->identityId;
82
        $metadata->identityInstitution = $this->identityInstitution;
83
84
        return $metadata;
85
    }
86
87
    public static function deserialize(array $data)
88
    {
89
        return new self(
90
            new IdentityId($data['identity_id']),
91
            new NameId($data['name_id']),
92
            new Institution($data['institution']),
93
            RegistrationAuthorityRole::deserialize($data['registration_authority_role']),
94
            new Location($data['location']),
95
            new ContactInformation($data['contact_information'])
96
        );
97
    }
98
99
    public function serialize()
100
    {
101
        return [
102
            'identity_id'                 => (string) $this->identityId,
103
            'name_id'                     => (string) $this->nameId,
104
            'institution'                 => (string) $this->identityInstitution,
105
            'registration_authority_role' => $this->registrationAuthorityRole->serialize(),
106
            'location'                    => (string) $this->location,
107
            'contact_information'         => (string) $this->contactInformation,
108
        ];
109
    }
110
}
111

src/Surfnet/Stepup/Identity/Event/IdentityAccreditedAsRaEvent.php 1 location

@@ 32-110 (lines=79) @@
29
/**
30
 * @deprecated This event is superseded by the IdentityAccreditedAsRaForInstitutionEvent because an RA institution was needed
31
 */
32
class IdentityAccreditedAsRaEvent extends IdentityEvent
33
{
34
    /**
35
     * @var NameId
36
     */
37
    public $nameId;
38
39
    /**
40
     * @var RegistrationAuthorityRole
41
     */
42
    public $registrationAuthorityRole;
43
44
    /**
45
     * @var Location
46
     */
47
    public $location;
48
49
    /**
50
     * @var ContactInformation
51
     */
52
    public $contactInformation;
53
54
    /**
55
     * @param IdentityId $identityId
56
     * @param NameId $nameId
57
     * @param Institution $institution
58
     * @param RegistrationAuthorityRole $role
59
     * @param Location $location
60
     * @param ContactInformation $contactInformation
61
     */
62
    public function __construct(
63
        IdentityId $identityId,
64
        NameId $nameId,
65
        Institution $institution,
66
        RegistrationAuthorityRole $role,
67
        Location $location,
68
        ContactInformation $contactInformation
69
    ) {
70
        parent::__construct($identityId, $institution);
71
72
        $this->nameId                    = $nameId;
73
        $this->registrationAuthorityRole = $role;
74
        $this->location                  = $location;
75
        $this->contactInformation        = $contactInformation;
76
    }
77
78
    public function getAuditLogMetadata()
79
    {
80
        $metadata                      = new Metadata();
81
        $metadata->identityId          = $this->identityId;
82
        $metadata->identityInstitution = $this->identityInstitution;
83
84
        return $metadata;
85
    }
86
87
    public static function deserialize(array $data)
88
    {
89
        return new self(
90
            new IdentityId($data['identity_id']),
91
            new NameId($data['name_id']),
92
            new Institution($data['institution']),
93
            RegistrationAuthorityRole::deserialize($data['registration_authority_role']),
94
            new Location($data['location']),
95
            new ContactInformation($data['contact_information'])
96
        );
97
    }
98
99
    public function serialize()
100
    {
101
        return [
102
            'identity_id'                 => (string) $this->identityId,
103
            'name_id'                     => (string) $this->nameId,
104
            'institution'                 => (string) $this->identityInstitution,
105
            'registration_authority_role' => $this->registrationAuthorityRole->serialize(),
106
            'location'                    => (string) $this->location,
107
            'contact_information'         => (string) $this->contactInformation,
108
        ];
109
    }
110
}
111

src/Surfnet/Stepup/Identity/Event/RegistrationAuthorityInformationAmendedForInstitutionEvent.php 1 location

@@ 28-106 (lines=79) @@
25
use Surfnet\Stepup\Identity\Value\Location;
26
use Surfnet\Stepup\Identity\Value\NameId;
27
28
class RegistrationAuthorityInformationAmendedForInstitutionEvent extends IdentityEvent
29
{
30
    /**
31
     * @var NameId
32
     */
33
    public $nameId;
34
35
    /**
36
     * @var Location
37
     */
38
    public $location;
39
40
    /**
41
     * @var ContactInformation
42
     */
43
    public $contactInformation;
44
45
    /**
46
     * @var Institution
47
     */
48
    public $raInstitution;
49
50
    /**
51
     * @param IdentityId $identityId
52
     * @param Institution $institution
53
     * @param NameId $nameId
54
     * @param Location $location
55
     * @param ContactInformation $contactInformation
56
     * @param Institution $raInstitution
57
     */
58
    public function __construct(
59
        IdentityId $identityId,
60
        Institution $institution,
61
        NameId $nameId,
62
        Location $location,
63
        ContactInformation $contactInformation,
64
        Institution $raInstitution
65
    ) {
66
        parent::__construct($identityId, $institution);
67
68
        $this->nameId = $nameId;
69
        $this->location = $location;
70
        $this->contactInformation = $contactInformation;
71
        $this->raInstitution = $raInstitution;
72
    }
73
74
    public function getAuditLogMetadata()
75
    {
76
        $metadata = new Metadata();
77
        $metadata->identityId = $this->identityId;
78
        $metadata->identityInstitution = $this->identityInstitution;
79
80
        return $metadata;
81
    }
82
83
    public static function deserialize(array $data)
84
    {
85
        return new self(
86
            new IdentityId($data['identity_id']),
87
            new Institution($data['institution']),
88
            new NameId($data['name_id']),
89
            new Location($data['location']),
90
            new ContactInformation($data['contact_information']),
91
            new Institution($data['ra_institution'])
92
        );
93
    }
94
95
    public function serialize()
96
    {
97
        return [
98
            'identity_id'         => (string) $this->identityId,
99
            'institution'         => (string) $this->identityInstitution,
100
            'name_id'             => (string) $this->nameId,
101
            'location'            => (string) $this->location,
102
            'contact_information' => (string) $this->contactInformation,
103
            'ra_institution'      => (string) $this->raInstitution,
104
        ];
105
    }
106
}
107