Fix json serializable

This commit is contained in:
Dennis Eichhorn 2016-07-07 18:48:52 +02:00
parent 5d1e7429de
commit 9dde2dfa72
3 changed files with 7 additions and 11 deletions

View File

@ -15,8 +15,6 @@
*/ */
namespace phpOMS\Datatypes; namespace phpOMS\Datatypes;
use phpOMS\Contract\JsonableInterface;
/** /**
* Address class. * Address class.
* *
@ -28,7 +26,7 @@ use phpOMS\Contract\JsonableInterface;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Address implements JsonableInterface class Address implements \JsonSerializable
{ {
/** /**
@ -161,7 +159,7 @@ class Address implements JsonableInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function toJson(int $option = 0) : string public function jsonSerialize(int $option = 0) : string
{ {
return json_encode($this->toArray()); return json_encode($this->toArray());
} }

View File

@ -15,8 +15,6 @@
*/ */
namespace phpOMS\Datatypes; namespace phpOMS\Datatypes;
use phpOMS\Contract\JsonableInterface;
/** /**
* Location class. * Location class.
* *
@ -28,7 +26,7 @@ use phpOMS\Contract\JsonableInterface;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
class Location implements JsonableInterface, \Serializable class Location implements \JsonSerializable, \Serializable
{ {
/** /**
@ -251,7 +249,7 @@ class Location implements JsonableInterface, \Serializable
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function toJson(int $option = 0) : string public function jsonSerialize() : string
{ {
return json_encode($this->toArray()); return json_encode($this->toArray());
} }
@ -264,7 +262,7 @@ class Location implements JsonableInterface, \Serializable
*/ */
public function serialize() public function serialize()
{ {
return $this->toJson(); return $this->jsonSerialize();
} }
/** /**

View File

@ -29,7 +29,7 @@ use phpOMS\Utils\ArrayUtils;
* @link http://orange-management.com * @link http://orange-management.com
* @since 1.0.0 * @since 1.0.0
*/ */
abstract class ResponseAbstract implements MessageInterface abstract class ResponseAbstract implements MessageInterface, \JsonSerializable
{ {
/** /**
@ -150,7 +150,7 @@ abstract class ResponseAbstract implements MessageInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function toJson(int $options = 0) : string public function jsonSerialize(int $options = 0) : string
{ {
return json_encode($this->toArray()); return json_encode($this->toArray());
} }