SessionAttributeNotFoundException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromAttributeNameAndRequest() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PSR7Csrf\Exception;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
use UnexpectedValueException;
9
10
class SessionAttributeNotFoundException extends UnexpectedValueException implements ExceptionInterface
11
{
12 1
    public static function fromAttributeNameAndRequest(string $attributeName, ServerRequestInterface $request) : self
13
    {
14 1
        return new self(sprintf(
15 1
            'Provided request contains no matching session attribute "%s", attributes %s exist',
16
            $attributeName,
17 1
            json_encode(array_keys($request->getAttributes()))
18
        ));
19
    }
20
}
21