PluginProbe
Authorizer / 3.15.3
Authorizer v3.15.3
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.15.3, at vendor/league/oauth2-github/src/Provider/GithubResourceOwner.php

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