CookieTokenExtractor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A extract() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the BEAR.JwtAuthModule package.
5
 *
6
 * @license http://opensource.org/licenses/MIT MIT
7
 */
8
namespace BEAR\JwtAuth\Extractor;
9
10
use Aura\Web\Request;
11
use BEAR\JwtAuth\Annotation\Cookie;
12
13
class CookieTokenExtractor implements TokenExtractorInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    private $cookie;
19
20
    /**
21
     * @var Request
22
     */
23
    private $request;
24
25
    /**
26
     * @Cookie("cookie")
27
     */
28 3
    public function __construct(string $cookie, Request $request)
29
    {
30 3
        $this->cookie = $cookie;
31 3
        $this->request = $request;
32 3
    }
33
34 2
    public function extract() : string
35
    {
36 2
        return $this->request->cookies->get($this->cookie) ?? '';
37
    }
38
}
39