| Total Complexity | 5 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class BasecampResourceOwner 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 | 2 | public function __construct(array $response = array()) |
|
| 25 | { |
||
| 26 | 2 | $this->response = $response; |
|
| 27 | 2 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Get resource owner id |
||
| 31 | * |
||
| 32 | * @return string|null |
||
| 33 | */ |
||
| 34 | 2 | public function getId() |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get resource owner name |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 2 | public function getName() |
|
| 45 | { |
||
| 46 | 2 | return implode(' ', array_filter([ |
|
| 47 | 2 | $this->getValueByKey($this->response, 'identity.first_name'), |
|
| 48 | 2 | $this->getValueByKey($this->response, 'identity.last_name') |
|
| 49 | ])); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Get resource owner email |
||
| 54 | * |
||
| 55 | * @return string|null |
||
| 56 | */ |
||
| 57 | 2 | public function getEmail() |
|
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Return all of the owner details available as an array. |
||
| 64 | * |
||
| 65 | * @return array |
||
| 66 | */ |
||
| 67 | 2 | public function toArray() |
|
| 72 |