Completed
Push — master ( 8e723a...287f90 )
by Risan Bagja
02:36
created

AuthorizationFlow   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 7
Bugs 1 Features 0
Metric Value
c 7
b 1
f 0
dl 0
loc 35
wmc 2
lcom 0
cbo 2
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorizeUrl() 0 4 1
A buildAuthorizationUrl() 0 8 1
config() 0 1 ?
1
<?php
2
3
namespace OAuth1\Flows;
4
5
use OAuth1\Contracts\Tokens\RequestTokenInterface;
6
7
trait AuthorizationFlow
8
{
9
    /**
10
     * Authorize url.
11
     *
12
     * @return string
13
     */
14 2
    public function authorizeUrl()
15
    {
16 2
        return $this->config()->authorizeUrl();
17
    }
18
19
    /**
20
     * Build authorization url.
21
     *
22
     * @param \OAuth1\Contracts\Tokens\RequestTokenInterface $requestToken
23
     *
24
     * @return string
25
     */
26 1
    public function buildAuthorizationUrl(RequestTokenInterface $requestToken)
27
    {
28 1
        $query = http_build_query([
29 1
            'oauth_token' => $requestToken->key(),
30 1
        ]);
31
32 1
        return $this->authorizeUrl().'?'.$query;
33
    }
34
35
    /**
36
     * Get client configuration.
37
     *
38
     * @return \OAuth1\Contracts\ConfigInterface
39
     */
40
    abstract public function config();
41
}
42