19 declare(strict_types=1);
52 $set = $this->scaffold_provider->set();
55 if (!empty($xml->Lifecycle)) {
58 if (!empty($xml->{
'Meta-Metadata'})) {
61 if (!empty($xml->Technical)) {
64 if (!empty($xml->Educational)) {
67 if (!empty($xml->Rights)) {
70 foreach ($xml->Relation as $relation_xml) {
73 foreach ($xml->Annotation as $annotation_xml) {
76 foreach ($xml->Classification as $classification_xml) {
89 foreach ($xml->Identifier as $identifier_xml) {
95 foreach ($xml->Language as $language_xml) {
99 foreach ($xml->Description as $description_xml) {
103 foreach ($xml->Keyword as $keyword_xml) {
107 if (!empty($xml->Coverage)) {
113 (
string) $xml->attributes()->Structure,
128 (
string) $xml->attributes()->status,
132 foreach ($xml->Contribute as $contribute_xml) {
143 foreach ($xml->Identifier as $identifier_xml) {
147 foreach ($xml->Contribute as $contribute_xml) {
153 if (!empty($xml->attributes()->Language)) {
164 foreach ($xml->Format as $format_xml) {
168 if (!empty($xml->Size)) {
172 foreach ($xml->Location as $location_xml) {
176 foreach ($xml->Requirement as $requirement_xml) {
179 foreach ($xml->OrComposite as $or_composite_xml) {
180 foreach ($or_composite_xml->Requirement as $requirement_xml) {
185 if (!empty($xml->InstallationRemarks)) {
187 'installationRemarks',
189 $xml->InstallationRemarks
193 if (!empty($xml->OtherPlatformRequirements)) {
195 'otherPlatformRequirements',
197 $xml->OtherPlatformRequirements
201 if (!empty($xml->Duration)) {
215 (
string) $xml->attributes()->InteractivityType,
220 'learningResourceType',
221 (
string) $xml->attributes()->LearningResourceType,
226 'interactivityLevel',
227 (
string) $xml->attributes()->InteractivityLevel,
233 (
string) $xml->attributes()->SemanticDensity,
238 'intendedEndUserRole',
239 (
string) $xml->attributes()->IntendedEndUserRole,
245 (
string) $xml->attributes()->Context,
249 foreach ($xml->TypicalAgeRange as $tar_xml) {
255 (
string) $xml->attributes()->Difficulty,
259 if (!empty($xml->TypicalLearningTime)) {
264 foreach ($xml->Description as $description_xml) {
268 foreach ($xml->Language as $language_xml) {
281 (
string) $xml->attributes()->Cost,
286 'copyrightAndOtherRestrictions',
287 (
string) $xml->attributes()->CopyrightAndOtherRestrictions,
293 $description_scaffold,
295 (
string) $xml->Description->attributes()->Language
297 $description_string = $this->copyright_handler->copyrightFromExport((
string) $xml->Description);
298 if ($description_string !==
'') {
311 (
string) $xml->attributes()->Kind,
317 $resource_xml = $xml->Resource;
319 foreach ($resource_xml->Identifier_ as $identifier_xml) {
323 foreach ($resource_xml->Description as $description_xml) {
350 (
string) $xml->attributes()->Purpose,
354 foreach ($xml->TaxonPath as $taxon_path_xml) {
359 foreach ($taxon_path_xml->taxon as $taxon_xml) {
362 if (!empty($taxon_xml->attributes()->Id)) {
376 foreach ($xml->Keyword as $keyword_xml) {
387 foreach ($xml->Type->OperatingSystem as $os_xml) {
391 $name = (string) $os_xml->attributes()->Name;
392 if ($name ===
'MacOS') {
401 $min_version = (string) ($os_xml->attributes()->MinimumVersion ??
'');
402 $max_version = (string) ($os_xml->attributes()->MaximumVersion ??
'');
403 if ($min_version !==
'') {
406 if ($max_version !==
'') {
411 foreach ($xml->Type->Browser as $browser_xml) {
415 $name = (string) $browser_xml->attributes()->Name;
416 if ($name !==
'Mozilla') {
419 strtolower((
string) $browser_xml->attributes()->Name),
424 $min_version = (string) ($browser_xml->attributes()->MinimumVersion ??
'');
425 $max_version = (string) ($browser_xml->attributes()->MaximumVersion ??
'');
426 if ($min_version !==
'') {
429 if ($max_version !==
'') {
440 $language = (string) $xml->attributes()->Language;
441 $string = (string) $xml;
445 if ($string !==
'') {
454 bool $fill_spaces_in_value =
false 467 $catalog = (string) ($xml->attributes()->Catalog ??
'');
468 $entry = (string) ($xml->attributes()->Entry ??
'');
471 if ($catalog !==
'') {
483 $role = (string) ($xml->attributes()->Role ??
'');
484 $date = (string) $xml->Date;
486 $scaffold = $this->addScaffoldAndMark($element,
'contribute');
488 foreach ($xml->Entity as $entity_xml) {
503 $scaffold->mark($this->marker_factory, Action::CREATE_OR_UPDATE, strip_tags($value));
512 $value = str_replace(
' ',
'', $value);
520 $string = preg_replace(
'/(?<=[a-z])(?=[A-Z])/',
' ', $string);
521 return strtolower($string);