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

AuthorizationFlow::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
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