PluginProbe
Authorizer / 3.9.0
Authorizer v3.9.0
3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 2.9.6 All 126 releases
authorizer / vendor / league / oauth2-github / src / Provider / GithubResourceOwner.php

GithubResourceOwner.php in Authorizer 3.9.0, at vendor/league/oauth2-github/src/Provider/GithubResourceOwner.php

109 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace League\OAuth2\Client\Provider;
2
3 use League\OAuth2\Client\Tool\ArrayAccessorTrait;
4
5 class GithubResourceOwner implements ResourceOwnerInterface
6 {
7 use ArrayAccessorTrait;
8
9 /**
10 * Domain
11 *
12 * @var string
13 */
14 protected $domain;
15
16 /**
17 * Raw response
18 *
19 * @var array
20 */
21 protected $response;
22
23 /**
24 * Creates new resource owner.
25 *
26 * @param array $response
27 */
28 public function __construct(array $response = array())
29 {
30 $this->response = $response;
31 }
32
33 /**
34 * Get resource owner id
35 *
36 * @return string|null
37 */
38 public function getId()
39 {
40 return $this->getValueByKey($this->response, 'id');
41 }
42
43 /**
44 * Get resource owner email
45 *
46 * @return string|null
47 */
48 public function getEmail()
49 {
50 return $this->getValueByKey($this->response, 'email');
51 }
52
53 /**
54 * Get resource owner name
55 *
56 * @return string|null
57 */
58 public function getName()
59 {
60 return $this->getValueByKey($this->response, 'name');
61 }
62
63 /**
64 * Get resource owner nickname
65 *
66 * @return string|null
67 */
68 public function getNickname()
69 {
70 return $this->getValueByKey($this->response, 'login');
71 }
72
73 /**
74 * Get resource owner url
75 *
76 * @return string|null
77 */
78 public function getUrl()
79 {
80 $urlParts = array_filter([$this->domain, $this->getNickname()]);
81
82 return count($urlParts) ? implode('/', $urlParts) : null;
83 }
84
85 /**
86 * Set resource owner domain
87 *
88 * @param string $domain
89 *
90 * @return ResourceOwner
91 */
92 public function setDomain($domain)
93 {
94 $this->domain = $domain;
95
96 return $this;
97 }
98
99 /**
100 * Return all of the owner details available as an array.
101 *
102 * @return array
103 */
104 public function toArray()
105 {
106 return $this->response;
107 }
108 }
109