Code Duplication    Length = 79-79 lines in 3 locations

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

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

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

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

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