Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ItemUpdatedEvent | |
0.00% |
0 / 9 |
|
0.00% |
0 / 5 |
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 | |||
| getData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getItemUri | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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\taoItems\model\event; |
| 23 | |
| 24 | use JsonSerializable; |
| 25 | use oat\oatbox\event\Event; |
| 26 | |
| 27 | class ItemUpdatedEvent implements Event, JsonSerializable |
| 28 | { |
| 29 | /** @var string */ |
| 30 | protected $itemUri; |
| 31 | |
| 32 | /** |
| 33 | * @var |
| 34 | */ |
| 35 | private $data; |
| 36 | |
| 37 | /** |
| 38 | * @param String $itemUri |
| 39 | */ |
| 40 | public function __construct($itemUri, $data = null) |
| 41 | { |
| 42 | $this->itemUri = $itemUri; |
| 43 | $this->data = $data; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | * Return a unique name for this event |
| 49 | * @see \oat\oatbox\event\Event::getName() |
| 50 | */ |
| 51 | public function getName() |
| 52 | { |
| 53 | return get_class($this); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * event data getter |
| 58 | * @return array |
| 59 | */ |
| 60 | public function getData() |
| 61 | { |
| 62 | return $this->data; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * event item URI getter |
| 67 | * @return string |
| 68 | */ |
| 69 | public function getItemUri() |
| 70 | { |
| 71 | return $this->itemUri; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Specify data which should be serialized to JSON |
| 76 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
| 77 | * @return mixed data which can be serialized by <b>json_encode</b>, |
| 78 | * which is a value of any type other than a resource. |
| 79 | * @since 5.4.0 |
| 80 | */ |
| 81 | public function jsonSerialize() |
| 82 | { |
| 83 | return [ |
| 84 | 'itemUri' => $this->itemUri, |
| 85 | 'data' => $this->data |
| 86 | ]; |
| 87 | } |
| 88 | } |