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

TokenNotFoundException::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1
rs 9.9332
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Yokai\SecurityTokenBundle\Exception;
4
5
/**
6
 * Exception thrown when token is not found.
7
 *
8
 * @author Yann Eugoné <[email protected]>
9
 */
10
class TokenNotFoundException extends InvalidTokenException
11
{
12
    /**
13
     * Create an instance of this class.
14
     *
15
     * @param string $value   The token value
16
     * @param string $purpose The token purpose
17
     *
18
     * @return TokenNotFoundException
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...
19
     */
20 2
    public static function create(string $value, string $purpose): self
21
    {
22 2
        return new self(
23 2
            sprintf(
24 2
                'The "%s" token with value "%s" was not found.',
25 2
                $purpose,
26 2
                $value
27
            )
28
        );
29
    }
30
}
31