Issues (16)

src/Traits/AuthorizationTrait.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace Stevenmaguire\Services\Trello\Traits;
4
5
use League\OAuth1\Client\Credentials\TemporaryCredentials;
6
7
trait AuthorizationTrait
8
{
9
    /**
10
     * Retrieves currently configured authorization broker.
11
     *
12
     * @return Stevenmaguire\Services\Trello\Authorization
0 ignored issues
show
The type Stevenmaguire\Services\T...es\Trello\Authorization was not found. Did you mean Stevenmaguire\Services\Trello\Authorization? If so, make sure to prefix the type with \.
Loading history...
13
     * @codeCoverageIgnore
14
     */
15
    abstract public function getAuthorization();
16
17
    /**
18
     * Retrieves currently configured http broker.
19
     *
20
     * @return Stevenmaguire\Services\Trello\Http
0 ignored issues
show
The type Stevenmaguire\Services\T...re\Services\Trello\Http was not found. Did you mean Stevenmaguire\Services\Trello\Http? If so, make sure to prefix the type with \.
Loading history...
21
     * @codeCoverageIgnore
22
     */
23
    abstract public function getHttp();
24
25
    /**
26
     * Retrieves http response from Trello api for authorization.
27
     *
28
     * @param  array $attributes
29
     *
30 2
     * @return object
31
     */
32 2
    public function getAuthorize($attributes = [])
33
    {
34
        return $this->getHttp()->get('authorize', $attributes);
35
    }
36
37
    /**
38
     * Retrieves complete authorization url.
39
     *
40
     * @param  League\OAuth1\Client\Credentials\TemporaryCredentials   $temporaryCredentials
0 ignored issues
show
The type Stevenmaguire\Services\T...ls\TemporaryCredentials was not found. Did you mean League\OAuth1\Client\Cre...ls\TemporaryCredentials? If so, make sure to prefix the type with \.
Loading history...
41
     *
42 4
     * @return string
43
     */
44 4
    public function getAuthorizationUrl(TemporaryCredentials $temporaryCredentials = null)
45
    {
46
        return $this->getAuthorization()->getAuthorizationUrl($temporaryCredentials);
47
    }
48
49
    /**
50
     * Retrives access token credentials with token and verifier.
51
     *
52
     * @param  string                                                  $token
53
     * @param  string                                                  $verifier
54
     * @param  League\OAuth1\Client\Credentials\TemporaryCredentials   $temporaryCredentials
55
     *
56 4
     * @return League\OAuth1\Client\Credentials\CredentialsInterface
0 ignored issues
show
The type Stevenmaguire\Services\T...ls\CredentialsInterface was not found. Did you mean League\OAuth1\Client\Cre...ls\CredentialsInterface? If so, make sure to prefix the type with \.
Loading history...
57
     */
58 4
    public function getAccessToken($token, $verifier, TemporaryCredentials $temporaryCredentials = null)
59
    {
60
        return $this->getAuthorization()->getToken($token, $verifier, $temporaryCredentials);
61
    }
62
63
    /**
64
     * Creates and returns new temporary credentials instance.
65
     *
66 2
     * @return League\OAuth1\Client\Credentials\CredentialsInterface
67
     */
68 2
    public function getTemporaryCredentials()
69
    {
70
        return $this->getAuthorization()->getTemporaryCredentials();
71 2
    }
72
}
73