Total Complexity | 67 |
Total Lines | 609 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
Complex classes like InstitutionConfiguration often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use InstitutionConfiguration, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
79 | class InstitutionConfiguration extends EventSourcedAggregateRoot implements InstitutionConfigurationInterface |
||
80 | { |
||
81 | private InstitutionConfigurationId $institutionConfigurationId; |
||
82 | |||
83 | private Institution $institution; |
||
84 | |||
85 | private ?RaLocationList $raLocations = null; |
||
86 | |||
87 | private UseRaLocationsOption $useRaLocationsOption; |
||
88 | |||
89 | private ShowRaaContactInformationOption $showRaaContactInformationOption; |
||
90 | |||
91 | private VerifyEmailOption $verifyEmailOption; |
||
92 | |||
93 | private NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption; |
||
94 | |||
95 | private SelfVetOption $selfVetOption; |
||
96 | |||
97 | private ?SsoOn2faOption $ssoOn2faOption = null; |
||
98 | |||
99 | private ?SsoRegistrationBypassOption $ssoRegistrationBypassOption = null; |
||
100 | |||
101 | private ?SelfAssertedTokensOption $selfAssertedTokensOption = null; |
||
102 | |||
103 | private ?InstitutionAuthorizationOption $useRaOption = null; |
||
104 | |||
105 | private ?InstitutionAuthorizationOption $useRaaOption = null; |
||
106 | |||
107 | private ?InstitutionAuthorizationOption $selectRaaOption = null; |
||
108 | |||
109 | private ?AllowedSecondFactorList $allowedSecondFactorList = null; |
||
110 | |||
111 | private ?bool $isMarkedAsDestroyed = null; |
||
112 | |||
113 | public static function create( |
||
114 | InstitutionConfigurationId $institutionConfigurationId, |
||
115 | Institution $institution, |
||
116 | ): self { |
||
117 | $institutionConfiguration = new self; |
||
118 | $institutionConfiguration->apply( |
||
119 | new NewInstitutionConfigurationCreatedEvent( |
||
120 | $institutionConfigurationId, |
||
121 | $institution, |
||
122 | UseRaLocationsOption::getDefault(), |
||
123 | ShowRaaContactInformationOption::getDefault(), |
||
124 | VerifyEmailOption::getDefault(), |
||
125 | NumberOfTokensPerIdentityOption::getDefault(), |
||
126 | SsoOn2faOption::getDefault(), |
||
127 | SsoRegistrationBypassOption::getDefault(), |
||
128 | SelfVetOption::getDefault(), |
||
129 | SelfAssertedTokensOption::getDefault(), |
||
130 | ), |
||
131 | ); |
||
132 | $institutionConfiguration->apply( |
||
133 | new AllowedSecondFactorListUpdatedEvent( |
||
134 | $institutionConfigurationId, |
||
135 | $institution, |
||
136 | AllowedSecondFactorList::blank(), |
||
137 | ), |
||
138 | ); |
||
139 | $institutionConfiguration->apply( |
||
140 | new UseRaOptionChangedEvent( |
||
141 | $institutionConfigurationId, |
||
142 | $institution, |
||
143 | InstitutionAuthorizationOption::getDefault(InstitutionRole::useRa()), |
||
144 | ), |
||
145 | ); |
||
146 | $institutionConfiguration->apply( |
||
147 | new UseRaaOptionChangedEvent( |
||
148 | $institutionConfigurationId, |
||
149 | $institution, |
||
150 | InstitutionAuthorizationOption::getDefault(InstitutionRole::useRaa()), |
||
151 | ), |
||
152 | ); |
||
153 | $institutionConfiguration->apply( |
||
154 | new SelectRaaOptionChangedEvent( |
||
155 | $institutionConfigurationId, |
||
156 | $institution, |
||
157 | InstitutionAuthorizationOption::getDefault(InstitutionRole::selectRaa()), |
||
158 | ), |
||
159 | ); |
||
160 | |||
161 | return $institutionConfiguration; |
||
162 | } |
||
163 | |||
164 | public function rebuild(): self |
||
165 | { |
||
166 | // We can only rebuild a destroyed InstitutionConfiguration, all other cases are not valid |
||
167 | if ($this->isMarkedAsDestroyed !== true) { |
||
168 | throw new DomainException('Cannot rebuild InstitutionConfiguration as it has not been destroyed'); |
||
169 | } |
||
170 | |||
171 | $this->apply( |
||
172 | new NewInstitutionConfigurationCreatedEvent( |
||
173 | $this->institutionConfigurationId, |
||
174 | $this->institution, |
||
175 | UseRaLocationsOption::getDefault(), |
||
176 | ShowRaaContactInformationOption::getDefault(), |
||
177 | VerifyEmailOption::getDefault(), |
||
178 | NumberOfTokensPerIdentityOption::getDefault(), |
||
179 | SsoOn2faOption::getDefault(), |
||
180 | SsoRegistrationBypassOption::getDefault(), |
||
181 | SelfVetOption::getDefault(), |
||
182 | SelfAssertedTokensOption::getDefault(), |
||
183 | ), |
||
184 | ); |
||
185 | $this->apply( |
||
186 | new AllowedSecondFactorListUpdatedEvent( |
||
187 | $this->institutionConfigurationId, |
||
188 | $this->institution, |
||
189 | AllowedSecondFactorList::blank(), |
||
190 | ), |
||
191 | ); |
||
192 | $this->apply( |
||
193 | new UseRaOptionChangedEvent( |
||
194 | $this->institutionConfigurationId, |
||
195 | $this->institution, |
||
196 | InstitutionAuthorizationOption::getDefault(InstitutionRole::useRa()), |
||
197 | ), |
||
198 | ); |
||
199 | $this->apply( |
||
200 | new UseRaaOptionChangedEvent( |
||
201 | $this->institutionConfigurationId, |
||
202 | $this->institution, |
||
203 | InstitutionAuthorizationOption::getDefault(InstitutionRole::useRaa()), |
||
204 | ), |
||
205 | ); |
||
206 | $this->apply( |
||
207 | new SelectRaaOptionChangedEvent( |
||
208 | $this->institutionConfigurationId, |
||
209 | $this->institution, |
||
210 | InstitutionAuthorizationOption::getDefault(InstitutionRole::selectRaa()), |
||
211 | ), |
||
212 | ); |
||
213 | |||
214 | return $this; |
||
215 | } |
||
216 | |||
217 | final public function __construct() |
||
218 | { |
||
219 | } |
||
220 | |||
221 | public function configureUseRaLocationsOption(UseRaLocationsOption $useRaLocationsOption): void |
||
222 | { |
||
223 | if ($this->useRaLocationsOption->equals($useRaLocationsOption)) { |
||
224 | return; |
||
225 | } |
||
226 | |||
227 | $this->apply( |
||
228 | new UseRaLocationsOptionChangedEvent( |
||
229 | $this->institutionConfigurationId, |
||
230 | $this->institution, |
||
231 | $useRaLocationsOption, |
||
232 | ), |
||
233 | ); |
||
234 | } |
||
235 | |||
236 | public function configureShowRaaContactInformationOption( |
||
237 | ShowRaaContactInformationOption $showRaaContactInformationOption, |
||
238 | ): void { |
||
239 | if ($this->showRaaContactInformationOption->equals($showRaaContactInformationOption)) { |
||
240 | return; |
||
241 | } |
||
242 | |||
243 | $this->apply( |
||
244 | new ShowRaaContactInformationOptionChangedEvent( |
||
245 | $this->institutionConfigurationId, |
||
246 | $this->institution, |
||
247 | $showRaaContactInformationOption, |
||
248 | ), |
||
249 | ); |
||
250 | } |
||
251 | |||
252 | public function configureVerifyEmailOption(VerifyEmailOption $verifyEmailOption): void |
||
253 | { |
||
254 | if ($this->verifyEmailOption->equals($verifyEmailOption)) { |
||
255 | return; |
||
256 | } |
||
257 | |||
258 | $this->apply( |
||
259 | new VerifyEmailOptionChangedEvent( |
||
260 | $this->institutionConfigurationId, |
||
261 | $this->institution, |
||
262 | $verifyEmailOption, |
||
263 | ), |
||
264 | ); |
||
265 | } |
||
266 | |||
267 | public function configureNumberOfTokensPerIdentityOption( |
||
268 | NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption, |
||
269 | ): void { |
||
270 | if ($this->numberOfTokensPerIdentityOption->equals($numberOfTokensPerIdentityOption)) { |
||
271 | return; |
||
272 | } |
||
273 | |||
274 | $this->apply( |
||
275 | new NumberOfTokensPerIdentityOptionChangedEvent( |
||
276 | $this->institutionConfigurationId, |
||
277 | $this->institution, |
||
278 | $numberOfTokensPerIdentityOption, |
||
279 | ), |
||
280 | ); |
||
281 | } |
||
282 | |||
283 | public function configureSelfVetOption(SelfVetOption $selfVetOption): void |
||
284 | { |
||
285 | if ($this->selfVetOption->equals($selfVetOption)) { |
||
286 | return; |
||
287 | } |
||
288 | |||
289 | $this->apply( |
||
290 | new SelfVetOptionChangedEvent( |
||
291 | $this->institutionConfigurationId, |
||
292 | $this->institution, |
||
293 | $selfVetOption, |
||
294 | ), |
||
295 | ); |
||
296 | } |
||
297 | |||
298 | public function configureSelfAssertedTokensOption(SelfAssertedTokensOption $selfAssertedTokensOption): void |
||
299 | { |
||
300 | if ($this->selfAssertedTokensOption instanceof \Surfnet\Stepup\Configuration\Value\SelfAssertedTokensOption && |
||
301 | $this->selfAssertedTokensOption->equals($selfAssertedTokensOption) |
||
302 | ) { |
||
303 | return; |
||
304 | } |
||
305 | |||
306 | $this->apply( |
||
307 | new SelfAssertedTokensOptionChangedEvent( |
||
308 | $this->institutionConfigurationId, |
||
309 | $this->institution, |
||
310 | $selfAssertedTokensOption, |
||
311 | ), |
||
312 | ); |
||
313 | } |
||
314 | |||
315 | public function configureSsoOn2faOption(SsoOn2faOption $ssoOn2faOption): void |
||
316 | { |
||
317 | if ($this->ssoOn2faOption instanceof \Surfnet\Stepup\Configuration\Value\SsoOn2faOption && $this->ssoOn2faOption->equals($ssoOn2faOption)) { |
||
318 | return; |
||
319 | } |
||
320 | |||
321 | $this->apply( |
||
322 | new SsoOn2faOptionChangedEvent( |
||
323 | $this->institutionConfigurationId, |
||
324 | $this->institution, |
||
325 | $ssoOn2faOption, |
||
326 | ), |
||
327 | ); |
||
328 | } |
||
329 | |||
330 | public function configureSsoRegistrationBypassOption(SsoRegistrationBypassOption $ssoRegistrationBypassOption): void |
||
331 | { |
||
332 | if ($this->ssoRegistrationBypassOption instanceof SsoRegistrationBypassOption |
||
333 | && $this->ssoRegistrationBypassOption->equals($ssoRegistrationBypassOption)) { |
||
334 | return; |
||
335 | } |
||
336 | |||
337 | $this->apply( |
||
338 | new SsoRegistrationBypassOptionChangedEvent( |
||
339 | $this->institutionConfigurationId, |
||
340 | $this->institution, |
||
341 | $ssoRegistrationBypassOption |
||
342 | ) |
||
343 | ); |
||
344 | } |
||
345 | |||
346 | public function updateUseRaOption(InstitutionAuthorizationOption $useRaOption): void |
||
347 | { |
||
348 | if ($this->useRaOption instanceof \Surfnet\Stepup\Configuration\Value\InstitutionAuthorizationOption |
||
349 | && $this->useRaOption->equals($useRaOption) |
||
350 | ) { |
||
351 | return; |
||
352 | } |
||
353 | |||
354 | $this->apply( |
||
355 | new UseRaOptionChangedEvent( |
||
356 | $this->institutionConfigurationId, |
||
357 | $this->institution, |
||
358 | $useRaOption, |
||
359 | ), |
||
360 | ); |
||
361 | } |
||
362 | |||
363 | public function updateUseRaaOption(InstitutionAuthorizationOption $useRaaOption): void |
||
364 | { |
||
365 | if ($this->useRaaOption instanceof \Surfnet\Stepup\Configuration\Value\InstitutionAuthorizationOption |
||
366 | && $this->useRaaOption->equals($useRaaOption) |
||
367 | ) { |
||
368 | return; |
||
369 | } |
||
370 | |||
371 | $this->apply( |
||
372 | new UseRaaOptionChangedEvent( |
||
373 | $this->institutionConfigurationId, |
||
374 | $this->institution, |
||
375 | $useRaaOption, |
||
376 | ), |
||
377 | ); |
||
378 | } |
||
379 | |||
380 | public function updateSelectRaaOption(InstitutionAuthorizationOption $selectRaaOption): void |
||
381 | { |
||
382 | if ($this->selectRaaOption instanceof \Surfnet\Stepup\Configuration\Value\InstitutionAuthorizationOption |
||
383 | && $this->selectRaaOption->equals($selectRaaOption) |
||
384 | ) { |
||
385 | return; |
||
386 | } |
||
387 | |||
388 | $this->apply( |
||
389 | new SelectRaaOptionChangedEvent( |
||
390 | $this->institutionConfigurationId, |
||
391 | $this->institution, |
||
392 | $selectRaaOption, |
||
393 | ), |
||
394 | ); |
||
395 | } |
||
396 | |||
397 | public function updateAllowedSecondFactorList(AllowedSecondFactorList $allowedSecondFactorList): void |
||
398 | { |
||
399 | // AllowedSecondFactorList can be null for InstitutionConfigurations for which this functionality did not exist |
||
400 | if ($this->allowedSecondFactorList instanceof \Surfnet\Stepup\Configuration\Value\AllowedSecondFactorList |
||
401 | && $this->allowedSecondFactorList->equals($allowedSecondFactorList) |
||
402 | ) { |
||
403 | return; |
||
404 | } |
||
405 | |||
406 | $this->apply( |
||
407 | new AllowedSecondFactorListUpdatedEvent( |
||
408 | $this->institutionConfigurationId, |
||
409 | $this->institution, |
||
410 | $allowedSecondFactorList, |
||
411 | ), |
||
412 | ); |
||
413 | } |
||
414 | |||
415 | /** |
||
416 | * @param RaLocationId $raLocationId |
||
417 | * @param RaLocationName $raLocationName |
||
418 | * @param Location $location |
||
419 | * @param ContactInformation $contactInformation |
||
420 | */ |
||
421 | public function addRaLocation( |
||
422 | RaLocationId $raLocationId, |
||
423 | RaLocationName $raLocationName, |
||
424 | Location $location, |
||
425 | ContactInformation $contactInformation, |
||
426 | ): void { |
||
427 | if ($this->raLocations->containsWithId($raLocationId)) { |
||
428 | throw new DomainException( |
||
429 | sprintf( |
||
430 | 'Cannot add RaLocation with RaLocationId "%s" to RaLocations of InstitutionConfiguration "%s":' |
||
431 | . ' it is already present', |
||
432 | $raLocationId, |
||
433 | $this->getAggregateRootId(), |
||
434 | ), |
||
435 | ); |
||
436 | } |
||
437 | |||
438 | $this->apply( |
||
439 | new RaLocationAddedEvent( |
||
440 | $this->institutionConfigurationId, |
||
441 | $this->institution, |
||
442 | $raLocationId, |
||
443 | $raLocationName, |
||
444 | $location, |
||
445 | $contactInformation, |
||
446 | ), |
||
447 | ); |
||
448 | } |
||
449 | |||
450 | /** |
||
451 | * @param RaLocationId $raLocationId |
||
452 | * @param RaLocationName $raLocationName |
||
453 | * @param Location $location |
||
454 | * @param ContactInformation $contactInformation |
||
455 | */ |
||
456 | public function changeRaLocation( |
||
457 | RaLocationId $raLocationId, |
||
458 | RaLocationName $raLocationName, |
||
459 | Location $location, |
||
460 | ContactInformation $contactInformation, |
||
461 | ): void { |
||
462 | if (!$this->raLocations->containsWithId($raLocationId)) { |
||
463 | throw new DomainException( |
||
464 | sprintf( |
||
465 | 'Cannot change RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":' |
||
466 | . ' it is not present', |
||
467 | $raLocationId, |
||
468 | $this->getAggregateRootId(), |
||
469 | ), |
||
470 | ); |
||
471 | } |
||
472 | |||
473 | $raLocation = $this->raLocations->getById($raLocationId); |
||
474 | |||
475 | if (!$raLocation->getName()->equals($raLocationName)) { |
||
476 | $this->apply( |
||
477 | new RaLocationRenamedEvent($this->institutionConfigurationId, $raLocationId, $raLocationName), |
||
478 | ); |
||
479 | } |
||
480 | if (!$raLocation->getLocation()->equals($location)) { |
||
481 | $this->apply( |
||
482 | new RaLocationRelocatedEvent($this->institutionConfigurationId, $raLocationId, $location), |
||
483 | ); |
||
484 | } |
||
485 | if (!$raLocation->getContactInformation()->equals($contactInformation)) { |
||
486 | $this->apply( |
||
487 | new RaLocationContactInformationChangedEvent( |
||
488 | $this->institutionConfigurationId, |
||
489 | $raLocationId, |
||
490 | $contactInformation, |
||
491 | ), |
||
492 | ); |
||
493 | } |
||
494 | } |
||
495 | |||
496 | /** |
||
497 | * @param RaLocationId $raLocationId |
||
498 | */ |
||
499 | public function removeRaLocation(RaLocationId $raLocationId): void |
||
500 | { |
||
501 | if (!$this->raLocations->containsWithId($raLocationId)) { |
||
502 | throw new DomainException( |
||
503 | sprintf( |
||
504 | 'Cannot remove RaLocation with RaLocationId "%s" in RaLocations of InstitutionConfiguration "%s":' |
||
505 | . ' it is not present', |
||
506 | $raLocationId, |
||
507 | $this->getAggregateRootId(), |
||
508 | ), |
||
509 | ); |
||
510 | } |
||
511 | |||
512 | $this->apply(new RaLocationRemovedEvent($this->institutionConfigurationId, $raLocationId)); |
||
513 | } |
||
514 | |||
515 | /** |
||
516 | * @return void |
||
517 | */ |
||
518 | public function destroy(): void |
||
519 | { |
||
520 | $this->apply(new InstitutionConfigurationRemovedEvent($this->institutionConfigurationId, $this->institution)); |
||
521 | } |
||
522 | |||
523 | public function getAggregateRootId(): string |
||
524 | { |
||
525 | return $this->institutionConfigurationId; |
||
526 | } |
||
527 | |||
528 | /** |
||
529 | * Check if role from institution is allowed to accredit roles |
||
530 | * |
||
531 | */ |
||
532 | public function isInstitutionAllowedToAccreditRoles(Institution $institution): bool |
||
541 | } |
||
542 | |||
543 | protected function applyNewInstitutionConfigurationCreatedEvent(NewInstitutionConfigurationCreatedEvent $event): void |
||
544 | { |
||
545 | $this->institutionConfigurationId = $event->institutionConfigurationId; |
||
546 | $this->institution = $event->institution; |
||
547 | $this->useRaLocationsOption = $event->useRaLocationsOption; |
||
548 | $this->showRaaContactInformationOption = $event->showRaaContactInformationOption; |
||
549 | $this->verifyEmailOption = $event->verifyEmailOption; |
||
550 | $this->selfVetOption = $event->selfVetOption; |
||
551 | $this->ssoOn2faOption = $event->ssoOn2faOption; |
||
552 | $this->ssoRegistrationBypassOption = $event->ssoRegistrationBypassOption; |
||
553 | $this->selfAssertedTokensOption = $event->selfAssertedTokensOption; |
||
554 | $this->numberOfTokensPerIdentityOption = $event->numberOfTokensPerIdentityOption; |
||
555 | $this->raLocations = new RaLocationList([]); |
||
556 | $this->isMarkedAsDestroyed = false; |
||
557 | } |
||
558 | |||
559 | /** |
||
560 | * Apply the UseRaOptionChangedEvent |
||
561 | * |
||
562 | * To ensure the aggregate is correctly populated with the FGA options we ensure the UseRaOptionChangedEvent |
||
563 | * can be applied on the aggregate. Refraining from doing this would result in the $this->useRaOption field only |
||
564 | * being applied when applyNewInstitutionConfigurationCreatedEvent is called. And this might not be the case if |
||
565 | * the fields where null'ed (removed from configuration). |
||
566 | * |
||
567 | * This also applies for applyUseRaaOptionChangedEvent & applySelectRaaOptionChangedEvent |
||
568 | */ |
||
569 | protected function applyUseRaOptionChangedEvent(UseRaOptionChangedEvent $event): void |
||
570 | { |
||
571 | $this->useRaOption = $event->useRaOption; |
||
572 | } |
||
573 | |||
574 | protected function applyUseRaaOptionChangedEvent(UseRaaOptionChangedEvent $event): void |
||
575 | { |
||
576 | $this->useRaaOption = $event->useRaaOption; |
||
577 | } |
||
578 | |||
579 | protected function applySelectRaaOptionChangedEvent(SelectRaaOptionChangedEvent $event): void |
||
580 | { |
||
581 | $this->selectRaaOption = $event->selectRaaOption; |
||
582 | } |
||
583 | |||
584 | protected function applyUseRaLocationsOptionChangedEvent(UseRaLocationsOptionChangedEvent $event): void |
||
585 | { |
||
586 | $this->useRaLocationsOption = $event->useRaLocationsOption; |
||
587 | } |
||
588 | |||
589 | protected function applyShowRaaContactInformationOptionChangedEvent( |
||
590 | ShowRaaContactInformationOptionChangedEvent $event, |
||
591 | ): void { |
||
592 | $this->showRaaContactInformationOption = $event->showRaaContactInformationOption; |
||
593 | } |
||
594 | |||
595 | protected function applyVerifyEmailOptionChangedEvent( |
||
596 | VerifyEmailOptionChangedEvent $event, |
||
597 | ): void { |
||
598 | $this->verifyEmailOption = $event->verifyEmailOption; |
||
599 | } |
||
600 | |||
601 | protected function applySelfVetOptionChangedEvent( |
||
602 | SelfVetOptionChangedEvent $event, |
||
603 | ): void { |
||
604 | $this->selfVetOption = $event->selfVetOption; |
||
605 | } |
||
606 | |||
607 | protected function applySelfAssertedTokensOptionChangedEvent( |
||
608 | SelfAssertedTokensOptionChangedEvent $event, |
||
609 | ): void { |
||
610 | $this->selfAssertedTokensOption = $event->selfAssertedTokensOption; |
||
611 | } |
||
612 | |||
613 | protected function applySsoOn2faOptionChangedEvent( |
||
614 | SsoOn2faOptionChangedEvent $event, |
||
615 | ): void { |
||
616 | $this->ssoOn2faOption = $event->ssoOn2faOption; |
||
617 | } |
||
618 | |||
619 | protected function applySsoRegistrationBypassOptionChangedEvent( |
||
620 | SsoRegistrationBypassOptionChangedEvent $event, |
||
621 | ): void { |
||
622 | $this->ssoRegistrationBypassOption = $event->ssoRegistrationBypassOption; |
||
623 | } |
||
624 | |||
625 | protected function applyNumberOfTokensPerIdentityOptionChangedEvent( |
||
626 | NumberOfTokensPerIdentityOptionChangedEvent $event, |
||
627 | ): void { |
||
628 | $this->numberOfTokensPerIdentityOption = $event->numberOfTokensPerIdentityOption; |
||
629 | } |
||
630 | |||
631 | protected function applyAllowedSecondFactorListUpdatedEvent(AllowedSecondFactorListUpdatedEvent $event): void |
||
632 | { |
||
633 | $this->allowedSecondFactorList = $event->allowedSecondFactorList; |
||
634 | } |
||
635 | |||
636 | protected function applyRaLocationAddedEvent(RaLocationAddedEvent $event): void |
||
644 | ), |
||
645 | ); |
||
646 | } |
||
647 | |||
648 | protected function applyRaLocationRenamedEvent(RaLocationRenamedEvent $event): void |
||
649 | { |
||
650 | $raLocation = $this->raLocations->getById($event->raLocationId); |
||
651 | $raLocation->rename($event->raLocationName); |
||
652 | } |
||
653 | |||
654 | protected function applyRaLocationRelocatedEvent(RaLocationRelocatedEvent $event): void |
||
655 | { |
||
656 | $raLocation = $this->raLocations->getById($event->raLocationId); |
||
657 | $raLocation->relocate($event->location); |
||
658 | } |
||
659 | |||
660 | protected function applyRaLocationContactInformationChangedEvent(RaLocationContactInformationChangedEvent $event): void |
||
661 | { |
||
662 | $raLocation = $this->raLocations->getById($event->raLocationId); |
||
663 | $raLocation->changeContactInformation($event->contactInformation); |
||
664 | } |
||
665 | |||
666 | protected function applyRaLocationRemovedEvent(RaLocationRemovedEvent $event): void |
||
667 | { |
||
668 | $this->raLocations->removeWithId($event->raLocationId); |
||
669 | } |
||
670 | |||
671 | /** |
||
672 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
673 | */ |
||
674 | protected function applyInstitutionConfigurationRemovedEvent(InstitutionConfigurationRemovedEvent $event): void |
||
688 | } |
||
689 | } |
||
690 |