Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| TestVariableStorable | |
0.00% |
0 / 19 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| createFromArray | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| getCallTestId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| jsonSerialize | |
0.00% |
0 / 10 |
|
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) 2017 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoResultServer\models\Entity; |
| 24 | |
| 25 | class TestVariableStorable extends VariableStorable |
| 26 | { |
| 27 | /** @var string */ |
| 28 | private $callTestId; |
| 29 | |
| 30 | /** |
| 31 | * @param string $deliveryResultIdentifier |
| 32 | * @param string $testIdentifier |
| 33 | * @param \taoResultServer_models_classes_Variable $variable |
| 34 | * @param $callTestId |
| 35 | */ |
| 36 | public function __construct( |
| 37 | $deliveryResultIdentifier, |
| 38 | $testIdentifier, |
| 39 | \taoResultServer_models_classes_Variable $variable, |
| 40 | $callTestId |
| 41 | ) { |
| 42 | parent::__construct($deliveryResultIdentifier, $testIdentifier, $variable); |
| 43 | |
| 44 | $this->callTestId = $callTestId; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @param array $data |
| 49 | * @return static |
| 50 | */ |
| 51 | public static function createFromArray(array $data) |
| 52 | { |
| 53 | return new static( |
| 54 | $data['deliveryResultIdentifier'], |
| 55 | $data['test'], |
| 56 | unserialize($data['variable']), |
| 57 | $data['callIdTest'] |
| 58 | ); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return string |
| 63 | */ |
| 64 | public function getCallTestId() |
| 65 | { |
| 66 | return $this->callTestId; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @return array |
| 71 | */ |
| 72 | public function jsonSerialize() |
| 73 | { |
| 74 | return [ |
| 75 | "deliveryResultIdentifier" => $this->deliveryResultIdentifier, |
| 76 | "test" => $this->testIdentifier, |
| 77 | "item" => null, |
| 78 | "variable" => serialize($this->variable), |
| 79 | "callIdItem" => null, |
| 80 | "uri" => $this->deliveryResultIdentifier . $this->callTestId, |
| 81 | "callIdTest" => $this->callTestId, |
| 82 | "class" => get_class($this->variable) |
| 83 | ]; |
| 84 | } |
| 85 | } |