Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
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) 2021 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
19 | */ |
20 | |
21 | declare(strict_types=1); |
22 | |
23 | namespace oat\taoQtiItem\model\import\Repository; |
24 | |
25 | use oat\taoQtiItem\model\import\Parser\ChoiceParser; |
26 | use oat\taoQtiItem\model\import\Parser\MetadataParser; |
27 | use oat\taoQtiItem\model\import\TemplateInterface; |
28 | use oat\taoQtiItem\model\import\Validator\Rule\OneOfRule; |
29 | |
30 | interface TemplateRepositoryInterface |
31 | { |
32 | public const DEFAULT = 'default'; |
33 | |
34 | public const DEFAULT_DEFINITION = [ |
35 | 'target' => [ |
36 | 'templatePath' => [ |
37 | 'noResponse' => 'taoQtiItem/templates/import/item_none_response.xml.tpl', |
38 | 'mapResponse' => 'taoQtiItem/templates/import/item_map_response.xml.tpl', |
39 | 'matchCorrectResponse' => 'taoQtiItem/templates/import/item_match_correct_response.xml.tpl', |
40 | ], |
41 | 'version' => '2.2', |
42 | 'standard' => 'QTI', |
43 | ], |
44 | 'columns' => [ |
45 | 'name' => [ |
46 | 'header' => 'required', |
47 | 'value' => 'required', |
48 | ], |
49 | 'question' => [ |
50 | 'header' => 'required', |
51 | 'value' => 'required|qtiXmlString', |
52 | ], |
53 | 'shuffle' => [ |
54 | 'header' => 'optional', |
55 | 'value' => 'optional|one_of:0,1,true,false:' . OneOfRule::CASE_INSENSITIVE, |
56 | 'default' => 'false', |
57 | ], |
58 | 'language' => [ |
59 | 'header' => 'optional', |
60 | 'value' => 'optional|language', |
61 | 'default' => DEFAULT_LANG, |
62 | ], |
63 | 'min_choices' => [ |
64 | 'header' => 'optional', |
65 | 'value' => 'optional|less_or_equals:max_choices|is_integer', |
66 | 'default' => 0, |
67 | ], |
68 | 'max_choices' => [ |
69 | 'header' => 'optional', |
70 | 'value' => 'optional|is_integer', |
71 | 'default' => 0, |
72 | ], |
73 | 'choice_[1-99]' => [ |
74 | 'header' => 'required|min_occurrences:2|match_header:choice_[1-99]_score', |
75 | 'value' => 'no_gaps:choice_[1-99]|min_occurrences:choice_[1-99]:2:choices', |
76 | 'parser' => ChoiceParser::class, |
77 | ], |
78 | 'choice_[1-99]_score' => [ |
79 | 'header' => 'match_header:choice_[1-99]', |
80 | 'value' => 'numeric_or_empty:choice_[1-99]_score', |
81 | ], |
82 | 'correct_answer' => [ |
83 | 'header' => 'optional', |
84 | 'value' => 'one_of_columns_or_empty:choice_[1-99]', |
85 | ], |
86 | 'metadata_[A-Za-z0-9\-_]+' => [ |
87 | 'header' => 'optional', |
88 | 'parser' => MetadataParser::class, |
89 | ], |
90 | ], |
91 | ]; |
92 | |
93 | public function findById(string $id): ?TemplateInterface; |
94 | } |