From 0cbb7f30670145cebf3339ec7eb93f4592091050 Mon Sep 17 00:00:00 2001 From: Lukas Scharmer Date: Mon, 9 Sep 2024 15:52:41 +0200 Subject: [PATCH] LegalDocuments: Annotation cleanup --- .../ILIAS/DataProtection/classes/Consumer.php | 2 +- .../classes/class.ilObjDataProtectionGUI.php | 10 ++++- .../LegalDocuments/classes/Administration.php | 43 ++++++++++++------- .../Condition/Definitions/RoleDefinition.php | 7 +-- .../classes/ConditionDefinition.php | 1 + .../LegalDocuments/classes/Conductor.php | 6 +++ .../ILIAS/LegalDocuments/classes/Consumer.php | 2 +- .../ConsumerSlots/Agreement.php | 8 +--- .../ConsumerSlots/SelfRegistration.php | 6 ++- .../ConsumerSlots/ShowOnLoginPage.php | 1 + .../ConsumerSlots/WithdrawProcess.php | 6 +-- .../classes/ConsumerToolbox/Routing.php | 6 +-- .../classes/ConsumerToolbox/Slot.php | 8 ++-- .../classes/ConsumerToolbox/User.php | 1 + .../classes/DefaultMappings.php | 5 +++ .../classes/FileUpload/UploadHandler.php | 1 + .../LegalDocuments/classes/HTMLPurifier.php | 1 + .../classes/Legacy/Confirmation.php | 2 +- .../LegalDocuments/classes/Legacy/Table.php | 2 +- .../classes/Provide/ProvideDocument.php | 3 +- .../classes/Provide/ProvideHistory.php | 2 + .../classes/Provide/ProvidePublicPage.php | 4 +- .../classes/Provide/ProvideWithdrawal.php | 6 +-- .../Repository/DatabaseDocumentRepository.php | 9 +++- .../Repository/DatabaseHistoryRepository.php | 1 + .../classes/Repository/DeriveFieldTypes.php | 2 +- .../Repository/DocumentRepositoryMeta.php | 7 +++ .../classes/Repository/HistoryRepository.php | 3 +- .../Repository/ReadOnlyDocumentRepository.php | 2 +- .../LegalDocuments/classes/SelectionMap.php | 2 +- .../classes/Setup/UpdateSteps.php | 2 +- .../classes/SlotConstructor.php | 2 +- .../classes/SmoothTableConfig.php | 3 +- .../classes/SmoothTableFilter.php | 1 + .../LegalDocuments/classes/StartUpStep.php | 12 +++++- .../ILIAS/LegalDocuments/classes/Table.php | 2 + .../classes/Table/DocumentModal.php | 3 +- .../classes/Table/DocumentTable.php | 5 ++- .../classes/Table/EditableDocumentTable.php | 4 +- .../classes/Table/HistoryTable.php | 8 ++-- .../LegalDocuments/classes/TableConfig.php | 2 +- .../ILIAS/LegalDocuments/classes/UseSlot.php | 4 +- .../LegalDocuments/classes/ValidHTML.php | 1 + .../ILIAS/LegalDocuments/classes/Wiring.php | 10 ++++- ...lass.ilLegalDocumentsAdministrationGUI.php | 3 ++ .../ConsumerSlots/AgreementTest.php | 6 --- .../ILIAS/TermsOfService/classes/Consumer.php | 3 +- .../ILIAS/TermsOfService/classes/Settings.php | 1 + .../classes/class.ilObjTermsOfServiceGUI.php | 5 ++- 49 files changed, 150 insertions(+), 86 deletions(-) diff --git a/components/ILIAS/DataProtection/classes/Consumer.php b/components/ILIAS/DataProtection/classes/Consumer.php index 040a4b765e18..7f2ea348cc0a 100755 --- a/components/ILIAS/DataProtection/classes/Consumer.php +++ b/components/ILIAS/DataProtection/classes/Consumer.php @@ -75,7 +75,7 @@ public function uses(UseSlot $slot, LazyProvide $provide): UseSlot $slot = $slot->showOnLoginPage($blocks->slot()->showOnLoginPage()); - $agreement = $blocks->slot()->agreement($user, $global_settings); + $agreement = $blocks->slot()->agreement($user); $constraint = $this->container->refinery()->custom()->constraint(...); if ($global_settings->noAcceptance()->value()) { diff --git a/components/ILIAS/DataProtection/classes/class.ilObjDataProtectionGUI.php b/components/ILIAS/DataProtection/classes/class.ilObjDataProtectionGUI.php index 58603b93049c..8734f0baafe6 100755 --- a/components/ILIAS/DataProtection/classes/class.ilObjDataProtectionGUI.php +++ b/components/ILIAS/DataProtection/classes/class.ilObjDataProtectionGUI.php @@ -20,7 +20,6 @@ use ILIAS\DataProtection\Consumer; use ILIAS\DataProtection\Settings; -use ILIAS\LegalDocuments\ConsumerToolbox\Settings as SettingsInterface; use ILIAS\LegalDocuments\ConsumerToolbox\Setting; use ILIAS\LegalDocuments\ConsumerToolbox\KeyValueStore\ReadOnlyStore; use ILIAS\LegalDocuments\ConsumerToolbox\KeyValueStore\ILIASSettingStore; @@ -34,6 +33,7 @@ use ILIAS\UI\Component\Component; use ILIAS\Data\Factory as DataFactory; use ILIAS\LegalDocuments\ConsumerToolbox\UI; +use ILIAS\UI\Component\Input\Input; /** * @ilCtrl_isCalledBy ilObjDataProtectionGUI: ilAdministrationGUI @@ -45,7 +45,7 @@ final class ilObjDataProtectionGUI extends ilObject2GUI private readonly ilLegalDocumentsAdministrationGUI $legal_documents; private readonly Container $container; private readonly Config $config; - private readonly SettingsInterface $data_protection_settings; + private readonly Settings $data_protection_settings; private readonly UI $ui; public function __construct() @@ -214,6 +214,9 @@ private function form(): Component }); } + /** + * @param array $fields + */ private function optionalGroup(string $label, string $description, array $fields): OptionalGroup { return $this->ui->create()->input()->field()->optionalGroup( @@ -223,6 +226,9 @@ private function optionalGroup(string $label, string $description, array $fields ); } + /** + * @param array $options + */ private function radio(string $prefix, array $options): Component { $field = $this->ui->create()->input()->field()->radio($this->ui->txt($prefix), $this->ui->txt($prefix . '_desc')); diff --git a/components/ILIAS/LegalDocuments/classes/Administration.php b/components/ILIAS/LegalDocuments/classes/Administration.php index 6fe84ffcd9eb..69de69927b51 100755 --- a/components/ILIAS/LegalDocuments/classes/Administration.php +++ b/components/ILIAS/LegalDocuments/classes/Administration.php @@ -20,10 +20,11 @@ namespace ILIAS\LegalDocuments; -use ILIAS\UI\Component\Button\Button; +use ILIAS\UI\Component\Button\Standard as Button; use ILIAS\LegalDocuments\DocumentId; use ILIAS\LegalDocuments\Value\Criterion; use ILIAS\LegalDocuments\Value\Document; +use ILIAS\LegalDocuments\Value\CriterionContent; use ILIAS\DI\Container; use ILIAS\UI\Component\Component; use ilDatePresentation; @@ -44,6 +45,7 @@ use ILIAS\LegalDocuments\Legacy\Confirmation; use ilObjUserFolderGUI; use ILIAS\LegalDocuments\Value\DocumentContent; +use ILIAS\UI\Component\Input\Container\Form\Form; class Administration { @@ -112,6 +114,9 @@ public function withDocumentAndCriterion(Closure $proc): void $proc($document, $criterion); } + /** + * @return list + */ public function retrieveDocuments(): array { $ids = $this->retrieveIds(); @@ -123,13 +128,16 @@ public function retrieveDocuments(): array return $documents; } + /** + * @return list + */ public function retrieveIds(): array { return $this->container->http()->wrapper()->post()->retrieve('ids', $this->container->refinery()->to()->listOf($this->container->refinery()->kindlyTo()->int())); } /** - * @param Closure(Closure(string): string, DocumentId, bool): void $then + * @param Closure(Closure(string): string, string, DocumentId, bool): mixed $then */ public function idOrHash(object $gui, Closure $then): void { @@ -144,13 +152,13 @@ public function idOrHash(object $gui, Closure $then): void } - public function targetWithDoc(object $gui, $document, string $cmd, string $method = 'getLinkTarget'): string + public function targetWithDoc(object $gui, Document $document, string $cmd, string $method = 'getLinkTarget'): string { $link = $this->willLinkWith($gui, ['doc_id' => (string) $document->id()]); return $link($cmd, $method); } - public function targetWithDocAndCriterion(object $gui, $document, $criterion, string $cmd, string $method = 'getLinkTarget') + public function targetWithDocAndCriterion(object $gui, Document $document, Criterion $criterion, string $cmd, string $method = 'getLinkTarget'): string { $link = $this->willLinkWith($gui, [ 'doc_id' => (string) $document->id(), @@ -161,7 +169,9 @@ public function targetWithDocAndCriterion(object $gui, $document, $criterion, st } /** - * @param array $parameters + * @param string|object $gui + * @param array $parameters + * @return Closure(string, ?string?): string */ public function willLinkWith($gui, array $parameters = []): Closure { @@ -170,11 +180,11 @@ public function willLinkWith($gui, array $parameters = []): Closure $method ??= $class === $gui ? 'getLinkTargetByClass' : 'getLinkTarget'; $array = $this->container->ctrl()->getParameterArrayByClass($class); foreach ($parameters as $key => $value) { - $this->container->ctrl()->setParameterByClass($class, $key, $value); + $this->container->ctrl()->setParameterByClass($class, (string) $key, $value); } $link = $this->container->ctrl()->$method($gui, $cmd); foreach ($parameters as $key => $_) { - $this->container->ctrl()->setParameterByClass($class, $key, $array[$key] ?? ''); + $this->container->ctrl()->setParameterByClass($class, (string) $key, $array[$key] ?? ''); } return $link; @@ -184,7 +194,7 @@ public function willLinkWith($gui, array $parameters = []): Closure /** * @param Closure(array): void $then */ - public function withFormData($form, Closure $then) + public function withFormData(Form $form, Closure $then): Form { $request = $this->container->http()->request(); if ($request->getMethod() !== 'POST') { @@ -227,7 +237,7 @@ public function currentDocument(): Result return $this->container->refinery()->kindlyTo()->int()->applyTo(new Ok($doc_id))->then($repo->find(...)); } - public function criterionForm(string $url, Document $document, $criterion = null) + public function criterionForm(string $url, Document $document, ?CriterionContent $criterion = null): Form { $groups = $this->config->legalDocuments()->document()->conditionGroups($criterion); $group = $this->ui->create()->input()->field()->switchableGroup($groups->choices(), $this->ui->txt('form_criterion')); @@ -282,7 +292,7 @@ public function uploadContent(): string } /** - * @param list|Component $component + * @param list|Component|string $component */ public function setContent($component): void { @@ -317,7 +327,7 @@ public function render($component): string } /** - * @param list