ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
SlotConstructor.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\LegalDocuments;
22 
25 use Closure;
35 
37 {
38  public function __construct(private readonly string $id, private readonly Container $container, private readonly UserAction $action)
39  {
40  }
41 
42  public function id(): string
43  {
44  return $this->id;
45  }
46 
47  public function history(ProvideDocument $document): ProvideHistory
48  {
49  return new ProvideHistory(
50  $this->id(),
52  $this->id(),
53  $document->repository(),
54  $this->container->database(),
55  $this->action
56  ),
57  $document,
58  $this->container
59  );
60  }
61 
66  public function document(DocumentRepository $document_repository, SelectionMap $conditions, array $content_as_component): ProvideDocument
67  {
68  return new ProvideDocument($this->id(), $document_repository, $conditions, $content_as_component, $this->container);
69  }
70 
72  {
73  return new DatabaseDocumentRepository(
74  $this->id(),
75  $this->container->database(),
76  $this->action
77  );
78  }
79 
80  public function readOnlyDocuments(DocumentRepository $document_repository): DocumentRepository
81  {
82  return new ReadOnlyDocumentRepository($document_repository);
83  }
84 
89  public function withdrawalFinished(Closure $finished): Closure
90  {
91  return function () use ($finished): array {
92  if (($this->container->http()->request()->getQueryParams()['withdrawal_finished'] ?? null) === $this->id()) {
93  $finished();
94  }
95  return [];
96  };
97  }
98 }
readOnlyDocuments(DocumentRepository $document_repository)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
__construct(private readonly string $id, private readonly Container $container, private readonly UserAction $action)
$container
Definition: wac.php:14
history(ProvideDocument $document)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
document(DocumentRepository $document_repository, SelectionMap $conditions, array $content_as_component)