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