| @@ 29-116 (lines=88) @@ | ||
| 26 | use Surfnet\Stepup\Identity\Value\NameId; |
|
| 27 | use Surfnet\Stepup\Identity\Value\RegistrationAuthorityRole; |
|
| 28 | ||
| 29 | class IdentityAccreditedAsRaaForInstitutionEvent 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 | * @var Institution |
|
| 52 | */ |
|
| 53 | public $raInstitution; |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @param IdentityId $identityId |
|
| 57 | * @param NameId $nameId |
|
| 58 | * @param Institution $institution |
|
| 59 | * @param RegistrationAuthorityRole $role |
|
| 60 | * @param Location $location |
|
| 61 | * @param ContactInformation $contactInformation |
|
| 62 | * @param Institution $raInstitution |
|
| 63 | */ |
|
| 64 | public function __construct( |
|
| 65 | IdentityId $identityId, |
|
| 66 | NameId $nameId, |
|
| 67 | Institution $institution, |
|
| 68 | RegistrationAuthorityRole $role, |
|
| 69 | Location $location, |
|
| 70 | ContactInformation $contactInformation, |
|
| 71 | Institution $raInstitution |
|
| 72 | ) { |
|
| 73 | parent::__construct($identityId, $institution); |
|
| 74 | ||
| 75 | $this->nameId = $nameId; |
|
| 76 | $this->registrationAuthorityRole = $role; |
|
| 77 | $this->location = $location; |
|
| 78 | $this->contactInformation = $contactInformation; |
|
| 79 | $this->raInstitution = $raInstitution; |
|
| 80 | } |
|
| 81 | ||
| 82 | public function getAuditLogMetadata() |
|
| 83 | { |
|
| 84 | $metadata = new Metadata(); |
|
| 85 | $metadata->identityId = $this->identityId; |
|
| 86 | $metadata->identityInstitution = $this->identityInstitution; |
|
| 87 | ||
| 88 | return $metadata; |
|
| 89 | } |
|
| 90 | ||
| 91 | public static function deserialize(array $data) |
|
| 92 | { |
|
| 93 | return new self( |
|
| 94 | new IdentityId($data['identity_id']), |
|
| 95 | new NameId($data['name_id']), |
|
| 96 | new Institution($data['institution']), |
|
| 97 | RegistrationAuthorityRole::deserialize($data['registration_authority_role']), |
|
| 98 | new Location($data['location']), |
|
| 99 | new ContactInformation($data['contact_information']), |
|
| 100 | new Institution($data['ra_institution']) |
|
| 101 | ); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function serialize() |
|
| 105 | { |
|
| 106 | return [ |
|
| 107 | 'identity_id' => (string) $this->identityId, |
|
| 108 | 'name_id' => (string) $this->nameId, |
|
| 109 | 'institution' => (string) $this->identityInstitution, |
|
| 110 | 'registration_authority_role' => $this->registrationAuthorityRole->serialize(), |
|
| 111 | 'location' => (string) $this->location, |
|
| 112 | 'contact_information' => (string) $this->contactInformation, |
|
| 113 | 'ra_institution' => (string) $this->raInstitution, |
|
| 114 | ]; |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| @@ 29-117 (lines=89) @@ | ||
| 26 | use Surfnet\Stepup\Identity\Value\NameId; |
|
| 27 | use Surfnet\Stepup\Identity\Value\RegistrationAuthorityRole; |
|
| 28 | ||
| 29 | class IdentityAccreditedAsRaForInstitutionEvent 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 | * @var Institution |
|
| 53 | */ |
|
| 54 | public $raInstitution; |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @param IdentityId $identityId |
|
| 58 | * @param NameId $nameId |
|
| 59 | * @param Institution $institution |
|
| 60 | * @param RegistrationAuthorityRole $role |
|
| 61 | * @param Location $location |
|
| 62 | * @param ContactInformation $contactInformation |
|
| 63 | * @param Institution $raInstitution |
|
| 64 | */ |
|
| 65 | public function __construct( |
|
| 66 | IdentityId $identityId, |
|
| 67 | NameId $nameId, |
|
| 68 | Institution $institution, |
|
| 69 | RegistrationAuthorityRole $role, |
|
| 70 | Location $location, |
|
| 71 | ContactInformation $contactInformation, |
|
| 72 | Institution $raInstitution |
|
| 73 | ) { |
|
| 74 | parent::__construct($identityId, $institution); |
|
| 75 | ||
| 76 | $this->nameId = $nameId; |
|
| 77 | $this->registrationAuthorityRole = $role; |
|
| 78 | $this->location = $location; |
|
| 79 | $this->contactInformation = $contactInformation; |
|
| 80 | $this->raInstitution = $raInstitution; |
|
| 81 | } |
|
| 82 | ||
| 83 | public function getAuditLogMetadata() |
|
| 84 | { |
|
| 85 | $metadata = new Metadata(); |
|
| 86 | $metadata->identityId = $this->identityId; |
|
| 87 | $metadata->identityInstitution = $this->identityInstitution; |
|
| 88 | ||
| 89 | return $metadata; |
|
| 90 | } |
|
| 91 | ||
| 92 | public static function deserialize(array $data) |
|
| 93 | { |
|
| 94 | return new self( |
|
| 95 | new IdentityId($data['identity_id']), |
|
| 96 | new NameId($data['name_id']), |
|
| 97 | new Institution($data['institution']), |
|
| 98 | RegistrationAuthorityRole::deserialize($data['registration_authority_role']), |
|
| 99 | new Location($data['location']), |
|
| 100 | new ContactInformation($data['contact_information']), |
|
| 101 | new Institution($data['ra_institution']) |
|
| 102 | ); |
|
| 103 | } |
|
| 104 | ||
| 105 | public function serialize() |
|
| 106 | { |
|
| 107 | return [ |
|
| 108 | 'identity_id' => (string) $this->identityId, |
|
| 109 | 'name_id' => (string) $this->nameId, |
|
| 110 | 'institution' => (string) $this->identityInstitution, |
|
| 111 | 'registration_authority_role' => $this->registrationAuthorityRole->serialize(), |
|
| 112 | 'location' => (string) $this->location, |
|
| 113 | 'contact_information' => (string) $this->contactInformation, |
|
| 114 | 'ra_institution' => (string) $this->raInstitution, |
|
| 115 | ]; |
|
| 116 | } |
|
| 117 | } |
|
| 118 | ||