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