Completed
Push — master ( e214c2...9b8774 )
by Kevin
02:27
created

InvalidToken   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 24
loc 24
wmc 2
lcom 0
cbo 0
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A token() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Zenstruck\JWT\Exception;
4
5
use Zenstruck\JWT\Token;
6
7
/**
8
 * @author Kevin Bond <[email protected]>
9
 */
10 View Code Duplication
abstract class InvalidToken extends \DomainException implements Exception
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    private $token;
13
14
    /**
15
     * @param Token           $token
16
     * @param string          $message
17
     * @param \Exception|null $previous
18
     */
19 36
    public function __construct(Token $token, $message = 'Invalid token.', \Exception $previous = null)
20
    {
21 36
        $this->token = $token;
22
23 36
        parent::__construct($message, 0, $previous);
24 36
    }
25
26
    /**
27
     * @return Token
28
     */
29 5
    final public function token()
30
    {
31 5
        return $this->token;
32
    }
33
}
34