Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
17 / 17 |
|
100.00% |
9 / 9 |
CRAP | |
100.00% |
1 / 1 |
| taoResultServer_models_classes_OutcomeVariable | |
100.00% |
17 / 17 |
|
100.00% |
9 / 9 |
9 | |
100.00% |
1 / 1 |
| setNormalMaximum | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getNormalMaximum | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setNormalMinimum | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getNormalMinimum | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setEncodedValue | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| getType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; under version 2 |
| 9 | * of the License (non-upgradable). |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | * |
| 20 | * Copyright (c) 2013 (original work) Open Assessment Technologies S.A. |
| 21 | * |
| 22 | * @author "Patrick Plichart, <patrick@taotesting.com>" |
| 23 | * |
| 24 | * An Assessment Result is used to report the results of a candidate's interaction |
| 25 | * with a test and/or one or more items attempted. Information about the test is optional, |
| 26 | * in some systems it may be possible to interact with items that are not organized into |
| 27 | * a test at all. For example, items that are organized with learning resources and |
| 28 | * presented individually in a formative context. |
| 29 | */ |
| 30 | class taoResultServer_models_classes_OutcomeVariable extends taoResultServer_models_classes_Variable |
| 31 | { |
| 32 | public const TYPE = 'outcomeVariable'; |
| 33 | |
| 34 | /** |
| 35 | * taken from the corresponding outcomeDeclaration. |
| 36 | * |
| 37 | * @var float|null |
| 38 | */ |
| 39 | protected $normalMaximum; |
| 40 | |
| 41 | /** @var float|null */ |
| 42 | protected $normalMinimum; |
| 43 | |
| 44 | /** |
| 45 | * The value(s) of the outcome variable. |
| 46 | * The order of the values is significant only if the outcome was declared with ordered cardinality. |
| 47 | * |
| 48 | * @var string|null base64 encoded |
| 49 | */ |
| 50 | protected $value; |
| 51 | |
| 52 | public function setNormalMaximum(?float $normalMaximum): self |
| 53 | { |
| 54 | $this->normalMaximum = $normalMaximum; |
| 55 | |
| 56 | return $this; |
| 57 | } |
| 58 | |
| 59 | public function getNormalMaximum(): ?float |
| 60 | { |
| 61 | return $this->normalMaximum; |
| 62 | } |
| 63 | |
| 64 | public function setNormalMinimum(?float $normalMinimum): self |
| 65 | { |
| 66 | $this->normalMinimum = $normalMinimum; |
| 67 | |
| 68 | return $this; |
| 69 | } |
| 70 | |
| 71 | public function getNormalMinimum(): ?float |
| 72 | { |
| 73 | return $this->normalMinimum; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * {@inheritdoc} |
| 78 | */ |
| 79 | public function getValue() |
| 80 | { |
| 81 | return base64_decode((string)$this->value); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * {@inheritdoc} |
| 86 | */ |
| 87 | public function setValue($value): self |
| 88 | { |
| 89 | return $this->setEncodedValue(base64_encode((string)$value)); |
| 90 | } |
| 91 | |
| 92 | public function setEncodedValue($encodedValue): self |
| 93 | { |
| 94 | $this->value = $encodedValue; |
| 95 | |
| 96 | return $this; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * {@inheritdoc} |
| 101 | */ |
| 102 | public function jsonSerialize() |
| 103 | { |
| 104 | return parent::jsonSerialize() + |
| 105 | [ |
| 106 | 'normalMinimum' => $this->normalMinimum, |
| 107 | 'normalMaximum' => $this->normalMaximum, |
| 108 | 'value' => $this->value, |
| 109 | ]; |
| 110 | } |
| 111 | |
| 112 | protected function getType(): string |
| 113 | { |
| 114 | return self::TYPE; |
| 115 | } |
| 116 | } |