ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
PathCollection.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
29 {
31 
32  protected PathInterface $title;
46 
47  public function __construct(
48  PathFactory $path_factory
49  ) {
50  $this->path_factory = $path_factory;
51  $this->init();
52  }
53 
54  protected function init(): void
55  {
56  $this->title = $this->path_factory
57  ->custom()
58  ->withNextStep('general')
59  ->withNextStep('title')
60  ->withNextStep('string')
61  ->get();
62  $this->descriptions = $this->path_factory
63  ->custom()
64  ->withNextStep('general')
65  ->withNextStep('description')
66  ->withNextStep('string')
67  ->get();
68  $this->languages = $this->path_factory
69  ->custom()
70  ->withNextStep('general')
71  ->withNextStep('language')
72  ->get();
73  $this->keywords = $this->path_factory
74  ->custom()
75  ->withNextStep('general')
76  ->withNextStep('keyword')
77  ->withNextStep('string')
78  ->get();
79 
80  $first_type_builder = $this->path_factory
81  ->custom()
82  ->withNextStep('educational')
83  ->withNextStep('learningResourceType')
84  ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, '0');
85 
86  $this->first_learning_resource_type = $first_type_builder
87  ->withNextStep('value')
88  ->get();
89 
90  $this->first_learning_resource_type_source = $first_type_builder
91  ->withNextStep('source')
92  ->get();
93 
94  $this->first_discipline = $this->path_factory
95  ->custom()
96  ->withNextStep('classification')
97  ->withNextStep('purpose')
98  ->withNextStep('value')
99  ->withAdditionalFilterAtCurrentStep(FilterType::DATA, 'discipline')
100  ->withNextStepToSuperElement()
101  ->withNextStep('source')
102  ->withAdditionalFilterAtCurrentStep(FilterType::DATA, 'LOMv1.0')
103  ->withNextStepToSuperElement()
104  ->withNextStepToSuperElement()
105  ->withNextStep('taxonPath')
106  ->withNextStep('taxon')
107  ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, '0')
108  ->withNextStep('entry')
109  ->withNextStep('string')
110  ->get();
111 
112  $this->first_author = $this->authorWithIndex(0);
113  $this->second_author = $this->authorWithIndex(1);
114  $this->third_author = $this->authorWithIndex(2);
115 
116  $this->first_publisher = $this->path_factory
117  ->custom()
118  ->withNextStep('lifeCycle')
119  ->withNextStep('contribute')
120  ->withNextStep('role')
121  ->withNextStep('value')
122  ->withAdditionalFilterAtCurrentStep(FilterType::DATA, 'publisher')
123  ->withNextStepToSuperElement()
124  ->withNextStep('source')
125  ->withAdditionalFilterAtCurrentStep(FilterType::DATA, 'LOMv1.0')
126  ->withNextStepToSuperElement()
127  ->withNextStepToSuperElement()
128  ->withNextStep('entity')
129  ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, '0')
130  ->get();
131 
132  $this->copyright = $this->path_factory
133  ->custom()
134  ->withNextStep('rights')
135  ->withNextStep('description')
136  ->withNextStep('string')
137  ->get();
138  $this->has_copyright = $this->path_factory
139  ->custom()
140  ->withNextStep('rights')
141  ->withNextStep('copyrightAndOtherRestrictions')
142  ->withNextStep('value')
143  ->get();
144  $this->has_copyright_source = $this->path_factory
145  ->custom()
146  ->withNextStep('rights')
147  ->withNextStep('copyrightAndOtherRestrictions')
148  ->withNextStep('source')
149  ->get();
150  }
151 
152  public function title(): PathInterface
153  {
154  return $this->title;
155  }
156 
157  public function descriptions(): PathInterface
158  {
159  return $this->descriptions;
160  }
161 
162  public function languages(): PathInterface
163  {
164  return $this->languages;
165  }
166 
167  public function keywords(): PathInterface
168  {
169  return $this->keywords;
170  }
171 
172  public function keywordsBetweenIndices(
173  int $first_index,
174  int $last_index
175  ): PathInterface {
176  $indices = [];
177  for ($i = $first_index; $i <= $last_index; $i++) {
178  $indices[] = (string) $i;
179  }
180 
181  return $this->path_factory
182  ->custom()
183  ->withNextStep('general')
184  ->withNextStep('keyword')
185  ->withNextStep('string')
186  ->withNextStepToSuperElement()
187  ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, ...$indices)
188  ->get();
189  }
190 
192  {
194  }
195 
197  {
199  }
200 
201  public function firstDiscipline(): PathInterface
202  {
204  }
205 
206  public function firstAuthor(): PathInterface
207  {
208  return $this->first_author;
209  }
210 
211  public function secondAuthor(): PathInterface
212  {
213  return $this->second_author;
214  }
215 
216  public function thirdAuthor(): PathInterface
217  {
218  return $this->third_author;
219  }
220 
221  protected function authorWithIndex(int $index): PathInterface
222  {
223  return $this->path_factory
224  ->custom()
225  ->withNextStep('lifeCycle')
226  ->withNextStep('contribute')
227  ->withNextStep('role')
228  ->withNextStep('value')
229  ->withAdditionalFilterAtCurrentStep(FilterType::DATA, 'author')
230  ->withNextStepToSuperElement()
231  ->withNextStep('source')
232  ->withAdditionalFilterAtCurrentStep(FilterType::DATA, 'LOMv1.0')
233  ->withNextStepToSuperElement()
234  ->withNextStepToSuperElement()
235  ->withNextStep('entity')
236  ->withAdditionalFilterAtCurrentStep(FilterType::INDEX, (string) $index)
237  ->get();
238  }
239 
240  public function firstPublisher(): PathInterface
241  {
242  return $this->first_publisher;
243  }
244 
245  public function copyright(): PathInterface
246  {
247  return $this->copyright;
248  }
249 
250  public function hasCopyright(): PathInterface
251  {
252  return $this->has_copyright;
253  }
254 
256  {
258  }
259 }
keywordsBetweenIndices(int $first_index, int $last_index)
FilterType
Values should always be all lowercase.
Definition: FilterType.php:26