ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
Services.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 use ILIAS\MetaData\Paths\Services\Services as PathServices;
28 use ILIAS\MetaData\Repository\Services\Services as RepositoryServices;
29 use ILIAS\MetaData\Editor\Services\Services as EditorServices;
34 use ILIAS\MetaData\DataHelper\Services\Services as DataHelperServices;
35 
36 class Services
37 {
38  protected Actions $actions;
46 
47  protected GlobalContainer $dic;
48  protected PathServices $path_services;
49  protected RepositoryServices $repository_services;
50  protected EditorServices $editor_services;
51  protected DataHelperServices $data_helper_services;
52 
53  public function __construct(
54  GlobalContainer $dic,
55  PathServices $path_services,
56  RepositoryServices $repository_services,
57  EditorServices $editor_services,
58  DataHelperServices $data_helper_services
59  ) {
60  $this->dic = $dic;
61  $this->path_services = $path_services;
62  $this->repository_services = $repository_services;
63  $this->editor_services = $editor_services;
64  $this->data_helper_services = $data_helper_services;
65  }
66 
67  public function dataFinder(): DataFinder
68  {
69  if (isset($this->data_finder)) {
70  return $this->data_finder;
71  }
72  return $this->data_finder = new DataFinder();
73  }
74 
75  public function inputFactory(): InputFactory
76  {
77  if (isset($this->input_factory)) {
78  return $this->input_factory;
79  }
80  $field_factory = $this->dic->ui()->factory()->input()->field();
81  $refinery = $this->dic->refinery();
82  $presenter = $this->editor_services->presenter();
83  $path_factory = $this->path_services->pathFactory();
84  $vocabulary_adapter = $this->editor_services->vocabularyAdapter();
85  return $this->input_factory = new InputFactory(
86  $field_factory,
87  $refinery,
88  $presenter,
89  $path_factory,
90  $this->dataFinder(),
91  $this->repository_services->databaseDictionary(),
93  $field_factory,
94  $presenter,
95  $this->repository_services->constraintDictionary(),
96  $refinery,
97  $path_factory,
98  $this->data_helper_services->dataHelper(),
99  $vocabulary_adapter
100  ),
101  $vocabulary_adapter
102  );
103  }
104 
106  {
107  if (isset($this->properties_fetcher)) {
109  }
110  return $this->properties_fetcher = new PropertiesFetcher(
111  $this->editor_services->dictionary(),
112  $this->editor_services->presenter(),
113  $this->dataFinder()
114  );
115  }
116 
117  public function actions(): Actions
118  {
119  if (isset($this->actions)) {
120  return $this->actions;
121  }
122  $ui_factory = $this->dic->ui()->factory();
123  $presenter = $this->editor_services->presenter();
124  $link_provider = $this->linkProvider();
125  return $this->actions = new Actions(
126  $link_provider,
127  new ButtonFactory(
128  $ui_factory,
129  $presenter
130  ),
131  new ModalFactory(
132  $link_provider,
133  $ui_factory,
134  $presenter,
135  $this->propertiesFetcher(),
136  $this->formFactory(),
137  $this->repository_services->constraintDictionary(),
138  $this->path_services->pathFactory()
139  )
140  );
141  }
142 
143  public function formFactory(): FormFactory
144  {
145  if (isset($this->form_factory)) {
146  return $this->form_factory;
147  }
148  return $this->form_factory = new FormFactory(
149  $this->dic->ui()->factory(),
150  $this->linkProvider(),
151  $this->inputFactory(),
152  $this->editor_services->dictionary(),
153  $this->path_services->navigatorFactory()
154  );
155  }
156 
157  public function tableFactory(): TableFactory
158  {
159  if (isset($this->table_factory)) {
160  return $this->table_factory;
161  }
162  return $this->table_factory = new TableFactory(
163  $this->dic->ui()->factory(),
164  $this->dic->ui()->renderer(),
165  $this->editor_services->presenter(),
166  $this->dataFinder(),
167  $this->actions()->getButton()
168  );
169  }
170 
172  {
173  if (isset($this->manipulator_adapter)) {
175  }
176  return $this->manipulator_adapter = new ManipulatorAdapter(
177  $this->editor_services->manipulator(),
178  $this->formFactory(),
179  $this->path_services->pathFactory(),
180  $this->path_services->navigatorFactory()
181  );
182  }
183 
184  protected function linkProvider(): LinkProvider
185  {
186  if (isset($this->link_provider)) {
187  return $this->link_provider;
188  }
189  return $this->link_provider = new LinkProvider(
190  $this->editor_services->linkFactory(),
191  $this->path_services->pathFactory()
192  );
193  }
194 }
__construct(GlobalContainer $dic, PathServices $path_services, RepositoryServices $repository_services, EditorServices $editor_services, DataHelperServices $data_helper_services)
Definition: Services.php:53