Completed
Push — master ( f7e09f...fa72d2 )
by Michał
01:58
created

Plaintext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 22
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sign() 0 4 1
A getMethod() 0 4 1
1
<?php namespace nyx\auth\id\protocols\oauth1\signers;
2
3
// External dependencies
4
use Psr\Http\Message\RequestInterface as Request;
5
6
// Internal dependencies
7
use nyx\auth\id\protocols\oauth1;
8
use nyx\auth;
9
10
/**
11
 * OAuth 1.0a PLAINTEXT Request Signer
12
 *
13
 * @package     Nyx\Auth
14
 * @version     0.1.0
15
 * @author      Michal Chojnacki <[email protected]>
16
 * @copyright   2012-2017 Nyx Dev Team
17
 * @link        https://github.com/unyx/nyx
18
 * ----
19
 * @see         https://oauth.net/core/1.0a/#anchor21 (Spec #9.4 PLAINTEXT)
20
 */
21
class Plaintext extends oauth1\Signer
22
{
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function getMethod() : string
27
    {
28
        return oauth1\interfaces\Signer::METHOD_PLAINTEXT;
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     *
34
     * @see https://oauth.net/core/1.0a/#anchor22 (Spec #9.4.1 PLAINTEXT / Generating signature):
35
     * "(...) the concatenated encoded values of the Consumer Secret and Token Secret (...)
36
     *        The result MUST be encoded again."
37
     */
38
    public function sign(Request $request, array $params, auth\id\credentials\Client $client, auth\interfaces\Credentials $token = null) : string
39
    {
40
        return rawurlencode($this->createKey($client, $token));
41
    }
42
}
43