Completed
Pull Request — master (#472)
by
unknown
02:39
created

QuickBooks::parseAccessTokenResponse()   B

Complexity

Conditions 4
Paths 3

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 24
rs 8.6845
c 1
b 0
f 0
cc 4
eloc 16
nc 3
nop 1
1
<?php
2
3
namespace OAuth\OAuth1\Service;
4
5
use OAuth\Common\Http\Uri\Uri;
6
use OAuth\Common\Consumer\CredentialsInterface;
7
use OAuth\Common\Storage\TokenStorageInterface;
8
use OAuth\Common\Http\Client\ClientInterface;
9
use OAuth\Common\Http\Uri\UriInterface;
10
use OAuth\OAuth1\Signature\SignatureInterface;
11
12
class QuickBooks extends AbstractService
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function __construct(
18
        CredentialsInterface $credentials,
19
        ClientInterface $httpClient,
20
        TokenStorageInterface $storage,
21
        SignatureInterface $signature,
22
        UriInterface $baseApiUri = null
23
    ) {
24
        parent::__construct(
25
            $credentials,
26
            $httpClient,
27
            $storage,
28
            $signature,
29
            $baseApiUri
30
        );
31
32
        if (null === $baseApiUri) {
33
            $this->baseApiUri = new Uri('https://quickbooks.api.intuit.com/');
34
        }
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getRequestTokenEndpoint()
41
    {
42
        return new Uri('https://oauth.intuit.com/oauth/v1/get_request_token');
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getAuthorizationEndpoint()
49
    {
50
        return new Uri('https://appcenter.intuit.com/Connect/Begin');
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getAccessTokenEndpoint()
57
    {
58
        return new Uri('https://oauth.intuit.com/oauth/v1/get_access_token');
59
    }
60
61
    /**
62
     * {@inheritDoc}
63
     */
64
    public function request(
65
        $path,
66
        $method = 'GET',
67
        $body = null,
68
        array $extraHeaders = array()
69
    ) {
70
        $extraHeaders['Accept'] = 'application/json';
71
        return parent::request($path, $method, $body, $extraHeaders);
72
    }
73
}
74