PlainText   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 29
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sign() 0 4 1
A verify() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the tmilos/jose-jwt package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Tmilos\JoseJwt\Jws;
13
14
use Tmilos\JoseJwt\Error\JoseJwtException;
15
use Tmilos\JoseJwt\Util\StringUtils;
16
17
class PlainText implements JwsAlgorithm
18
{
19
    /**
20
     * @param string $securedInput
21
     * @param string $key
22
     *
23
     * @return string
24
     */
25
    public function sign($securedInput, $key)
26
    {
27
        return '';
28
    }
29
30
    /**
31
     * @param string $signature
32
     * @param string $securedInput
33
     * @param string $key
34
     *
35
     * @return bool
36
     */
37
    public function verify($signature, $securedInput, $key)
38
    {
39
        if (null != $key) {
40
            throw new JoseJwtException('Plaintext algorithm expects key to be null');
41
        }
42
43
        return StringUtils::length($signature) === 0;
44
    }
45
}
46