From 21c869a06af8601caa69c58e1633b896a919b2b2 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 6 Apr 2018 11:37:45 +0200 Subject: [PATCH] adding app/library/OAuth/UserData classes (interface and Github implementation) --- app/library/OAuth/UserData/Github.php | 56 +++++++++++++++++++ .../OAuth/UserData/UserDataInterface.php | 43 ++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 app/library/OAuth/UserData/Github.php create mode 100644 app/library/OAuth/UserData/UserDataInterface.php diff --git a/app/library/OAuth/UserData/Github.php b/app/library/OAuth/UserData/Github.php new file mode 100644 index 0000000..d8b4d13 --- /dev/null +++ b/app/library/OAuth/UserData/Github.php @@ -0,0 +1,56 @@ +data = $data; + } + + /** + * {@inheritDoc} + */ + public function getProvider() + { + return 'Github'; + } + + /** + * {@inheritDoc} + */ + public function getId() + { + return (int) $this->data['id']; + } + + /** + * {@inheritDoc} + */ + public function getUsername() + { + return $this->data['login']; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return $this->data['name']; + } + + /** + * {@inheritDoc} + */ + public function getEmail() + { + return $this->data['email']; + } +} diff --git a/app/library/OAuth/UserData/UserDataInterface.php b/app/library/OAuth/UserData/UserDataInterface.php new file mode 100644 index 0000000..cf489a3 --- /dev/null +++ b/app/library/OAuth/UserData/UserDataInterface.php @@ -0,0 +1,43 @@ +