| Total Complexity | 8 |
| Total Lines | 79 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class JiraResourceOwner implements ResourceOwnerInterface |
||
| 9 | { |
||
| 10 | use ArrayAccessorTrait; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Raw response |
||
| 14 | * |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $response; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Creates new resource owner. |
||
| 21 | * |
||
| 22 | * @param array $response |
||
| 23 | */ |
||
| 24 | public function __construct(array $response = []) |
||
| 25 | { |
||
| 26 | $this->response = $response; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Get resource owner avatar url |
||
| 31 | * |
||
| 32 | * @return string|null |
||
| 33 | */ |
||
| 34 | public function getAvatarUrl() |
||
| 35 | { |
||
| 36 | return $this->getValueByKey($this->response, '0.avatarUrl'); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get resource owner id |
||
| 41 | * |
||
| 42 | * @return string|null |
||
| 43 | */ |
||
| 44 | public function getId() |
||
| 45 | { |
||
| 46 | return $this->getValueByKey($this->response, '0.id'); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Get resource owner name |
||
| 51 | * |
||
| 52 | * @return string|null |
||
| 53 | */ |
||
| 54 | public function getName() |
||
| 55 | { |
||
| 56 | return $this->getValueByKey($this->response, '0.name'); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Get resource owner scopes |
||
| 61 | * |
||
| 62 | * @return array|null |
||
| 63 | */ |
||
| 64 | public function getScopes() |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Get resource owner url |
||
| 71 | * |
||
| 72 | * @return string|null |
||
| 73 | */ |
||
| 74 | public function getUrl() |
||
| 75 | { |
||
| 76 | return ($cloudId = $this->getId()) ? 'https://api.atlassian.com/ex/jira/'.$cloudId.'/' : null; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Return all of the owner details available as an array. |
||
| 81 | * |
||
| 82 | * @return array |
||
| 83 | */ |
||
| 84 | public function toArray() |
||
| 87 | } |
||
| 88 | } |
||
| 89 |