Completed
Pull Request — master (#471)
by
unknown
02:44
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\OAuth1\Token\StdOAuth1Token;
6
use OAuth\Common\Http\Exception\TokenResponseException;
7
use OAuth\Common\Http\Uri\Uri;
8
use OAuth\Common\Consumer\CredentialsInterface;
9
use OAuth\Common\Storage\TokenStorageInterface;
10
use OAuth\Common\Http\Client\ClientInterface;
11
use OAuth\Common\Http\Uri\UriInterface;
12
use OAuth\OAuth1\Signature\SignatureInterface;
13
14
class QuickBooks extends AbstractService
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function __construct(
20
        CredentialsInterface $credentials,
21
        ClientInterface $httpClient,
22
        TokenStorageInterface $storage,
23
        SignatureInterface $signature,
24
        UriInterface $baseApiUri = null
25
    ) {
26
        parent::__construct(
27
            $credentials,
28
            $httpClient,
29
            $storage,
30
            $signature,
31
            $baseApiUri
32
        );
33
34
        if (null === $baseApiUri) {
35
            $this->baseApiUri = new Uri('https://quickbooks.api.intuit.com/');
36
        }
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getRequestTokenEndpoint()
43
    {
44
        return new Uri('https://oauth.intuit.com/oauth/v1/get_request_token');
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getAuthorizationEndpoint()
51
    {
52
        return new Uri('https://appcenter.intuit.com/Connect/Begin');
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getAccessTokenEndpoint()
59
    {
60
        return new Uri('https://oauth.intuit.com/oauth/v1/get_access_token');
61
    }
62
63
    /**
64
     * {@inheritDoc}
65
     */
66
    public function request(
67
        $path,
68
        $method = 'GET',
69
        $body = null,
70
        array $extraHeaders = array()
71
    ) {
72
        $extraHeaders['Accept'] = 'application/json';
73
        return parent::request($path, $method, $body, $extraHeaders);
74
    }
75
}
76