Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| DeliveryUpdatedEvent | |
0.00% |
0 / 8 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPropertyValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| jsonSerialize | |
0.00% |
0 / 4 |
|
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) 2016 (original work) Open Assessment Technologies SA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\taoDeliveryRdf\model\event; |
| 23 | |
| 24 | use JsonSerializable; |
| 25 | use oat\oatbox\event\Event; |
| 26 | |
| 27 | class DeliveryUpdatedEvent extends AbstractDeliveryEvent |
| 28 | { |
| 29 | /** |
| 30 | * @var |
| 31 | */ |
| 32 | private $data; |
| 33 | |
| 34 | /** |
| 35 | * @param String $deliveryUri |
| 36 | * @param $data |
| 37 | */ |
| 38 | public function __construct($deliveryUri, $data) |
| 39 | { |
| 40 | $this->deliveryUri = $deliveryUri; |
| 41 | $this->data = $data; |
| 42 | } |
| 43 | |
| 44 | |
| 45 | /** |
| 46 | * Return a unique name for this event |
| 47 | * @see \oat\oatbox\event\Event::getName() |
| 48 | */ |
| 49 | public function getName() |
| 50 | { |
| 51 | return get_class($this); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Get the new values for the specified property |
| 56 | * |
| 57 | * @param string $propertyUri |
| 58 | * @return aarray |
| 59 | */ |
| 60 | public function getPropertyValue($propertyUri) |
| 61 | { |
| 62 | return isset($this->data) ? $this->data[$propertyUri] : []; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Specify data which should be serialized to JSON |
| 67 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
| 68 | * @return mixed data which can be serialized by <b>json_encode</b>, |
| 69 | * which is a value of any type other than a resource. |
| 70 | * @since 5.4.0 |
| 71 | */ |
| 72 | public function jsonSerialize() |
| 73 | { |
| 74 | return [ |
| 75 | 'delivery' => $this->deliveryUri, |
| 76 | 'data' => $this->data |
| 77 | ]; |
| 78 | } |
| 79 | } |