Completed
Push — master ( 6ad5a2...634c9e )
by Łukasz
12s
created

RemoveItemFromCartRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getCommand() 0 4 1
1
<?php
2
3
namespace Sylius\ShopApiPlugin\Request;
4
5
use Sylius\ShopApiPlugin\Command\RemoveItemFromCart;
6
use Symfony\Component\HttpFoundation\Request;
7
8
final class RemoveItemFromCartRequest
9
{
10
    /** @var string */
11
    private $token;
12
13
    /** @var mixed */
14
    private $id;
15
16
    public function __construct(Request $request)
17
    {
18
        $this->token = $request->attributes->get('token');
19
        $this->id = $request->attributes->get('id');
20
    }
21
22
    public function getCommand(): RemoveItemFromCart
23
    {
24
        return new RemoveItemFromCart($this->token, $this->id);
25
    }
26
}
27