Completed
Push — master ( 9473ea...cfd0e6 )
by Michał
05:47
created

Plaintext::sign()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 4
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 getSignatureMethod() : 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