Passed
Pull Request — master (#81)
by
unknown
15:22
created

WishlistCookieTokenResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 6
c 1
b 1
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusWishlistPlugin\Resolver;
13
14
use Symfony\Component\HttpFoundation\RequestStack;
15
16
final class WishlistCookieTokenResolver implements WishlistCookieTokenResolverInterface
17
{
18
    private RequestStack $requestStack;
19
20
    private string $wishlistCookieToken;
21
22
    public function __construct(
23
        RequestStack $requestStack,
24
        string $wishlistCookieToken
25
    ) {
26
        $this->requestStack = $requestStack;
27
        $this->wishlistCookieToken = $wishlistCookieToken;
28
    }
29
30
    public function resolve(): string
31
    {
32
        return $this->requestStack->getMainRequest()->cookies->get($this->wishlistCookieToken);
33
    }
34
}
35