ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Services.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\DI\Container as GlobalContainer;
25use ILIAS\MetaData\Structure\Services\Services as StructureServices;
26use ILIAS\MetaData\Copyright\Services\Services as CopyrightServices;
33use ILIAS\MetaData\Vocabularies\Controlled\RepositoryInterface as ControlledRepositoryInterface;
37use ILIAS\MetaData\Vocabularies\Standard\RepositoryInterface as StandardRepositoryInterface;
47use ILIAS\MetaData\Vocabularies\Slots\ElementHelperInterface as SlotElementHelperInterface;
50
52{
55 protected SlotElementHelperInterface $slot_element_helper;
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)) {
85 }
86 return $this->presentation = new Presentation(
87 $this->copyrightBridge(),
88 $this->controlledRepository(),
89 $this->standardRepository()
90 );
91 }
92
93 public function slotElementHelper(): SlotElementHelperInterface
94 {
95 if (isset($this->slot_element_helper)) {
97 }
98 return $this->slot_element_helper = new SlotElementHelper(
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 );
108 }
109
110 public function manager(): ManagerInterface
111 {
112 if (isset($this->manager)) {
113 return $this->manager;
114 }
115 return $this->manager = new Manager(
116 $this->controlledRepository(),
117 $this->reader(),
118 $infos = new Infos(
119 $this->controlledRepository(),
120 $this->standardRepository()
121 ),
122 new Actions(
123 $infos,
124 $this->controlledRepository(),
125 $this->standardRepository()
126 )
127 );
128 }
129
130 public function slotHandler(): SlotHandler
131 {
132 if (isset($this->slot_handler)) {
133 return $this->slot_handler;
134 }
135 return $this->slot_handler = new SlotHandler(
136 $this->path_services->pathFactory(),
137 $this->path_services->navigatorFactory(),
138 $this->structure_services->structure(),
139 );
140 }
141
142 public function reader(): ReaderInterface
143 {
144 if (isset($this->reader)) {
145 return $this->reader;
146 }
147 return $this->reader = new Reader(
148 $this->copyrightBridge(),
149 $this->controlledRepository(),
150 $this->standardRepository()
151 );
152 }
153
154 protected function copyrightBridge(): CopyrightBridge
155 {
156 if (isset($this->copyright_bridge)) {
158 }
159 return $this->copyright_bridge = new Bridge(
160 $this->factory(),
162 $this->copyright_services->repository(),
163 $this->copyright_services->identifiersHandler()
164 );
165 }
166
167 protected function controlledRepository(): ControlledRepositoryInterface
168 {
169 if (isset($this->controlled_repository)) {
171 }
172 return $this->controlled_repository = new ControlledRepository(
173 new Wrapper($this->dic->database()),
174 $this->factory(),
175 $this->slotHandler()
176 );
177 }
178
179 protected function standardRepository(): StandardRepositoryInterface
180 {
181 if (isset($this->standard_repository)) {
183 }
184 return $this->standard_repository = new StandardRepository(
185 new DatabaseGateway($this->dic->database()),
186 $this->factory(),
187 new Assignments()
188 );
189 }
190
191 protected function factory(): FactoryInterface
192 {
193 if (isset($this->factory)) {
194 return $this->factory;
195 }
196 return $this->factory = new Factory();
197 }
198}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
SlotElementHelperInterface $slot_element_helper
Definition: Services.php:55
__construct(GlobalContainer $dic, PathServices $path_services, StructureServices $structure_services, CopyrightServices $copyright_services)
Definition: Services.php:69
ControlledRepositoryInterface $controlled_repository
Definition: Services.php:61
StandardRepositoryInterface $standard_repository
Definition: Services.php:62