From d6792c1662a523b6df243f48d0581b996875dd97 Mon Sep 17 00:00:00 2001 From: sephster Date: Fri, 12 Oct 2018 23:05:07 +0100 Subject: [PATCH] Add scope entity trait --- src/Entities/Traits/ScopeTrait.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Entities/Traits/ScopeTrait.php diff --git a/src/Entities/Traits/ScopeTrait.php b/src/Entities/Traits/ScopeTrait.php new file mode 100644 index 00000000..a132234f --- /dev/null +++ b/src/Entities/Traits/ScopeTrait.php @@ -0,0 +1,28 @@ + + * @copyright Copyright (c) Andrew Millington + * @license http://mit-license.org + * + * @link https://github.com/thephpleague/oauth2-server + */ + +namespace League\OAuth2\Server\Entities\Traits; + +trait ScopeTrait +{ + /** + * Serialize the object to the scopes string identifier when using json_encode(). + * + * @return string + */ + public function jsonSerialize() + { + return $this->getIdentifier(); + } + + /** + * @return string + */ + abstract public function getIdentifier(); +}