diff --git a/src/lib/Tab/LocationView/AuthorsTab.php b/src/lib/Tab/LocationView/AuthorsTab.php index f93e89aa52..e46d26d6b0 100644 --- a/src/lib/Tab/LocationView/AuthorsTab.php +++ b/src/lib/Tab/LocationView/AuthorsTab.php @@ -8,11 +8,10 @@ namespace Ibexa\AdminUi\Tab\LocationView; +use ArrayObject; use Ibexa\AdminUi\Specification\UserExists; -use Ibexa\AdminUi\UI\Dataset\DatasetFactory; use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; -use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; @@ -25,25 +24,17 @@ class AuthorsTab extends AbstractEventDispatchingTab implements OrderedTabInterf { public const URI_FRAGMENT = 'ibexa-tab-location-view-authors'; - protected UserService $userService; - - protected SectionService $sectionService; - - protected DatasetFactory $datasetFactory; + private UserService $userService; public function __construct( Environment $twig, TranslatorInterface $translator, - SectionService $sectionService, UserService $userService, - DatasetFactory $datasetFactory, EventDispatcherInterface $eventDispatcher ) { parent::__construct($twig, $translator, $eventDispatcher); - $this->sectionService = $sectionService; $this->userService = $userService; - $this->datasetFactory = $datasetFactory; } public function getIdentifier(): string @@ -81,22 +72,21 @@ public function getTemplateParameters(array $contextParameters = []): array $versionInfo = $content->getVersionInfo(); $contentInfo = $versionInfo->getContentInfo(); - $viewParameters = [ + $viewParameters = new ArrayObject([ 'content_info' => $contentInfo, 'version_info' => $versionInfo, - ]; + ]); $this->supplyCreator($viewParameters, $contentInfo); $this->supplyLastContributor($viewParameters, $versionInfo); - return array_replace($contextParameters, $viewParameters); + return array_replace($contextParameters, $viewParameters->getArrayCopy()); } /** - * @param array $parameters - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param \ArrayObject $parameters */ - private function supplyLastContributor(array &$parameters, VersionInfo $versionInfo): void + private function supplyLastContributor(ArrayObject $parameters, VersionInfo $versionInfo): void { $parameters['last_contributor'] = null; if ((new UserExists($this->userService))->isSatisfiedBy($versionInfo->creatorId)) { @@ -105,10 +95,9 @@ private function supplyLastContributor(array &$parameters, VersionInfo $versionI } /** - * @param array $parameters - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @param \ArrayObject $parameters */ - private function supplyCreator(array &$parameters, ContentInfo $contentInfo): void + private function supplyCreator(ArrayObject $parameters, ContentInfo $contentInfo): void { $parameters['creator'] = null; if ((new UserExists($this->userService))->isSatisfiedBy($contentInfo->ownerId)) { diff --git a/src/lib/Tab/LocationView/DetailsTab.php b/src/lib/Tab/LocationView/DetailsTab.php index 82b8f57389..500b68e17d 100644 --- a/src/lib/Tab/LocationView/DetailsTab.php +++ b/src/lib/Tab/LocationView/DetailsTab.php @@ -20,7 +20,6 @@ use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\SectionService; -use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; @@ -34,11 +33,9 @@ class DetailsTab extends AbstractEventDispatchingTab implements OrderedTabInterf { public const URI_FRAGMENT = 'ibexa-tab-location-view-details'; - protected UserService $userService; + private SectionService $sectionService; - protected SectionService $sectionService; - - protected DatasetFactory $datasetFactory; + private DatasetFactory $datasetFactory; private FormFactoryInterface $formFactory; @@ -48,7 +45,6 @@ public function __construct( Environment $twig, TranslatorInterface $translator, SectionService $sectionService, - UserService $userService, DatasetFactory $datasetFactory, FormFactoryInterface $formFactory, PermissionResolver $permissionResolver, @@ -57,7 +53,6 @@ public function __construct( parent::__construct($twig, $translator, $eventDispatcher); $this->sectionService = $sectionService; - $this->userService = $userService; $this->datasetFactory = $datasetFactory; $this->formFactory = $formFactory; $this->permissionResolver = $permissionResolver; @@ -114,9 +109,6 @@ public function getTemplateParameters(array $contextParameters = []): array return array_replace($contextParameters, $viewParameters->getArrayCopy()); } - /** - * @param \ArrayObject $parameters - */ private function supplySortFieldClauseMap(ArrayObject $parameters): void { $parameters['sort_field_clause_map'] = [ @@ -132,11 +124,7 @@ private function supplySortFieldClauseMap(ArrayObject $parameters): void ]; } - /** - * @param \ArrayObject $parameters - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - */ - private function supplyObjectStateParameters(ArrayObject &$parameters, ContentInfo $contentInfo): void + private function supplyObjectStateParameters(ArrayObject $parameters, ContentInfo $contentInfo): void { $objectStatesDataset = $this->datasetFactory->objectStates(); $objectStatesDataset->load($contentInfo); @@ -176,11 +164,6 @@ private function canUserAssignObjectState(): bool return $this->permissionResolver->hasAccess('state', 'assign') !== false; } - /** - * @param \ArrayObject $parameters - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - */ private function supplySectionParameters(ArrayObject $parameters, ContentInfo $contentInfo, Location $location): void { $canSeeSection = $this->permissionResolver->canUser('section', 'view', $contentInfo); @@ -208,10 +191,6 @@ private function supplySectionParameters(ArrayObject $parameters, ContentInfo $c } } - /** - * @param \ArrayObject $parameters - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - */ private function supplyFormLocationUpdate(ArrayObject $parameters, Location $location): void { $parameters['form_location_update'] = $this->formFactory->create( @@ -220,10 +199,6 @@ private function supplyFormLocationUpdate(ArrayObject $parameters, Location $loc )->createView(); } - /** - * @param \ArrayObject $parameters - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo - */ private function supplyTranslations(ArrayObject $parameters, VersionInfo $versionInfo): void { $translationsDataset = $this->datasetFactory->translations();