| 1 | <?php namespace Stevenmaguire\OAuth2\Client\Provider; |
||
| 5 | class MicrosoftResourceOwner implements ResourceOwnerInterface |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Raw response |
||
| 9 | * |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $response; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Creates new resource owner. |
||
| 16 | * |
||
| 17 | * @param array $response |
||
| 18 | */ |
||
| 19 | public function __construct(array $response = array()) |
||
| 20 | { |
||
| 21 | $this->response = $response; |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Get user id |
||
| 26 | * |
||
| 27 | * @return string|null |
||
| 28 | */ |
||
| 29 | public function getId() |
||
| 30 | { |
||
| 31 | return $this->response['id'] ?: null; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Get user email |
||
| 36 | * |
||
| 37 | * @return string|null |
||
| 38 | */ |
||
| 39 | public function getEmail() |
||
| 40 | { |
||
| 41 | return $this->response['mail'] ?: null; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Get user principal name |
||
| 46 | * |
||
| 47 | * @return string|null |
||
| 48 | */ |
||
| 49 | public function getPrincipalName() |
||
| 50 | { |
||
| 51 | return $this->response['userPrincipalName'] ?: null; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get user firstname |
||
| 56 | * |
||
| 57 | * @return string|null |
||
| 58 | */ |
||
| 59 | public function getFirstname() |
||
| 60 | { |
||
| 61 | return $this->response['givenName'] ?: null; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Get user lastname |
||
| 66 | * |
||
| 67 | * @return string|null |
||
| 68 | */ |
||
| 69 | public function getLastname() |
||
| 70 | { |
||
| 71 | return $this->response['surname'] ?: null; |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Get user name |
||
| 76 | * |
||
| 77 | * @return string|null |
||
| 78 | */ |
||
| 79 | public function getName() |
||
| 80 | { |
||
| 81 | return $this->response['displayName'] ?: null; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @deprecated To be removed in 3.0 |
||
| 86 | * |
||
| 87 | * Get user urls |
||
| 88 | * |
||
| 89 | * @return string|null |
||
| 90 | */ |
||
| 91 | public function getUrls() |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Return all of the owner details available as an array. |
||
| 98 | * |
||
| 99 | * @return array |
||
| 100 | */ |
||
| 101 | public function toArray() |
||
| 102 | { |
||
| 105 | } |
||
| 106 |