Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
| KvLTIDeliveryExecutionLink | |
0.00% |
0 / 20 |
|
0.00% |
0 / 9 |
156 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getUserId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setUserId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDeliveryExecutionId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setDeliveryExecutionId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLinkId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setLinkId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| unSerialize | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 | |||
| jsonSerialize | |
0.00% |
0 / 5 |
|
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 (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\ltiDeliveryProvider\model\execution\implementation; |
| 24 | |
| 25 | use oat\ltiDeliveryProvider\model\execution\LTIDeliveryExecutionLink; |
| 26 | |
| 27 | /** |
| 28 | * Class KvLTIDeliveryExecutionLink |
| 29 | * Key value implementation of LTIDeliveryExecutionLink |
| 30 | * @package oat\ltiDeliveryProvider\model\execution\implementation |
| 31 | */ |
| 32 | class KvLTIDeliveryExecutionLink implements LTIDeliveryExecutionLink, \JsonSerializable |
| 33 | { |
| 34 | private $userId; |
| 35 | private $deliveryExecutionId; |
| 36 | private $linkId; |
| 37 | |
| 38 | /** |
| 39 | * KvLTIDeliveryExecutionLink constructor. |
| 40 | * @param $userId |
| 41 | * @param $deliveryExecutionId |
| 42 | * @param $linkId |
| 43 | */ |
| 44 | public function __construct($userId, $deliveryExecutionId, $linkId) |
| 45 | { |
| 46 | $this->userId = $userId; |
| 47 | $this->deliveryExecutionId = $deliveryExecutionId; |
| 48 | $this->linkId = $linkId; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * @return string |
| 54 | */ |
| 55 | public function getUserId() |
| 56 | { |
| 57 | return $this->userId; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @param string $userId |
| 62 | */ |
| 63 | public function setUserId($userId) |
| 64 | { |
| 65 | $this->userId = $userId; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @return string |
| 70 | */ |
| 71 | public function getDeliveryExecutionId() |
| 72 | { |
| 73 | return $this->deliveryExecutionId; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @param string $deliveryExecutionId |
| 78 | */ |
| 79 | public function setDeliveryExecutionId($deliveryExecutionId) |
| 80 | { |
| 81 | $this->deliveryExecutionId = $deliveryExecutionId; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @return string |
| 86 | */ |
| 87 | public function getLinkId() |
| 88 | { |
| 89 | return $this->linkId; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * @param string $linkId |
| 94 | */ |
| 95 | public function setLinkId($linkId) |
| 96 | { |
| 97 | $this->linkId = $linkId; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | /** |
| 102 | * @param $values |
| 103 | * @return KvLTIDeliveryExecutionLink[] |
| 104 | */ |
| 105 | public static function unSerialize($values) |
| 106 | { |
| 107 | $links = []; |
| 108 | $data = $values !== false ? json_decode($values, true) : []; |
| 109 | |
| 110 | foreach ($data as $linkData) { |
| 111 | if (isset($linkData['userId'], $linkData['linkId'], $linkData['deliveryExecutionId'])) { |
| 112 | $links[] = new self($linkData['userId'], $linkData['deliveryExecutionId'], $linkData['linkId']); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | return $links; |
| 117 | } |
| 118 | |
| 119 | |
| 120 | public function jsonSerialize() |
| 121 | { |
| 122 | return [ |
| 123 | 'userId' => $this->getUserId(), |
| 124 | 'deliveryExecutionId' => $this->getDeliveryExecutionId(), |
| 125 | 'linkId' => $this->getLinkId(), |
| 126 | ]; |
| 127 | } |
| 128 | } |