diff --git a/src/SiteKitResourceChannelFactory.php b/src/SiteKitResourceChannelFactory.php index afc1792..db20d1c 100644 --- a/src/SiteKitResourceChannelFactory.php +++ b/src/SiteKitResourceChannelFactory.php @@ -8,6 +8,12 @@ /** * @phpstan-type ContextPhp array{ + * tenant: array{ + * id: string, + * name: string, + * anchor: string, + * attributes: array + * }, * publisher: array{ * id: int, * name: string, @@ -17,7 +23,7 @@ * nature: ?string, * locale: ?string, * encoding: ?string, - * translationLocales: ?string[] + * translationLocales: ?string[], * } * } */ @@ -64,10 +70,19 @@ public function create(): ResourceChannel $this->configDir, $searchIndex, $data['publisher']['translationLocales'] ?? [], - $this->createTenant($data['tanent'] ?? $data['client'] /* deprecated */ ?? []), + $this->createTenant($data['tenant']), ); } + /** + * @param array{ + * id: string, + * name: string, + * anchor: string, + * attributes: array, + * } $data + * @return ResourceTenant + */ private function createTenant(array $data): ResourceTenant { return new ResourceTenant( @@ -90,6 +105,11 @@ private function loadContextPhpFile(): array ); } + if (isset($context['client'])) { + $context['tenant'] = $context['client']; + unset($context['client']); + } + /** @var ContextPhp $context */ return $context; } diff --git a/test/resources/SiteKitResourceChannelFactory/documentRootLayout/WEB-IES/context.php b/test/resources/SiteKitResourceChannelFactory/documentRootLayout/WEB-IES/context.php index 3dc019b..c57f87b 100644 --- a/test/resources/SiteKitResourceChannelFactory/documentRootLayout/WEB-IES/context.php +++ b/test/resources/SiteKitResourceChannelFactory/documentRootLayout/WEB-IES/context.php @@ -1,7 +1,7 @@ [ + 'client' => [ 'id' => '2', 'name' => 'Test-Tanent', 'anchor' => 'test-tanent', diff --git a/test/resources/SiteKitResourceChannelFactory/resourceLayout/context.php b/test/resources/SiteKitResourceChannelFactory/resourceLayout/context.php index bb58af6..677ecbe 100644 --- a/test/resources/SiteKitResourceChannelFactory/resourceLayout/context.php +++ b/test/resources/SiteKitResourceChannelFactory/resourceLayout/context.php @@ -1,7 +1,7 @@ [ + 'tenant' => [ 'id' => '2', 'name' => 'Test-Tanent', 'anchor' => 'test-tanent',