ServerStub.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace League\OAuth1\Client\Tests;
  3. use League\OAuth1\Client\Credentials\TokenCredentials;
  4. use League\OAuth1\Client\Server\Server;
  5. use League\OAuth1\Client\Server\User;
  6. class ServerStub extends Server
  7. {
  8. /**
  9. * @inheritDoc
  10. */
  11. public function urlTemporaryCredentials()
  12. {
  13. return 'http://www.example.com/temporary';
  14. }
  15. /**
  16. * @inheritDoc
  17. */
  18. public function urlAuthorization()
  19. {
  20. return 'http://www.example.com/authorize';
  21. }
  22. /**
  23. * @inheritDoc
  24. */
  25. public function urlTokenCredentials()
  26. {
  27. return 'http://www.example.com/token';
  28. }
  29. /**
  30. * @inheritDoc
  31. */
  32. public function urlUserDetails()
  33. {
  34. return 'http://www.example.com/user';
  35. }
  36. /**
  37. * @inheritDoc
  38. */
  39. public function userDetails($data, TokenCredentials $tokenCredentials)
  40. {
  41. $user = new User;
  42. $user->firstName = $data['foo'];
  43. return $user;
  44. }
  45. /**
  46. * @inheritDoc
  47. */
  48. public function userUid($data, TokenCredentials $tokenCredentials)
  49. {
  50. return isset($data['id']) ? $data['id'] : null;
  51. }
  52. /**
  53. * @inheritDoc
  54. */
  55. public function userEmail($data, TokenCredentials $tokenCredentials)
  56. {
  57. return isset($data['contact_email']) ? $data['contact_email'] : null;
  58. }
  59. /**
  60. * @inheritDoc
  61. */
  62. public function userScreenName($data, TokenCredentials $tokenCredentials)
  63. {
  64. return isset($data['username']) ? $data['username'] : null;
  65. }
  66. }