Completed
Pull Request — master (#32)
by Yann
03:30
created

TokenConsumedException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
wmc 1
cbo 1
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 1
1
<?php
2
3
namespace Yokai\SecurityTokenBundle\Exception;
4
5
/**
6
 * Exception thrown when token is fetched, but already consumed.
7
 *
8
 * @author Yann Eugoné <[email protected]>
9
 */
10
class TokenConsumedException extends InvalidTokenException
11
{
12
    /**
13
     * Create an instance of this class.
14
     *
15
     * @param string $value   Token value
16
     * @param string $purpose Token purpose
17
     * @param int    $usages  Count usages
18
     *
19
     * @return TokenConsumedException
0 ignored issues
show
Documentation introduced by
Should the return type not be \self?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
20
     */
21 3
    public static function create(string $value, string $purpose, int $usages): self
22
    {
23 3
        return new self(
24 3
            sprintf(
25 3
                'The "%s" token with value "%s" was used times "%s".',
26 3
                $purpose,
27 3
                $value,
28 3
                $usages
29
            )
30
        );
31
    }
32
}
33