Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
LomIdentifierExtractor
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
20
0.00% covered (danger)
0.00%
0 / 1
 extract
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2017 (original work) Open Assessment Technologies SA
19 *
20 */
21
22namespace oat\taoQtiItem\model\qti\metadata\imsManifest;
23
24use oat\taoQtiItem\model\qti\metadata\simple\SimpleMetadataValue;
25
26class LomIdentifierExtractor extends ImsManifestMetadataExtractor
27{
28    public function extract($manifest)
29    {
30        $values = parent::extract($manifest);
31        $newValues = [];
32
33        $expectedPath = [
34            'http://www.imsglobal.org/xsd/imsmd_v1p2#lom',
35            'http://www.imsglobal.org/xsd/imsmd_v1p2#general',
36            'http://www.imsglobal.org/xsd/imsmd_v1p2#identifier'
37        ];
38
39        foreach ($values as $resourceIdentifier => $metadataValueCollection) {
40            $classificationMetadataValue = null;
41
42            /** @var SimpleMetadataValue $metadataValue */
43            foreach ($metadataValueCollection as $metadataValue) {
44                $path = $metadataValue->getPath();
45
46                if ($path === $expectedPath) {
47                    $newValues[$resourceIdentifier][] = $metadataValue;
48                }
49            }
50        }
51
52        return $newValues;
53    }
54}