Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 12
CRAP
0.00% covered (danger)
0.00%
0 / 1
IMSPciModel
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 12
156
0.00% covered (danger)
0.00%
0 / 1
 getId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getLabel
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getNamespace
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDefinitionFiles
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getManifestName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 createDataObject
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getRegistry
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getValidator
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDirectoryParser
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getPackageParser
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getExporter
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getQtiElementClassName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
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\qtiItemPci\model;
23
24use oat\oatbox\service\ServiceManager;
25use oat\oatbox\PhpSerializeStateless;
26use oat\qtiItemPci\model\portableElement\dataObject\IMSPciDataObject;
27use oat\qtiItemPci\model\portableElement\parser\PciDirectoryParser;
28use oat\qtiItemPci\model\portableElement\parser\PciPackagerParser;
29use oat\qtiItemPci\model\portableElement\storage\IMSPciRegistry;
30use oat\qtiItemPci\model\portableElement\validator\IMSPciValidator;
31use oat\taoQtiItem\model\portableElement\model\PortableElementModel;
32use oat\qtiItemPci\model\portableElement\export\ImsPciExporter;
33use oat\taoQtiItem\model\Export\AbstractQTIItemExporter;
34use oat\taoQtiItem\model\portableElement\element\PortableElementObject;
35
36class IMSPciModel implements PortableElementModel
37{
38    use PhpSerializeStateless;
39
40    public const PCI_IDENTIFIER = 'IMSPCI';
41
42    public const PCI_LABEL = 'IMS PCI';
43
44    public const PCI_MANIFEST = 'imsPciCreator.json';
45
46    public const PCI_ENGINE = 'imsPciCreator.js';
47
48    public const PCI_NAMESPACE = 'http://www.imsglobal.org/xsd/portableCustomInteraction_v1';
49
50    public function getId()
51    {
52        return self::PCI_IDENTIFIER;
53    }
54
55    public function getLabel()
56    {
57        return self::PCI_LABEL;
58    }
59
60    public function getNamespace()
61    {
62        return self::PCI_NAMESPACE;
63    }
64
65    public function getDefinitionFiles()
66    {
67        return [
68            self::PCI_MANIFEST,
69            self::PCI_ENGINE
70        ];
71    }
72
73    public function getManifestName()
74    {
75        return self::PCI_MANIFEST;
76    }
77
78    public function createDataObject(array $data)
79    {
80        $object = (new IMSPciDataObject())->exchangeArray($data);
81        $object->setModel($this);
82        return $object;
83    }
84
85    public function getRegistry()
86    {
87        /** @var IMSPciRegistry $registry */
88        $registry = IMSPciRegistry::getRegistry($this);
89        $registry->setServiceLocator(ServiceManager::getServiceManager());
90        $registry->setModel($this);
91        return $registry;
92    }
93
94    public function getValidator()
95    {
96        return new IMSPciValidator();
97    }
98
99    public function getDirectoryParser()
100    {
101        $directoryParser = new PciDirectoryParser();
102        $directoryParser->setModel($this);
103        return $directoryParser;
104    }
105
106    public function getPackageParser()
107    {
108        $packageParser = new PciPackagerParser();
109        $packageParser->setModel($this);
110        return $packageParser;
111    }
112
113    public function getExporter(PortableElementObject $dataObject, AbstractQTIItemExporter $qtiItemExporter)
114    {
115        return new ImsPciExporter($dataObject, $qtiItemExporter);
116    }
117
118    public function getQtiElementClassName()
119    {
120        return 'oat\taoQtiItem\model\qti\interaction\ImsPortableCustomInteraction';
121    }
122}