create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace rhertogh\Yii2Oauth2Server\exceptions;
4
5
use League\OAuth2\Server\Exception\UniqueTokenIdentifierConstraintViolationException;
6
use rhertogh\Yii2Oauth2Server\interfaces\exceptions\Oauth2ServerExceptionInterface;
7
8
// phpcs:ignore Generic.Files.LineLength.TooLong
9
class Oauth2UniqueTokenIdentifierConstraintViolationException extends UniqueTokenIdentifierConstraintViolationException implements
10
    Oauth2ServerExceptionInterface
11
{
12
    /**
13
     * @inheritDoc
14
     * @param null $message
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $message is correct as it would always require null to be passed?
Loading history...
15
     * @return static
16
     */
17 2
    public static function create($errorMessage = null)
18
    {
19 2
        if (empty($errorMessage)) {
20 1
            $errorMessage = 'Could not create unique access token identifier';
21
        }
22
23 2
        return new static($errorMessage, 100, 'access_token_duplicate', 500);
24
    }
25
}
26