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
PciModel
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) 2016 (original work) Open Assessment Technologies SA;
19 *
20 */
21
22namespace oat\qtiItemPci\model;
23
24use oat\oatbox\service\ServiceManager;
25use oat\qtiItemPci\model\portableElement\dataObject\PciDataObject;
26use oat\qtiItemPci\model\portableElement\parser\PciDirectoryParser;
27use oat\qtiItemPci\model\portableElement\parser\PciPackagerParser;
28use oat\qtiItemPci\model\portableElement\storage\PciRegistry;
29use oat\qtiItemPci\model\portableElement\validator\PciValidator;
30use oat\taoQtiItem\model\portableElement\storage\PortableElementRegistry;
31use oat\taoQtiItem\model\portableElement\model\PortableElementModel;
32use oat\oatbox\PhpSerializeStateless;
33use oat\qtiItemPci\model\portableElement\export\OatPciExporter;
34use oat\taoQtiItem\model\Export\AbstractQTIItemExporter;
35use oat\taoQtiItem\model\portableElement\element\PortableElementObject;
36
37class PciModel implements PortableElementModel
38{
39    use PhpSerializeStateless;
40
41    public const PCI_IDENTIFIER = 'PCI';
42
43    public const PCI_LABEL = 'OAT PCI';
44
45    public const PCI_MANIFEST = 'pciCreator.json';
46
47    public const PCI_ENGINE = 'pciCreator.js';
48
49    public const PCI_NAMESPACE = 'http://www.imsglobal.org/xsd/portableCustomInteraction';
50
51    public function getId()
52    {
53        return self::PCI_IDENTIFIER;
54    }
55
56    public function getLabel()
57    {
58        return self::PCI_LABEL;
59    }
60
61    public function getNamespace()
62    {
63        return self::PCI_NAMESPACE;
64    }
65
66    public function getDefinitionFiles()
67    {
68        return [
69            self::PCI_MANIFEST,
70            self::PCI_ENGINE
71        ];
72    }
73
74    public function getManifestName()
75    {
76        return self::PCI_MANIFEST;
77    }
78
79    public function createDataObject(array $data)
80    {
81        $object = (new PciDataObject())->exchangeArray($data);
82        $object->setModel($this);
83        return $object;
84    }
85
86    public function getRegistry()
87    {
88        /** @var PortableElementRegistry $registry */
89        $registry = PciRegistry::getRegistry($this);
90        $registry->setServiceLocator(ServiceManager::getServiceManager());
91        $registry->setModel($this);
92        return $registry;
93    }
94
95    public function getValidator()
96    {
97        return new PciValidator();
98    }
99
100    public function getDirectoryParser()
101    {
102        $directoryParser = new PciDirectoryParser();
103        $directoryParser->setModel($this);
104        return $directoryParser;
105    }
106
107    public function getPackageParser()
108    {
109        $packageParser = new PciPackagerParser();
110        $packageParser->setModel($this);
111        return $packageParser;
112    }
113
114    public function getExporter(PortableElementObject $dataObject, AbstractQTIItemExporter $qtiItemExporter)
115    {
116        return new OatPciExporter($dataObject, $qtiItemExporter);
117    }
118
119    public function getQtiElementClassName()
120    {
121        return 'oat\taoQtiItem\model\qti\interaction\PortableCustomInteraction';
122    }
123}