Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| Value | |
0.00% |
0 / 14 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| getUsedAttributes | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| __toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
0.00% |
0 / 7 |
|
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) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoQtiItem\model\qti; |
| 24 | |
| 25 | /** |
| 26 | * A response is on object associated to an interactino containing which are the |
| 27 | * response into the interaction choices and the score regarding the answers |
| 28 | * |
| 29 | * @access public |
| 30 | * @author Joel Bout, <joel.bout@tudor.lu> |
| 31 | * @package taoQTI |
| 32 | * @see http://www.imsglobal.org/question/qtiv2p1/imsqti_infov2p1.html#element10042 |
| 33 | */ |
| 34 | class Value extends Element |
| 35 | { |
| 36 | protected function getUsedAttributes() |
| 37 | { |
| 38 | return [ |
| 39 | 'oat\\taoQtiItem\\model\\qti\\attribute\\BaseType', |
| 40 | 'oat\\taoQtiItem\\model\\qti\\attribute\\FieldIdentifier' |
| 41 | ]; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * the QTI tag name as defined in QTI standard |
| 46 | * |
| 47 | * @access protected |
| 48 | * @var string |
| 49 | */ |
| 50 | protected static $qtiTagName = 'value'; |
| 51 | |
| 52 | /** |
| 53 | * Element value |
| 54 | * @access protected |
| 55 | * @var string |
| 56 | */ |
| 57 | protected $value; |
| 58 | |
| 59 | public function __toString() |
| 60 | { |
| 61 | return $this->value; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Set element value |
| 66 | * @param string $value |
| 67 | */ |
| 68 | public function setValue($value) |
| 69 | { |
| 70 | $this->value = $value; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Get element value |
| 75 | * @return string |
| 76 | */ |
| 77 | public function getValue() |
| 78 | { |
| 79 | return $this->value; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Get the array representation of the Qti Element. |
| 84 | * Particularly helpful for data transformation, e.g. json |
| 85 | * |
| 86 | * @param bool $filterVariableContent |
| 87 | * @param array $filtered |
| 88 | * @return array |
| 89 | */ |
| 90 | public function toArray($filterVariableContent = false, &$filtered = []) |
| 91 | { |
| 92 | return [ |
| 93 | 'value' => $this->value, |
| 94 | 'fieldIdentifier' => (string) $this->getAttribute('fieldIdentifier'), |
| 95 | 'baseType' => (string) $this->getAttribute('baseType'), |
| 96 | // cardinality always single for value, put it here to make it compatible with the rule engine |
| 97 | 'cardinality' => 'single', |
| 98 | ]; |
| 99 | } |
| 100 | } |