@@ 26-84 (lines=59) @@ | ||
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 | ||
56 | return $metadata; |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * @return mixed The object instance |
|
61 | */ |
|
62 | public static function deserialize(array $data) |
|
63 | { |
|
64 | return new self( |
|
65 | new IdentityId($data['identity_id']), |
|
66 | new Institution($data['institution']), |
|
67 | new NameId($data['name_id']), |
|
68 | new Institution($data['ra_institution']) |
|
69 | ); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * @return array |
|
74 | */ |
|
75 | public function serialize() |
|
76 | { |
|
77 | return [ |
|
78 | 'identity_id' => (string) $this->identityId, |
|
79 | 'institution' => (string) $this->identityInstitution, |
|
80 | 'name_id' => (string) $this->nameId, |
|
81 | 'ra_institution' => (string) $this->raInstitution, |
|
82 | ]; |
|
83 | } |
|
84 | } |
|
85 |
@@ 26-84 (lines=59) @@ | ||
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 | ||
56 | return $metadata; |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * @return mixed The object instance |
|
61 | */ |
|
62 | public static function deserialize(array $data) |
|
63 | { |
|
64 | return new self( |
|
65 | new IdentityId($data['identity_id']), |
|
66 | new Institution($data['institution']), |
|
67 | new NameId($data['name_id']), |
|
68 | new Institution($data['ra_institution']) |
|
69 | ); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * @return array |
|
74 | */ |
|
75 | public function serialize() |
|
76 | { |
|
77 | return [ |
|
78 | 'identity_id' => (string) $this->identityId, |
|
79 | 'institution' => (string) $this->identityInstitution, |
|
80 | 'name_id' => (string) $this->nameId, |
|
81 | 'ra_institution' => (string) $this->raInstitution, |
|
82 | ]; |
|
83 | } |
|
84 | } |
|
85 |