You are here

private function OpignoScorm::scormExtractManifestMetadata in Opigno SCORM 8

Same name and namespace in other branches
  1. 3.x src/OpignoScorm.php \Drupal\opigno_scorm\OpignoScorm::scormExtractManifestMetadata()

Extract manifest metadata from the manifest.

Parameters

array $manifest: Manifest.

Return value

array Manifest metadata.

1 call to OpignoScorm::scormExtractManifestMetadata()
OpignoScorm::scormExtractManifestData in src/OpignoScorm.php
Extract manifest data from the manifest file.

File

src/OpignoScorm.php, line 383

Class

OpignoScorm
Class OpignoScorm.

Namespace

Drupal\opigno_scorm

Code

private function scormExtractManifestMetadata(array $manifest) {
  $metadata = [];
  foreach ($manifest['children'] as $child) {
    if ($child['name'] == 'METADATA') {
      foreach ($child['children'] as $meta) {
        if (isset($meta['tagData'])) {
          $metadata[strtolower($meta['name'])] = $meta['tagData'];
        }
      }
      if (!empty($metadata)) {
        return $metadata;
      }
    }
    else {
      if (isset($child['children'])) {
        $metadata = $this
          ->scormExtractManifestMetadata($child);
        if (!empty($metadata)) {
          return $metadata;
        }
      }
    }
  }
  return $metadata;
}