ClientCredentialsOnlyTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 51
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBaseAuthorizationUrl() 0 4 1
A getDefaultScopes() 0 4 1
A getResourceOwnerDetailsUrl() 0 4 1
A createResourceOwner() 0 4 1
1
<?php
2
3
namespace Stevenmaguire\OAuth2\Client\Tool;
4
5
use League\OAuth2\Client\Token\AccessToken;
6
use Stevenmaguire\OAuth2\Client\Provider\Exception\ProviderConfigurationException;
7
8
trait ClientCredentialsOnlyTrait
9
{
10
    /**
11
     * Get authorization url to begin OAuth flow
12
     *
13
     * @return string
14
     */
15 4
    public function getBaseAuthorizationUrl()
16
    {
17 4
        throw ProviderConfigurationException::clientCredentialsOnly();
18
    }
19
20
    /**
21
     * Get the default scopes used by this provider.
22
     *
23
     * This should not be a complete list of all scopes, but the minimum
24
     * required for the provider user interface!
25
     *
26
     * @return array
27
     * @codeCoverageIgnore
28
     */
29
    protected function getDefaultScopes()
30
    {
31
        return [];
32
    }
33
34
    /**
35
     * Get provider url to fetch user details
36
     *
37
     * @param  AccessToken $token
38
     *
39
     * @return string
40
     */
41 2
    public function getResourceOwnerDetailsUrl(AccessToken $token)
0 ignored issues
show
Unused Code introduced by
The parameter $token is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43 2
        throw ProviderConfigurationException::clientCredentialsOnly();
44
    }
45
46
    /**
47
     * Generate a user object from a successful user details request.
48
     *
49
     * @param object $response
50
     * @param AccessToken $token
51
     * @return YelpResourceOwner
52
     * @codeCoverageIgnore
53
     */
54
    protected function createResourceOwner(array $response, AccessToken $token)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $token is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        throw ProviderConfigurationException::clientCredentialsOnly();
57
    }
58
}
59