Code Duplication    Length = 23-24 lines in 4 locations

src/Connectors/Linkedin.php 1 location

@@ 82-105 (lines=24) @@
79
    }
80
81
82
    public function getProfile()
83
    {
84
        $path = '/people/~:(id,first-name,last-name,maiden-name,public-profile-url,formatted-name,num-connections,email-address,num-recommenders)?format=json';
85
        $result = $this->request($path);
86
        $json_result = json_decode($result, true);
87
88
        $mapping = [
89
            'id' => 'id',
90
            'email' => 'emailAddress',
91
            'name' => 'formattedName',
92
            'first_name' => 'firstName',
93
            'middle_name' => 'maidenName',
94
            'last_name' => 'lastName',
95
            // 'username' => 'username',
96
            'link' => 'publicProfileUrl',
97
            'likes' => 'numConnections'
98
        ];
99
100
        $profile = Profile::create($mapping, $json_result);
101
        $profile->provider = static::$provider;
102
        $profile->raw_response = $result;
103
104
        return $profile;
105
    }
106
107
    public function getStats()
108
    {

src/Connectors/LinkedinGroup.php 1 location

@@ 108-130 (lines=23) @@
105
    }
106
107
108
    public function getProfile()
109
    {
110
        $path = '/people/~:(id,first-name,last-name,maiden-name,public-profile-url,formatted-name,num-connections,email-address,num-recommenders)?format=json';
111
        $response = $this->service->request($path);
112
        $profile_json = json_decode($response, true);
113
114
        $mapping = [
115
            'id' => 'id',
116
            'email' => 'emailAddress',
117
            'name' => 'formattedName',
118
            'first_name' => 'firstName',
119
            'middle_name' => 'maidenName',
120
            'last_name' => 'lastName',
121
            // 'username' => 'username',
122
            'link' => 'publicProfileUrl'
123
        ];
124
125
        $profile = Profile::create($mapping, $profile_json);
126
        $profile->provider = static::$provider;
127
        $profile->raw_response = $response;
128
129
        return $profile;
130
    }
131
132
    public function getStats()
133
    {

src/Connectors/Twitter.php 1 location

@@ 132-155 (lines=24) @@
129
        $this->screen_name = $extra_params['screen_name'];
130
    }
131
132
    public function getProfile()
133
    {
134
        $path = '/account/verify_credentials.json?skip_status=1';
135
        $result = $this->request($path);
136
        $profile_json = json_decode($result, true);
137
138
        $mapping = [
139
            'id' => 'id_str',
140
            // 'email' => 'email',
141
            'name' => 'name',
142
            'first_name' => 'first_name',
143
            'middle_name' => 'middle_name',
144
            'last_name' => 'last_name',
145
            'username' => 'screen_name',
146
            'link' => 'link'
147
        ];
148
149
        $profile = Profile::create($mapping, $profile_json);
150
        $profile->provider = static::$provider;
151
        $profile->raw_response = $result;
152
        $profile->link = 'https://twitter.com/'.$profile_json['screen_name'];
153
154
        return $profile;
155
    }
156
157
    public function getPermissions()
158
    {

src/Connectors/LinkedinPage.php 1 location

@@ 70-92 (lines=23) @@
67
    }
68
69
70
    public function getProfile()
71
    {
72
        $path = '/people/~:(id,first-name,last-name,maiden-name,public-profile-url,formatted-name,num-connections,email-address,num-recommenders)?format=json';
73
        $response = $this->service->request($path);
74
        $profile_json = json_decode($response, true);
75
76
        $mapping = [
77
            'id' => 'id',
78
            'email' => 'emailAddress',
79
            'name' => 'formattedName',
80
            'first_name' => 'firstName',
81
            'middle_name' => 'maidenName',
82
            'last_name' => 'lastName',
83
            // 'username' => 'username',
84
            'link' => 'publicProfileUrl'
85
        ];
86
87
        $profile = Profile::create($mapping, $profile_json);
88
        $profile->provider = static::$provider;
89
        $profile->raw_response = $response;
90
91
        return $profile;
92
    }
93
94
    public function getStats()
95
    {