Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Template | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 1 |
| createByTemplate | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
30 | |||
| 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) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoQtiItem\model\qti\response\interactionResponseProcessing; |
| 24 | |
| 25 | use oat\taoQtiItem\model\qti\ResponseDeclaration; |
| 26 | use oat\taoQtiItem\model\qti\Item; |
| 27 | use oat\taoQtiItem\model\qti\response\Template as ResponseTemplate; |
| 28 | use oat\taoQtiItem\model\qti\exception\ParsingException; |
| 29 | |
| 30 | /** |
| 31 | * Short description of class |
| 32 | * |
| 33 | * @abstract |
| 34 | * @access public |
| 35 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 36 | * @package taoQTI |
| 37 | |
| 38 | */ |
| 39 | abstract class Template extends InteractionResponseProcessing |
| 40 | { |
| 41 | // --- ASSOCIATIONS --- |
| 42 | |
| 43 | |
| 44 | // --- ATTRIBUTES --- |
| 45 | |
| 46 | // --- OPERATIONS --- |
| 47 | |
| 48 | /** |
| 49 | * Short description of method createByTemplate |
| 50 | * |
| 51 | * @access public |
| 52 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 53 | * @param string templateUri |
| 54 | * @param Response response |
| 55 | * @param Item item |
| 56 | * @return oat\taoQtiItem\model\qti\response\interactionResponseProcessing\InteractionResponseProcessing |
| 57 | */ |
| 58 | public static function createByTemplate($templateUri, ResponseDeclaration $response, Item $item) |
| 59 | { |
| 60 | $returnValue = null; |
| 61 | |
| 62 | |
| 63 | switch ($templateUri) { |
| 64 | case ResponseTemplate::MATCH_CORRECT: |
| 65 | $returnValue = self::create(MatchCorrectTemplate::CLASS_ID, $response, $item); |
| 66 | break; |
| 67 | case ResponseTemplate::MAP_RESPONSE: |
| 68 | $returnValue = self::create(MapResponseTemplate::CLASS_ID, $response, $item); |
| 69 | break; |
| 70 | case ResponseTemplate::MAP_RESPONSE_POINT: |
| 71 | $returnValue = self::create(MapResponsePointTemplate::CLASS_ID, $response, $item); |
| 72 | break; |
| 73 | default: |
| 74 | throw new ParsingException( |
| 75 | 'Cannot create interactionResponseProcessing for unknown Template ' . $templateUri |
| 76 | ); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | return $returnValue; |
| 81 | } |
| 82 | } |