GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 38ea04...fb6180 )
by Bill
02:29
created

EnrichmentApi::person()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.1481

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 6
cp 0.6667
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.1481
1
<?php
2
3
namespace wlbrough\clearbit;
4
5
use wlbrough\clearbit\Abstracts\Api;
6
7
class EnrichmentApi extends Api
8
{
9
    private static $apiUrlTemplate = 'https://pk:@%s%s.clearbit.com/v2/%s/find?%s=%s';
10
    private $httpClient = null;
11
12 24
    public function __construct($key, $client = null)
13
    {
14 24
        self::$apiUrlTemplate = preg_replace('(pk)', $key, self::$apiUrlTemplate);
15 24
        $this->httpClient = $client;
16 24
    }
17
18 6
    public function combined($email)
19
    {
20 6
        $apiUrl = $this->composeUrl('person', 'combined', 'email', $email);
21 6
        return $this->call($apiUrl, $this->httpClient);
22
    }
23
24 6
    public function person($email, $subscribe = false)
25
    {
26 6
        $apiUrl = $this->composeUrl('person', 'people', 'email', $email);
27
28 6
        if ($subscribe) {
29
            $apiUrl .= '&subscribe=true';
30
        }
31
32 6
        return $this->call($apiUrl, $this->httpClient);
33
    }
34
35
    public function flagPerson($personId, $corrected = null)
36
    {
37
        $apiUrl = "https://person.clearbit.com/v1/people/$personId/flag";
38
        return $this->post($apiUrl, $corrected, 200, $this->httpClient);
39
    }
40
41 6
    public function company($domain)
42
    {
43 6
        $apiUrl = $this->composeUrl('company', 'companies', 'domain', $domain);
44 6
        return $this->call($apiUrl, $this->httpClient);
45
    }
46
47 3
    public function flagCompany($domain, $corrected = null)
48
    {
49
        $apiUrl = "https://company.clearbit.com/v2/companies/flag?domain=$domain";
50
        return $this->post($apiUrl, $corrected, 200, $this->httpClient);
51 3
    }
52
53 18
    private function composeUrl($subdomain, $path, $query, $parameter)
54
    {
55 18
        $streaming = $this->useStreaming ? '' : '-streaming';
56 18
        return sprintf(self::$apiUrlTemplate, $subdomain, $streaming, $path, $query, $parameter);
57
    }
58
}
59