From 0bb2a4e3332104029204c515bb5cb65339c99faf Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 20 Mar 2024 12:34:08 +0100 Subject: [PATCH 1/2] Translatable configurable metadata This is a continuation of #1103 where we made the Organization-data in metadata configurable using the translations-files. However, the result would be like this: My fictional organization My fictional organization Instead of: My fictional organization Mijn fictieve organisatie Everything was being translated using the default locale. This PR attempts to fix that. See: https://github.com/OpenConext/OpenConext-engineblock/pull/1292 See: https://github.com/OpenConext/OpenConext-engineblock/pull/1103 --- .../Adapter/IdentityProviderEntity.php | 4 +- .../Factory/Adapter/ServiceProviderEntity.php | 4 +- .../Decorator/AbstractIdentityProvider.php | 4 +- .../Decorator/AbstractServiceProvider.php | 4 +- ...EngineBlockIdentityProviderInformation.php | 4 +- .../EngineBlockServiceProviderInformation.php | 4 +- .../IdentityProviderEntityInterface.php | 4 +- .../ServiceProviderEntityInterface.php | 4 +- .../ValueObject/EngineBlockConfiguration.php | 26 +++++--- .../Metadata/Factory/AbstractEntityTest.php | 59 +++++++++++++++++++ ...neblockIdentityProviderInformationTest.php | 31 +++------- ...ineblockServiceProviderInformationTest.php | 19 +----- .../Decorator/ProxiedIdentityProviderTest.php | 10 ---- .../Factory/IdentityProviderFactoryTest.php | 10 ---- .../Factory/ServiceProviderFactoryTest.php | 32 +--------- .../EngineBlockConfigurationTest.php | 18 ++++-- 16 files changed, 114 insertions(+), 123 deletions(-) diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/IdentityProviderEntity.php b/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/IdentityProviderEntity.php index 69241ccb3c..13d028a030 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/IdentityProviderEntity.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/IdentityProviderEntity.php @@ -126,10 +126,10 @@ public function hasCompleteOrganizationData(string $locale): bool } /** - * @param $locale + * @param string $locale * @return Organization */ - public function getOrganization($locale): ?Organization + public function getOrganization(string $locale): ?Organization { switch (true) { case ($locale == 'nl'): diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/ServiceProviderEntity.php b/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/ServiceProviderEntity.php index ee78371898..2170eeab1f 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/ServiceProviderEntity.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Adapter/ServiceProviderEntity.php @@ -128,10 +128,10 @@ public function hasCompleteOrganizationData(string $locale): bool } /** - * @param $locale + * @param string $locale * @return Organization */ - public function getOrganization($locale): ?Organization + public function getOrganization(string $locale): ?Organization { switch (true) { case ($locale == 'nl'): diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractIdentityProvider.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractIdentityProvider.php index 565cd0b8b6..f3c43a428e 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractIdentityProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractIdentityProvider.php @@ -114,10 +114,10 @@ public function hasCompleteOrganizationData(string $locale): bool } /** - * @param $locale + * @param string $locale * @return Organization|null */ - public function getOrganization($locale): ?Organization + public function getOrganization(string $locale): ?Organization { return $this->entity->getOrganization($locale); } diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractServiceProvider.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractServiceProvider.php index 36326ec909..d83f4831c5 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractServiceProvider.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/AbstractServiceProvider.php @@ -107,10 +107,10 @@ public function hasCompleteOrganizationData(string $locale): bool } /** - * @param $locale + * @param string $locale * @return Organization|null */ - public function getOrganization($locale): ?Organization + public function getOrganization(string $locale): ?Organization { return $this->entity->getOrganization($locale); } diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php index d7d7e53b56..e315b00c08 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockIdentityProviderInformation.php @@ -60,9 +60,9 @@ public function getLogo(): ?Logo return $this->engineBlockConfiguration->getLogo(); } - public function getOrganization($locale): ?Organization + public function getOrganization(string $locale): ?Organization { - return $this->engineBlockConfiguration->getOrganization(); + return $this->engineBlockConfiguration->getOrganization($locale); } /** diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php index e5d15ccd3b..d969ac5711 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineBlockServiceProviderInformation.php @@ -60,9 +60,9 @@ public function getLogo(): ?Logo return $this->engineBlockConfiguration->getLogo(); } - public function getOrganization($locale): ?Organization + public function getOrganization(string $locale): ?Organization { - return $this->engineBlockConfiguration->getOrganization(); + return $this->engineBlockConfiguration->getOrganization($locale); } /** diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/IdentityProviderEntityInterface.php b/src/OpenConext/EngineBlock/Metadata/Factory/IdentityProviderEntityInterface.php index 713a5832fb..99622c5321 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/IdentityProviderEntityInterface.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/IdentityProviderEntityInterface.php @@ -71,10 +71,10 @@ public function getLogo(): ?Logo; public function hasCompleteOrganizationData(string $locale): bool; /** - * @param $locale + * @param string $locale * @return Organization|null */ - public function getOrganization($locale): ?Organization; + public function getOrganization(string $locale): ?Organization; /** * @param $locale diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/ServiceProviderEntityInterface.php b/src/OpenConext/EngineBlock/Metadata/Factory/ServiceProviderEntityInterface.php index 271390bac0..925062a212 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/ServiceProviderEntityInterface.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/ServiceProviderEntityInterface.php @@ -63,10 +63,10 @@ public function getLogo(): ?Logo; public function hasCompleteOrganizationData(string $locale): bool; /** - * @param $locale + * @param string $locale * @return Organization|null */ - public function getOrganization($locale): ?Organization; + public function getOrganization(string $locale): ?Organization; /** * @param $locale diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php b/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php index b6c43a0bb8..4164ca0bc9 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php @@ -30,6 +30,11 @@ */ class EngineBlockConfiguration { + /** + * @var \Symfony\Component\Translation\TranslatorInterface + */ + private $translator; + /** * @var string */ @@ -84,11 +89,12 @@ public function __construct( int $logoWidth, int $logoHeight ) { + $this->translator = $translator; $this->suiteName = $translator->trans('suite_name'); $this->engineHostName = $engineHostName; - $this->organizationName = $translator->trans('metadata_organization_name'); - $this->organizationDisplayName = $translator->trans('metadata_organization_displayname'); - $this->organizationUrl = $translator->trans('metadata_organization_url'); + $this->organizationName = 'metadata_organization_name'; + $this->organizationDisplayName = 'metadata_organization_displayname'; + $this->organizationUrl = 'metadata_organization_url'; $this->supportMail = $supportMail; $this->description = $description; @@ -101,9 +107,10 @@ public function __construct( $this->logo->height = $logoHeight; // Create the contact person data for the EB SP entity - $support = ContactPerson::from('support', $this->organizationName, 'Support', $this->supportMail); - $technical = ContactPerson::from('technical', $this->organizationName, 'Support', $this->supportMail); - $administrative = ContactPerson::from('administrative', $this->organizationName, 'Support', $this->supportMail); + $organizationName = $translator->trans('metadata_organization_name'); + $support = ContactPerson::from('support', $organizationName, 'Support', $this->supportMail); + $technical = ContactPerson::from('technical', $organizationName, 'Support', $this->supportMail); + $administrative = ContactPerson::from('administrative', $organizationName, 'Support', $this->supportMail); $this->contactPersons = [$support, $technical, $administrative]; } @@ -118,9 +125,12 @@ public function getHostname(): string return $this->engineHostName; } - public function getOrganization() : Organization + public function getOrganization(string $locale) : Organization { - return new Organization($this->organizationName, $this->organizationDisplayName, $this->organizationUrl); + $organizationName = $this->translator->trans($this->organizationName, [], null, $locale); + $organizationDisplayName = $this->translator->trans($this->organizationDisplayName, [], null, $locale); + $organizationUrl = $this->translator->trans($this->organizationUrl, [], null, $locale); + return new Organization($organizationName, $organizationDisplayName, $organizationUrl); } public function getLogo(): Logo diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/AbstractEntityTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/AbstractEntityTest.php index bed994f653..62e8a16bec 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/AbstractEntityTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/AbstractEntityTest.php @@ -33,6 +33,7 @@ use OpenConext\EngineBlock\Metadata\Service; use OpenConext\EngineBlock\Metadata\ShibMdScope; use OpenConext\EngineBlock\Metadata\X509\X509Certificate; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use ReflectionClass; use ReflectionProperty; @@ -512,6 +513,64 @@ protected function getServiceProviderMockProperties() ]; } + protected function setTranslationExpectancies(MockObject $translator) + { + $translator->expects($this->at(0)) + ->method('trans') + ->with('suite_name') + ->willReturn('test-suite'); + + $translator->expects($this->at(1)) + ->method('trans') + ->with('metadata_organization_name') + ->willReturn('configuredOrganizationName'); + + $translator->expects($this->at(2)) + ->method('trans') + ->with('metadata_organization_name', [], null, 'nl') + ->willReturn('configuredOrganizationName'); + + $translator->expects($this->at(3)) + ->method('trans') + ->with('metadata_organization_displayname', [], null, 'nl') + ->willReturn('configuredOrganizationDisplayName'); + + $translator->expects($this->at(4)) + ->method('trans') + ->with('metadata_organization_url', [], null, 'nl') + ->willReturn('configuredOrganizationUrl'); + + $translator->expects($this->at(5)) + ->method('trans') + ->with('metadata_organization_name', [], null, 'en') + ->willReturn('configuredOrganizationName'); + + $translator->expects($this->at(6)) + ->method('trans') + ->with('metadata_organization_displayname', [], null, 'en') + ->willReturn('configuredOrganizationDisplayName'); + + $translator->expects($this->at(7)) + ->method('trans') + ->with('metadata_organization_url', [], null, 'en') + ->willReturn('configuredOrganizationUrl'); + + $translator->expects($this->at(8)) + ->method('trans') + ->with('metadata_organization_name', [], null, 'pt') + ->willReturn('configuredOrganizationName'); + + $translator->expects($this->at(9)) + ->method('trans') + ->with('metadata_organization_displayname', [], null, 'pt') + ->willReturn('configuredOrganizationDisplayName'); + + $translator->expects($this->at(10)) + ->method('trans') + ->with('metadata_organization_url', [], null, 'pt') + ->willReturn('configuredOrganizationUrl'); + } + private function getParameters($className, $skipParameters = []) { $results = []; diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockIdentityProviderInformationTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockIdentityProviderInformationTest.php index f00a8c26ee..8c0601612f 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockIdentityProviderInformationTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockIdentityProviderInformationTest.php @@ -31,34 +31,17 @@ public function test_methods() $adapter = $this->createIdentityProviderAdapter(); $translator = $this->createMock(TranslatorInterface::class); - $translator->expects($this->at(0)) - ->method('trans') - ->with('suite_name') - ->willReturn('test-suite'); - $translator->expects($this->at(1)) - ->method('trans') - ->with('metadata_organization_name') - ->willReturn('configuredOrganizationName'); - - $translator->expects($this->at(2)) - ->method('trans') - ->with('metadata_organization_displayname') - ->willReturn('configuredOrganizationDisplayName'); - - $translator->expects($this->at(3)) - ->method('trans') - ->with('metadata_organization_url') - ->willReturn('configuredOrganizationUrl'); + $this->setTranslationExpectancies($translator); $configuration = new EngineBlockConfiguration( $translator, - 'configuredSupportMail', - 'configuredDescription', - 'example.org', - '/configuredLogoUrl', - 1209, - 1009 + 'configuredSupportMail', + 'configuredDescription', + 'example.org', + '/configuredLogoUrl', + 1209, + 1009 ); $decorator = new EngineBlockIdentityProviderInformation($adapter, $configuration); diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockServiceProviderInformationTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockServiceProviderInformationTest.php index b717e9cf76..f27e5b6a49 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockServiceProviderInformationTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/EngineblockServiceProviderInformationTest.php @@ -32,25 +32,8 @@ public function test_methods() $adapter = $this->createServiceProviderAdapter(); $translator = $this->createMock(TranslatorInterface::class); - $translator->expects($this->at(0)) - ->method('trans') - ->with('suite_name') - ->willReturn('test-suite'); - $translator->expects($this->at(1)) - ->method('trans') - ->with('metadata_organization_name') - ->willReturn('configuredOrganizationName'); - - $translator->expects($this->at(2)) - ->method('trans') - ->with('metadata_organization_displayname') - ->willReturn('configuredOrganizationDisplayName'); - - $translator->expects($this->at(3)) - ->method('trans') - ->with('metadata_organization_url') - ->willReturn('configuredOrganizationUrl'); + $this->setTranslationExpectancies($translator); $configuration = new EngineBlockConfiguration( $translator, diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProviderTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProviderTest.php index 0b95e55791..148133d32a 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProviderTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Decorator/ProxiedIdentityProviderTest.php @@ -111,16 +111,6 @@ private function createConfiguration(): EngineBlockConfiguration ->with('metadata_organization_name') ->willReturn('configuredOrganizationName'); - $translator->expects($this->at(2)) - ->method('trans') - ->with('metadata_organization_displayname') - ->willReturn('configuredOrganizationDisplayName'); - - $translator->expects($this->at(3)) - ->method('trans') - ->with('metadata_organization_url') - ->willReturn('configuredOrganizationUrl'); - $configuration = new EngineBlockConfiguration( $translator, 'configuredSupportMail', diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/IdentityProviderFactoryTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/IdentityProviderFactoryTest.php index 809ec179ad..952a13170d 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/IdentityProviderFactoryTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/IdentityProviderFactoryTest.php @@ -98,16 +98,6 @@ public function test_create_idp_entity_from_entity_properties() ->with('metadata_organization_name') ->willReturn('configuredOrganizationName'); - $this->translator->expects($this->at(2)) - ->method('trans') - ->with('metadata_organization_displayname') - ->willReturn('configuredOrganizationDisplayName'); - - $this->translator->expects($this->at(3)) - ->method('trans') - ->with('metadata_organization_url') - ->willReturn('configuredOrganizationUrl'); - $this->configuration = new EngineBlockConfiguration( $this->translator, 'configuredSupportMail', diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/ServiceProviderFactoryTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/ServiceProviderFactoryTest.php index b320f9dfc7..48e8ec45dc 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/ServiceProviderFactoryTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/Factory/ServiceProviderFactoryTest.php @@ -18,11 +18,9 @@ namespace OpenConext\EngineBlock\Metadata\Factory\Factory; use EngineBlock_Attributes_Metadata as AttributesMetadata; -use Mockery\Mock; use OpenConext\EngineBlock\Exception\MissingParameterException; use OpenConext\EngineBlock\Metadata\Coins; use OpenConext\EngineBlock\Metadata\ContactPerson; -use OpenConext\EngineBlock\Metadata\Entity\ServiceProvider; use OpenConext\EngineBlock\Metadata\Factory\AbstractEntityTest; use OpenConext\EngineBlock\Metadata\Factory\ServiceProviderEntityInterface; use OpenConext\EngineBlock\Metadata\Factory\ValueObject\EngineBlockConfiguration; @@ -114,25 +112,7 @@ public function test_create_stepup_entity_from() public function test_eb_properties() { - $this->translator->expects($this->at(0)) - ->method('trans') - ->with('suite_name') - ->willReturn('test-suite'); - - $this->translator->expects($this->at(1)) - ->method('trans') - ->with('metadata_organization_name') - ->willReturn('configuredOrganizationName'); - - $this->translator->expects($this->at(2)) - ->method('trans') - ->with('metadata_organization_displayname') - ->willReturn('configuredOrganizationDisplayName'); - - $this->translator->expects($this->at(3)) - ->method('trans') - ->with('metadata_organization_url') - ->willReturn('configuredOrganizationUrl'); + $this->setTranslationExpectancies($this->translator); $this->configuration = new EngineBlockConfiguration( $this->translator, @@ -295,16 +275,6 @@ public function test_stepup_properties() ->with('metadata_organization_name') ->willReturn('configuredOrganizationName'); - $this->translator->expects($this->at(2)) - ->method('trans') - ->with('metadata_organization_displayname') - ->willReturn('configuredOrganizationDisplayName'); - - $this->translator->expects($this->at(3)) - ->method('trans') - ->with('metadata_organization_url') - ->willReturn('configuredOrganizationUrl'); - $this->configuration = new EngineBlockConfiguration( $this->translator, 'configuredSupportMail', diff --git a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfigurationTest.php b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfigurationTest.php index a2bc6b1622..8eb4c49c31 100644 --- a/tests/unit/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfigurationTest.php +++ b/tests/unit/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfigurationTest.php @@ -42,17 +42,22 @@ public function test_configuration_creation() ->shouldReceive('trans') ->with('suite_name')->once() ->andReturn($suitName); + $translator + ->shouldReceive('trans') + ->with('metadata_organization_name', [], null, 'en')->once() + ->andReturn($orgName); $translator ->shouldReceive('trans') ->with('metadata_organization_name')->once() ->andReturn($orgName); $translator ->shouldReceive('trans') - ->with('metadata_organization_displayname')->once() + ->with('metadata_organization_displayname', [], null, 'en')->once() ->andReturn($orgDisplayName); + $translator ->shouldReceive('trans') - ->with('metadata_organization_url')->once() + ->with('metadata_organization_url', [], null, 'en')->once() ->andReturn($orgUrl); $mail = 'mail@example.org'; @@ -98,9 +103,10 @@ public function test_configuration_creation() $this->assertEquals($width, $configuration->getLogo()->width); $this->assertEquals($height, $configuration->getLogo()->height); - $this->assertInstanceOf(Organization::class, $configuration->getOrganization()); - $this->assertEquals($orgUrl, $configuration->getOrganization()->url); - $this->assertEquals($orgName, $configuration->getOrganization()->name); - $this->assertEquals($orgDisplayName, $configuration->getOrganization()->displayName); + $organization = $configuration->getOrganization('en'); + $this->assertInstanceOf(Organization::class, $organization); + $this->assertEquals($orgUrl, $organization->url); + $this->assertEquals($orgName, $organization->name); + $this->assertEquals($orgDisplayName, $organization->displayName); } } From bb87c8ea804d447537be900e646a3183a2a01f4e Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 30 Sep 2024 18:48:48 +0200 Subject: [PATCH 2/2] Remove unnecessary function call --- .../Factory/ValueObject/EngineBlockConfiguration.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php b/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php index 4164ca0bc9..d75df5e68e 100644 --- a/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php +++ b/src/OpenConext/EngineBlock/Metadata/Factory/ValueObject/EngineBlockConfiguration.php @@ -107,10 +107,9 @@ public function __construct( $this->logo->height = $logoHeight; // Create the contact person data for the EB SP entity - $organizationName = $translator->trans('metadata_organization_name'); - $support = ContactPerson::from('support', $organizationName, 'Support', $this->supportMail); - $technical = ContactPerson::from('technical', $organizationName, 'Support', $this->supportMail); - $administrative = ContactPerson::from('administrative', $organizationName, 'Support', $this->supportMail); + $support = ContactPerson::from('support', $this->organizationName, 'Support', $this->supportMail); + $technical = ContactPerson::from('technical', $this->organizationName, 'Support', $this->supportMail); + $administrative = ContactPerson::from('administrative', $this->organizationName, 'Support', $this->supportMail); $this->contactPersons = [$support, $technical, $administrative]; }