Code cleanup

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-09-06 22:07:27 +02:00
parent f686b1e75b
commit 56f9b5b6e6
5 changed files with 135 additions and 90 deletions

View File

@@ -24,7 +24,7 @@
namespace OCA\Deck\Activity;
class ChangeSet {
class ChangeSet implements \JsonSerializable {
private $before;
private $after;
@@ -70,4 +70,21 @@ class ChangeSet {
public function getAfter() {
return $this->after;
}
/**
* Specify data which should be serialized to JSON
*
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize() {
return [
'before' => $this->getBefore(),
'after' => $this->getAfter(),
'diff' => $this->getDiff(),
'type' => get_class($this->before)
];
}
}