Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ItemVariableStorable | |
0.00% |
0 / 22 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| createFromArray | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| getCallItemId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getItemIdentifier | |
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 ItemVariableStorable extends VariableStorable |
| 26 | { |
| 27 | /** @var string */ |
| 28 | private $callItemId; |
| 29 | |
| 30 | /** @var string */ |
| 31 | private $item; |
| 32 | |
| 33 | /** |
| 34 | * @param string $deliveryResultIdentifier |
| 35 | * @param string $testIdentifier |
| 36 | * @param \taoResultServer_models_classes_Variable $variable |
| 37 | * @param $item |
| 38 | * @param $callItemId |
| 39 | */ |
| 40 | public function __construct( |
| 41 | $deliveryResultIdentifier, |
| 42 | $testIdentifier, |
| 43 | \taoResultServer_models_classes_Variable $variable, |
| 44 | $item, |
| 45 | $callItemId |
| 46 | ) { |
| 47 | parent::__construct($deliveryResultIdentifier, $testIdentifier, $variable); |
| 48 | $this->item = $item; |
| 49 | $this->callItemId = $callItemId; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @param array $data |
| 54 | * @return static |
| 55 | */ |
| 56 | public static function createFromArray(array $data) |
| 57 | { |
| 58 | return new static( |
| 59 | $data['deliveryResultIdentifier'], |
| 60 | $data['test'], |
| 61 | unserialize($data['variable']), |
| 62 | $data['item'], |
| 63 | $data['callIdItem'] |
| 64 | ); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @return string |
| 69 | */ |
| 70 | public function getCallItemId() |
| 71 | { |
| 72 | return $this->callItemId; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @return string |
| 77 | */ |
| 78 | public function getItemIdentifier() |
| 79 | { |
| 80 | return $this->item; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @inheritdoc |
| 85 | */ |
| 86 | public function jsonSerialize() |
| 87 | { |
| 88 | return [ |
| 89 | "deliveryResultIdentifier" => $this->deliveryResultIdentifier, |
| 90 | "test" => $this->testIdentifier, |
| 91 | "item" => $this->item, |
| 92 | "variable" => serialize($this->variable), |
| 93 | "callIdItem" => $this->callItemId, |
| 94 | "uri" => $this->deliveryResultIdentifier . $this->callItemId, |
| 95 | "callIdTest" => null, |
| 96 | "class" => get_class($this->variable) |
| 97 | ]; |
| 98 | } |
| 99 | } |