| Total Complexity | 8 |
| Total Lines | 106 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class TwitterUserInterface implements ResourceOwnerInterface, SocialUserInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | protected $response; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var integer |
||
| 17 | */ |
||
| 18 | protected $id; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $email; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $firstName; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var string |
||
| 32 | */ |
||
| 33 | protected $lastName; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var string |
||
| 37 | */ |
||
| 38 | protected $username; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param array $response |
||
| 42 | */ |
||
| 43 | public function __construct(array $response) |
||
| 44 | { |
||
| 45 | $this->response = $response; |
||
| 46 | |||
| 47 | $this->id = intval($this->response['user_id']); |
||
| 48 | |||
| 49 | if (isset($this->response['email'])) { |
||
| 50 | $this->email = $this->response['email']; |
||
| 51 | } |
||
| 52 | |||
| 53 | $this->username = preg_replace('/[^a-z\d]/i', '', $this->response['screen_name']); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Returns all the data obtained about the user. |
||
| 58 | * |
||
| 59 | * @return array |
||
| 60 | */ |
||
| 61 | public function toArray() |
||
| 62 | { |
||
| 63 | return $this->response; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Get the value of Id |
||
| 68 | * |
||
| 69 | * @return integer |
||
| 70 | */ |
||
| 71 | public function getId() |
||
| 72 | { |
||
| 73 | return $this->id; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Get the value of Email |
||
| 78 | * |
||
| 79 | * @return string |
||
| 80 | */ |
||
| 81 | public function getEmail() |
||
| 82 | { |
||
| 83 | return $this->email; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Get the value of First Name |
||
| 88 | * |
||
| 89 | * @return string |
||
| 90 | */ |
||
| 91 | public function getFirstName() |
||
| 92 | { |
||
| 93 | return $this->firstName; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Get the value of Last Name |
||
| 98 | * |
||
| 99 | * @return string |
||
| 100 | */ |
||
| 101 | public function getLastName() |
||
| 102 | { |
||
| 103 | return $this->lastName; |
||
| 104 | } |
||
| 105 | |||
| 106 | /** |
||
| 107 | * Get the value of Username |
||
| 108 | * |
||
| 109 | * @return string |
||
| 110 | */ |
||
| 111 | public function getUsername() |
||
| 114 | } |
||
| 115 | |||
| 116 | } |
||
| 117 |