| Total Complexity | 6 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 14 | class ChasterAppResourceOwner implements ResourceOwnerInterface |
||
| 15 | { |
||
| 16 | use ArrayAccessorTrait; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Data of the user profile |
||
| 20 | * @var array |
||
| 21 | */ |
||
| 22 | protected array $response; |
||
| 23 | |||
| 24 | public function __construct(array $response = []) |
||
| 25 | { |
||
| 26 | $this->response = $response; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Provide data using array key of profile data |
||
| 31 | * @param string $name |
||
| 32 | * |
||
| 33 | * @return mixed |
||
| 34 | * |
||
| 35 | * @noinspection MagicMethodsValidityInspection |
||
| 36 | */ |
||
| 37 | public function __get(string $name) |
||
| 38 | { |
||
| 39 | return $this->getValueByKey($this->response, $name); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get profile email |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | public function getEmail(): string |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Get profile _id |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function getId(): string |
||
| 56 | { |
||
| 57 | return $this->getValueByKey($this->response, '_id', ''); |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Get profile Username |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | public function getUsername(): string |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Return profile array |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | public function toArray(): array |
||
| 76 | } |
||
| 77 | } |
||
| 78 |