Code Duplication    Length = 60-60 lines in 2 locations

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

@@ 26-85 (lines=60) @@
23
use Surfnet\Stepup\Identity\Value\Institution;
24
use Surfnet\Stepup\Identity\Value\NameId;
25
26
class AppointedAsRaaForInstitutionEvent extends IdentityEvent
27
{
28
    /**
29
     * @var NameId
30
     */
31
    public $nameId;
32
33
    /**
34
     * @var Institution
35
     */
36
    public $raInstitution;
37
38
    public function __construct(
39
        IdentityId $identityId,
40
        Institution $identityInstitution,
41
        NameId $nameId,
42
        Institution $raInstitution
43
    ) {
44
        parent::__construct($identityId, $identityInstitution);
45
46
        $this->nameId = $nameId;
47
        $this->raInstitution = $raInstitution;
48
    }
49
50
    public function getAuditLogMetadata()
51
    {
52
        $metadata = new Metadata();
53
        $metadata->identityId = $this->identityId;
54
        $metadata->identityInstitution = $this->identityInstitution;
55
        $metadata->raInstitution = $this->raInstitution;
56
57
        return $metadata;
58
    }
59
60
    /**
61
     * @return mixed The object instance
62
     */
63
    public static function deserialize(array $data)
64
    {
65
        return new self(
66
            new IdentityId($data['identity_id']),
67
            new Institution($data['institution']),
68
            new NameId($data['name_id']),
69
            new Institution($data['ra_institution'])
70
        );
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function serialize()
77
    {
78
        return [
79
            'identity_id'    => (string) $this->identityId,
80
            'institution'    => (string) $this->identityInstitution,
81
            'name_id'        => (string) $this->nameId,
82
            'ra_institution' => (string) $this->raInstitution,
83
        ];
84
    }
85
}
86

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

@@ 26-85 (lines=60) @@
23
use Surfnet\Stepup\Identity\Value\Institution;
24
use Surfnet\Stepup\Identity\Value\NameId;
25
26
class AppointedAsRaForInstitutionEvent extends IdentityEvent
27
{
28
    /**
29
     * @var NameId
30
     */
31
    public $nameId;
32
33
    /**
34
     * @var Institution
35
     */
36
    public $raInstitution;
37
38
    public function __construct(
39
        IdentityId $identityId,
40
        Institution $identityInstitution,
41
        NameId $nameId,
42
        Institution $raInstitution
43
    ) {
44
        parent::__construct($identityId, $identityInstitution);
45
46
        $this->nameId = $nameId;
47
        $this->raInstitution = $raInstitution;
48
    }
49
50
    public function getAuditLogMetadata()
51
    {
52
        $metadata = new Metadata();
53
        $metadata->identityId = $this->identityId;
54
        $metadata->identityInstitution = $this->identityInstitution;
55
        $metadata->raInstitution = $this->raInstitution;
56
57
        return $metadata;
58
    }
59
60
    /**
61
     * @return mixed The object instance
62
     */
63
    public static function deserialize(array $data)
64
    {
65
        return new self(
66
            new IdentityId($data['identity_id']),
67
            new Institution($data['institution']),
68
            new NameId($data['name_id']),
69
            new Institution($data['ra_institution'])
70
        );
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function serialize()
77
    {
78
        return [
79
            'identity_id'    => (string) $this->identityId,
80
            'institution'    => (string) $this->identityInstitution,
81
            'name_id'        => (string) $this->nameId,
82
            'ra_institution' => (string) $this->raInstitution,
83
        ];
84
    }
85
}
86