ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
Services.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 use ILIAS\MetaData\Paths\Services\Services as PathServices;
25 use ILIAS\MetaData\Structure\Services\Services as StructureServices;
26 use ILIAS\MetaData\Copyright\Services\Services as CopyrightServices;
33 use ILIAS\MetaData\Vocabularies\Controlled\RepositoryInterface as ControlledRepositoryInterface;
34 use ILIAS\MetaData\Vocabularies\Controlled\Repository as ControlledRepository;
37 use ILIAS\MetaData\Vocabularies\Standard\RepositoryInterface as StandardRepositoryInterface;
38 use ILIAS\MetaData\Vocabularies\Standard\Repository as StandardRepository;
50 
51 class Services
52 {
56  protected SlotHandler $slot_handler;
57 
59  protected CopyrightBridge $copyright_bridge;
61  protected ControlledRepositoryInterface $controlled_repository;
62  protected StandardRepositoryInterface $standard_repository;
63 
64  protected GlobalContainer $dic;
65  protected PathServices $path_services;
66  protected StructureServices $structure_services;
67  protected CopyrightServices $copyright_services;
68 
69  public function __construct(
70  GlobalContainer $dic,
71  PathServices $path_services,
72  StructureServices $structure_services,
73  CopyrightServices $copyright_services
74  ) {
75  $this->dic = $dic;
76  $this->path_services = $path_services;
77  $this->structure_services = $structure_services;
78  $this->copyright_services = $copyright_services;
79  }
80 
82  {
83  if (isset($this->presentation)) {
84  return $this->presentation;
85  }
86  return $this->presentation = new Presentation(
87  $this->copyrightBridge(),
88  $this->controlledRepository(),
89  $this->standardRepository()
90  );
91  }
92 
94  {
95  if (isset($this->element_helper)) {
96  return $this->element_helper;
97  }
98  return $this->element_helper = new ElementHelper(
99  $this->slotHandler(),
100  $this->path_services->pathFactory(),
101  $this->path_services->navigatorFactory(),
102  new Checker(
103  $this->slotHandler(),
104  $this->path_services->pathFactory(),
105  $this->path_services->navigatorFactory()
106  ),
107  $this->reader()
108  );
109  }
110 
111  public function manager(): ManagerInterface
112  {
113  if (isset($this->manager)) {
114  return $this->manager;
115  }
116  return $this->manager = new Manager(
117  $this->controlledRepository(),
118  $this->reader(),
119  $infos = new Infos(
120  $this->controlledRepository(),
121  $this->standardRepository()
122  ),
123  new Actions(
124  $infos,
125  $this->controlledRepository(),
126  $this->standardRepository()
127  )
128  );
129  }
130 
131  public function slotHandler(): SlotHandler
132  {
133  if (isset($this->slot_handler)) {
134  return $this->slot_handler;
135  }
136  return $this->slot_handler = new SlotHandler(
137  $this->path_services->pathFactory(),
138  $this->path_services->navigatorFactory(),
139  $this->structure_services->structure(),
140  );
141  }
142 
143  protected function reader(): ReaderInterface
144  {
145  if (isset($this->reader)) {
146  return $this->reader;
147  }
148  return $this->reader = new Reader(
149  $this->copyrightBridge(),
150  $this->controlledRepository(),
151  $this->standardRepository()
152  );
153  }
154 
155  protected function copyrightBridge(): CopyrightBridge
156  {
157  if (isset($this->copyright_bridge)) {
159  }
160  return $this->copyright_bridge = new Bridge(
161  $this->factory(),
163  $this->copyright_services->repository(),
164  $this->copyright_services->identifiersHandler()
165  );
166  }
167 
168  protected function controlledRepository(): ControlledRepositoryInterface
169  {
170  if (isset($this->controlled_repository)) {
172  }
173  return $this->controlled_repository = new ControlledRepository(
174  new Wrapper($this->dic->database()),
175  $this->factory(),
176  $this->slotHandler()
177  );
178  }
179 
180  protected function standardRepository(): StandardRepositoryInterface
181  {
182  if (isset($this->standard_repository)) {
184  }
185  return $this->standard_repository = new StandardRepository(
186  new DatabaseGateway($this->dic->database()),
187  $this->factory(),
188  new Assignments()
189  );
190  }
191 
192  protected function factory(): FactoryInterface
193  {
194  if (isset($this->factory)) {
195  return $this->factory;
196  }
197  return $this->factory = new Factory();
198  }
199 }
__construct(GlobalContainer $dic, PathServices $path_services, StructureServices $structure_services, CopyrightServices $copyright_services)
Definition: Services.php:69
StandardRepositoryInterface $standard_repository
Definition: Services.php:62
ControlledRepositoryInterface $controlled_repository
Definition: Services.php:61